Skip to content

Commit

Permalink
#34 Implementing skeleton code
Browse files Browse the repository at this point in the history
  • Loading branch information
trifuns authored and aabadie committed Jun 23, 2022
1 parent 409c168 commit c40f35b
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions projects/03app_us_ranging/03app_us_ranging.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <nrf.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// uncoment the board.h when porting this code to DotBot
//#include "board.h"
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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.

}

0 comments on commit c40f35b

Please sign in to comment.