static void start() { counter = 0; missed_packets_counter = 0; received_packets_counter = 0; uint8_t lcd_line = 0; switch(current_state) { case STATE_CONFIG_DIRECTION: is_mode_rx? sprintf(lcd_msg, "PER RX") : sprintf(lcd_msg, "PER TX"); break; case STATE_CONFIG_DATARATE: lcd_line = 1; switch(current_channel_id.channel_header.ch_class) { case PHY_CLASS_LO_RATE: sprintf(lcd_msg, "LO-RATE"); break; case PHY_CLASS_NORMAL_RATE: sprintf(lcd_msg, "NOR-RATE"); break; case PHY_CLASS_HI_RATE: sprintf(lcd_msg, "HI-RATE"); break; } break; case STATE_RUNNING: lcd_line = 2; if(is_mode_rx) { sprintf(lcd_msg, "RUN RX"); //lcd_write_string(lcd_msg); console_printf("%s,%s,%s,%s,%s,%s\n", "channel_id", "counter", "rssi", "tx_id", "rx_id", "timestamp"); rx_cfg.channel_id = current_channel_id; timer_post_task(&start_rx, TIMER_TICKS_PER_SEC * 5); } else { hw_radio_set_idle(); sprintf(lcd_msg, "RUN TX"); //lcd_write_string(lcd_msg); timer_post_task(&transmit_packet, TIMER_TICKS_PER_SEC * 5); } break; } #ifdef PLATFORM_EFM32GG_STK3700 lcd_write_string(lcd_msg); #else lcd_write_line(lcd_line, lcd_msg); #endif }
static void start() { counter = 0; missed_packets_counter = 0; received_packets_counter = 0; switch(current_state) { case STATE_CONFIG_DIRECTION: is_mode_rx? sprintf(lcd_msg, "PER RX") : sprintf(lcd_msg, "PER TX"); break; case STATE_CONFIG_DATARATE: switch(current_channel_id.channel_header.ch_class) { case PHY_CLASS_LO_RATE: sprintf(lcd_msg, "LO-RATE"); break; case PHY_CLASS_NORMAL_RATE: sprintf(lcd_msg, "NOR-RATE"); break; case PHY_CLASS_HI_RATE: sprintf(lcd_msg, "HI-RATE"); break; } break; case STATE_RUNNING: if(is_mode_rx) { sprintf(lcd_msg, "RUN RX"); lcd_write_string(lcd_msg); sprintf(record, "%s,%s,%s,%s,%s,%s\n", "channel_id", "counter", "rssi", "tx_id", "rx_id", "timestamp"); uart_transmit_message(record, strlen(record)); rx_cfg.channel_id = current_channel_id; timer_post_task(&start_rx, TIMER_TICKS_PER_SEC * 5); } else { hw_radio_set_idle(); sprintf(lcd_msg, "RUN TX"); lcd_write_string(lcd_msg); timer_post_task(&transmit_packet, TIMER_TICKS_PER_SEC * 5); } break; } lcd_write_string(lcd_msg); }
void packet_transmitted(hw_radio_packet_t* packet) { #if HW_NUM_LEDS > 0 led_toggle(0); #endif DPRINT("%d tx ok\n", counter); timer_post_task(&transmit_packet, 1000); hw_watchdog_feed(); }
void bootstrap() { DPRINT("Device booted at time: %d\n", timer_get_counter_value()); #ifndef FRAMEWORK_LOG_BINARY console_print("\r\nPER TEST - commands:\r\n"); console_print(" CHANfffriii channel settings:\r\n"); console_print(" fff frequency : 433, 868, 915\r\n"); console_print(" r rate : L(ow) N(ormal) H(igh)\r\n"); console_print(" iii center_freq_index\r\n"); console_print(" TRANsss transmit a packet every sss seconds.\r\n"); console_print(" RECV receive packets\r\n"); console_print(" RSET reset module\r\n"); #endif id = hw_get_unique_id(); hw_radio_init(&alloc_new_packet, &release_packet); rx_cfg.channel_id = current_channel_id; tx_cfg.channel_id = current_channel_id; ubutton_register_callback(0, &userbutton_callback); ubutton_register_callback(1, &userbutton_callback); fifo_init(&uart_rx_fifo, uart_rx_buffer, sizeof(uart_rx_buffer)); console_set_rx_interrupt_callback(&uart_rx_cb); console_rx_interrupt_enable(); sched_register_task(&start_rx); sched_register_task(&transmit_packet); sched_register_task(&start); sched_register_task(&process_uart_rx_fifo); current_state = STATE_CONFIG_DIRECTION; sched_post_task(&start); sched_post_task(&process_uart_rx_fifo); #ifdef PLATFORM_EFM32GG_STK3700 #else char str[20]; channel_id_to_string(¤t_channel_id, str, sizeof(str)); lcd_write_line(6, str); #endif timer_post_task(&transmit_packet, TIMER_TICKS_PER_SEC * 1); }
static void packet_transmitted(hw_radio_packet_t* packet) { #if HW_NUM_LEDS > 0 led_toggle(0); #endif DPRINT("packet transmitted"); sprintf(lcd_msg, "TX %i", counter); lcd_write_string(lcd_msg); timer_tick_t delay; if(tx_packet_delay_s == 0) delay = TIMER_TICKS_PER_SEC / 5; else delay = TIMER_TICKS_PER_SEC * tx_packet_delay_s; timer_post_task(&transmit_packet, delay); }
static void packet_transmitted(hw_radio_packet_t* packet) { #if HW_NUM_LEDS > 0 led_toggle(0); #endif DPRINT("packet transmitted"); sprintf(lcd_msg, "TX %i", counter); #ifdef PLATFORM_EFM32GG_STK3700 lcd_write_string(lcd_msg); #else lcd_write_line(4, lcd_msg); #endif timer_tick_t delay; if(tx_packet_delay_s == 0) delay = TIMER_TICKS_PER_SEC / 5; else delay = TIMER_TICKS_PER_SEC * tx_packet_delay_s; //increase_channel(); timer_post_task(&transmit_packet, delay); }