void start() { tx_cfg.channel_id.channel_header.ch_coding = PHY_CODING_PN9; tx_cfg.channel_id.channel_header.ch_class = current_channel_class; tx_cfg.channel_id.channel_header.ch_freq_band = current_channel_band; tx_cfg.channel_id.center_freq_index = channel_indexes[current_channel_indexes_index]; tx_cfg.eirp = 10; #ifdef HAS_LCD char string[10] = ""; char rate; char band[3]; switch(current_channel_class) { case PHY_CLASS_LO_RATE: rate = 'L'; break; case PHY_CLASS_NORMAL_RATE: rate = 'N'; break; case PHY_CLASS_HI_RATE: rate = 'H'; break; } switch(current_channel_band) { case PHY_BAND_433: strncpy(band, "433", sizeof(band)); break; case PHY_BAND_868: strncpy(band, "868", sizeof(band)); break; case PHY_BAND_915: strncpy(band, "915", sizeof(band)); break; } sprintf(string, "%.3s%c-%i\n", band, rate, tx_cfg.channel_id.center_freq_index), lcd_write_string(string); #endif /* Configure */ configure_radio(current_modulation); /* start the radio */ start_radio(); }
int main(void) { // Set the system clock source to HS XOSC and max CPU speed, // ref. [clk]=>[clk_xosc.c] SLEEP &= ~SLEEP_OSC_PD; while( !(SLEEP & SLEEP_XOSC_S) ); CLKCON = (CLKCON & ~(CLKCON_CLKSPD | CLKCON_OSC)) | CLKSPD_DIV_1; while (CLKCON & CLKCON_OSC); SLEEP |= SLEEP_OSC_PD; // init LEDS HARDWARE_LED_INIT; // see hardware.h led_set_state(0, 0); //GREEN_LED = 0; led_set_state(1, 0); //BLUE_LED = 0; // Global interrupt enable init_timer(); EA = 1; //LED test led_set_state(0, 1); //GREEN_LED = 1; delay(1000); led_set_state(0, 0); //GREEN_LED = 0; led_set_state(1, 1); //BLUE_LED = 1; delay(1000); led_set_state(1, 0); //BLUE_LED = 0; configure_radio(); configure_serial(); while(1) { //led_set_state(0,2); get_command(); } }