From c40f35b89513e667caa9ea5df375dc9dddfc3f1c Mon Sep 17 00:00:00 2001 From: Trifun Savic Date: Mon, 20 Jun 2022 17:10:39 +0200 Subject: [PATCH] #34 Implementing skeleton code --- projects/03app_us_ranging/03app_us_ranging.c | 25 +++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/projects/03app_us_ranging/03app_us_ranging.c b/projects/03app_us_ranging/03app_us_ranging.c index 9359666be..278eff935 100644 --- a/projects/03app_us_ranging/03app_us_ranging.c +++ b/projects/03app_us_ranging/03app_us_ranging.c @@ -15,6 +15,7 @@ #include #include #include +#include // uncoment the board.h when porting this code to DotBot //#include "board.h" @@ -74,14 +75,18 @@ int main(void) { //db_board_init(); // Initialize Radio - db_radio_init(&radio_callback); // Set the callback function. + //db_radio_init(&radio_callback); // Set the callback function. + + + db_lr_radio_init(&radio_callback); + + db_radio_set_frequency(8); // Set the RX frequency to 2408 MHz. + db_radio_rx_enable(); // Start receiving packets. + // initilize the US sensor, set callback and chose the timers us_init(&us_callback, &timer_callback, us_ranging_vars.timer0, us_ranging_vars.timer1); - // Configure the radio for US ranging - us_radio_setup(); - // start ranging us_start(); @@ -135,15 +140,7 @@ void radio_callback(uint8_t *packet, uint8_t length) { // start ranging //us_start(); - + __NOP(); + } -/** - * @brief A function to setup the radio for the application needs. This function should be called after db_radio_init - */ -void us_radio_setup(void) { - - db_radio_set_frequency(8); // Set the RX frequency to 2408 MHz. - db_radio_rx_enable(); // Start receiving packets. - -} \ No newline at end of file