36 #include "hal_clocks.h" 40 #include "hal_nop_delay.h" 43 #include "pin_trace.h" 44 #include "rf_rx_ble.h" 48 #include "radio_drv.h" 49 #include "cc1x_utils.h" 50 #include "cc112x_def.h" 58 uint16_t current_pkt_no;
60 volatile bool is_timer_on =
false;
64 uint16_t start_pkt_no = 0;
71 #define GPIOTE_CHANNEL_USED 0 73 #define GPIO_PIN GPIO0 75 #define TEST_DURATION_S 100 77 #define TEST_DURATION_MS TEST_DURATION_S*1000 87 static mod_ble_data_t ble_data;
89 static volatile bool is_connected =
false;
90 void ms_timer_handler ()
92 log_printf (
"Packets dropped in %d sec : %d\n",TEST_DURATION_S, TEST_DURATION_S - pkt_no);
93 log_printf (
"Avg RSSI : %d\n", (int8_t)(rssi_sum/pkt_no));
94 log_printf (
"Test params :\n");
98 log_printf (
"Packet no.s : S %d, C %d\n", start_pkt_no, current_pkt_no);
104 static void rgb_led_init(
void)
112 static void rgb_led_cycle(
void)
117 hal_nop_delay_ms(50);
121 hal_nop_delay_ms(50);
125 hal_nop_delay_ms(50);
131 void ms_timer_10ms (
void)
144 uint8_t is_sd_enabled;
145 sd_softdevice_is_enabled(&is_sd_enabled);
147 if(is_sd_enabled == 0)
159 bool break_now =
false;
189 }
while(break_now ==
false);
196 if(radio_check_status_flag (MARC_NO_FAILURE) )
207 hal_gpio_pin_toggle (LED_BLUE);
223 if(is_timer_on ==
false)
229 start_pkt_no = current_pkt_no;
231 log_printf(
"Test Val : %d\n", current_pkt_no);
233 log_printf(
"RSSI : %d\n", (int8_t)radio_get_rssi ());
236 ble_data.rf_rx_rssi = (uint8_t)radio_get_rssi ();
237 ble_data.pkt_no = current_pkt_no;
238 ble_data.CRC_ERR = (uint8_t) radio_check_status_flag (MARC_PKT_DISC_CRC);
239 rf_rx_ble_update_status_byte (&ble_data);
241 rssi_sum += ble_data.rf_rx_rssi;
248 log_printf (
"*** Data not ready.\n");
261 log_printf(
"Hello World from RF_RX..!!\n");
263 #if DC_DC_CIRCUITRY == true //Defined in the board header file 264 NRF_POWER->DCDCEN = POWER_DCDCEN_DCDCEN_Disabled << POWER_DCDCEN_DCDCEN_Pos;
266 NRF_POWER->TASKS_LOWPWR = 1;
277 radio_set_freq (915000);
278 set_rf_packet_length (2);
280 hal_gpio_cfg_output (LNA_EN_PIN, 1);
282 NRF_GPIOTE->CONFIG[
GPIOTE_CHANNEL_USED] = ((GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos) & GPIOTE_CONFIG_MODE_Msk) |
283 ((GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos)&GPIOTE_CONFIG_POLARITY_Msk) |
284 ((GPIO_PIN << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PSEL_Msk);
285 NRF_GPIOTE->INTENSET = (GPIOTE_INTENSET_IN0_Enabled<<GPIOTE_INTENSET_IN0_Pos)&GPIOTE_INTENSET_IN0_Msk;
309 rf_rx_ble_stack_init ();
310 rf_rx_ble_gap_params_init ();
311 rf_rx_ble_adv_init ();
312 rf_rx_ble_adv_start (on_connect);
313 rf_rx_ble_service_init ();
315 ble_data.rf_rx_rssi = 0;
316 rf_rx_ble_update_status_byte (&ble_data);
320 log_printf(
"Here..!!\n");
322 NVIC_SetPriority (GPIOTE_IRQn, APP_IRQ_PRIORITY_LOW);
323 NVIC_ClearPendingIRQ (GPIOTE_IRQn);
324 NVIC_EnableIRQ (GPIOTE_IRQn);
#define GPIOTE_CHANNEL_USED
Preemption priority IRQ.
#define LEDS_ACTIVE_STATE
uint8_t vectcRxBuff[128]
Rx buffer declaration: how to store the received data.
void lfclk_init(lfclk_src_t lfclk_src)
Function to initialize the LF clock.
#define MS_TIMER_TICKS_MS(ms)
void ms_timer_init(uint32_t irq_priority)
void ms_timer_start(ms_timer_num id, ms_timer_mode mode, uint64_t ticks, void(*handler)(void))
int main(void)
Function for application main entry.
One shot call of the timer.