nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Macros

#define MAX_MENU_OPTIONS   (11UL)
 
#define MAX_CHARACTERS_PER_LINE   (16UL)
 
#define MAX_CHARECTER_IN_MENU_OPTION   (60UL)
 
#define MAX_CURSOR_POS_IN_STRING
 
#define ERROR_PIN   (8)
 

Enumerations

enum  radio_tests_t {
  RADIO_TEST_NOP,
  RADIO_TEST_TXCC,
  RADIO_TEST_TXMC,
  RADIO_TEST_TXSWEEP,
  RADIO_TEST_RXC,
  RADIO_TEST_RXSWEEP,
  RADIO_TEST_NOP,
  RADIO_TEST_TXCC,
  RADIO_TEST_TXMC,
  RADIO_TEST_TXSWEEP,
  RADIO_TEST_RXC,
  RADIO_TEST_RXSWEEP,
  RADIO_TEST_NOP,
  RADIO_TEST_TXCC,
  RADIO_TEST_TXMC,
  RADIO_TEST_TXSWEEP,
  RADIO_TEST_RXC,
  RADIO_TEST_RXSWEEP,
  RADIO_TEST_NOP,
  RADIO_TEST_TXCC,
  RADIO_TEST_TXMC,
  RADIO_TEST_TXSWEEP,
  RADIO_TEST_RXC,
  RADIO_TEST_RXSWEEP
}
 
enum  change_direction_t {
  decrement =0,
  increment,
  decrement =0,
  increment
}
 

Functions

static void radio_test (void)
 
static void gpio_config (void)
 Function for configuring ERROR_PIN as output for showing errors.
 
static void radio_init (void)
 Function for starting up the needed peripherals.
 
static void show_error (void)
 Function for setting ERROR_PIN to one and enter an infinite loop. This function is called if any of the nRF6350 functions fail.
 
static void wait_for_joystick_movement (void)
 Function for waiting until the joystick status has changed. Performs radio_test while joystick state has not changed.
 
static void change_selected_variable (change_direction_t cd)
 Function for identifying the change in menu position.
 
static void joystick_wait_change_update_pos_variables (void)
 Function that waits for joystick movement, then updates cursor and menu list position.
 
static void display_text (void)
 Function for displaying text of the correct section with correct offset on the display.
 
static void menu_help_testrun_when_idle (void)
 Function for the output menu to the display port. More...
 
static void timer0_init (uint8_t delayms)
 Function for initializing timer0 in 24 bit timer mode and 1 us resolution.
 
static void radio_disable (void)
 Function for disabling the radio.
 
static void radio_sweep_end (void)
 Function for stopping Timer0 and disabling the radio to end radio sweep.
 
static void radio_tx_carrier (uint8_t txpower, uint8_t mode, uint8_t channel)
 Function for turning on TX carrier test mode.
 
static uint32_t rnd8 (void)
 Function for generating an 8 bit random number using the internal random generator.
 
static uint32_t rnd32 (void)
 Function for generating a 32 bit random number using the internal random generator.
 
static void generate_modulated_rf_packet (void)
 Function for configuring the radio to use a random address and a 254 bytes random payload. The S0 and S1 fields are not used.
 
static void radio_modulated_tx_carrier (uint8_t txpower, uint8_t mode, uint8_t channel)
 Function for starting modulated TX carrier. This is done by repeatedly sending a packet with a random address and payload.
 
static void radio_rx_carrier (uint8_t channel)
 Function for turning on the RX carrier.
 
static void radio_tx_sweep_start (uint8_t channel_start, uint8_t delayms)
 Function for turning on a TX carrier sweep. This test uses Timer 0 to restart the TX carrier above at different channels.
 
static void radio_rx_sweep_start (uint8_t channel_start, uint8_t delayms)
 Function for turning on an RX carrier sweep. This test uses Timer 0 to restart the RX carrier above at different channels.
 
void TIMER0_IRQHandler (void)
 Function for handling the Timer 0 interrupt used for TX/RX sweep. The carrier is started with the new channel, and the channel is incremented for next interrupt.
 
int main (void)
 Function for application main entry.
 

Variables

static uint8_t packet [256]
 
static bool sweep = false
 
static uint8_t mode_ = RADIO_MODE_MODE_Nrf_2Mbit
 
static uint8_t data_rate_ = 0
 
static uint8_t txpower_menu_ = RADIO_TXPOWER_TXPOWER_0dBm
 
static uint8_t channel_ = 0
 
static uint8_t channel_start_ = 0
 
static uint8_t channel_end_ = 80
 
static uint8_t delayms_ = 10
 
static uint8_t js_state_last = JS_BUTTON_NONE
 
static uint8_t js_state = JS_BUTTON_NONE
 
static bool sweep_tx_ = false
 
static bool in_menu = true
 
static uint8_t current_menu_pos = 0
 
static uint8_t current_scroll_pos = 0
 
static uint8_t txpower_ = RADIO_TXPOWER_TXPOWER_0dBm
 
static uint32_t * p_variables [MAX_MENU_OPTIONS]
 
static const char * help_menu [MAX_MENU_OPTIONS]
 

Detailed Description

This file contains the source code for a sample application using nRF6350.

Macro Definition Documentation

#define MAX_MENU_OPTIONS   (11UL)

Number of options in the main menu of the test

#define MAX_CHARACTERS_PER_LINE   (16UL)

Maximum characters that are visible in one line on nRF6350 display

#define MAX_CHARECTER_IN_MENU_OPTION   (60UL)

Maximum string length of display options text

#define MAX_CURSOR_POS_IN_STRING
Value:
MAX_CHARACTERS_PER_LINE)

Maximum cursor position(string position that points to first letter in first line of display) on display

#define ERROR_PIN   (8)

Pin that is active high when there is an error in this example

Enumeration Type Documentation

Enumerator
RADIO_TEST_NOP 

No test running

RADIO_TEST_TXCC 

TX constant carrier

RADIO_TEST_TXMC 

TX modulated carrier

RADIO_TEST_TXSWEEP 

TX sweep

RADIO_TEST_RXC 

RX constant carrier

RADIO_TEST_RXSWEEP 

RX sweep

RADIO_TEST_NOP 

No test running.

RADIO_TEST_TXCC 

TX constant carrier.

RADIO_TEST_TXMC 

TX modulated carrier.

RADIO_TEST_TXSWEEP 

TX sweep.

RADIO_TEST_RXC 

RX constant carrier.

RADIO_TEST_RXSWEEP 

RX sweep.

RADIO_TEST_NOP 

No test running

RADIO_TEST_TXCC 

TX constant carrier

RADIO_TEST_TXMC 

TX modulated carrier

RADIO_TEST_TXSWEEP 

TX sweep

RADIO_TEST_RXC 

RX constant carrier

RADIO_TEST_RXSWEEP 

RX sweep

RADIO_TEST_NOP 

No test running.

RADIO_TEST_TXCC 

TX constant carrier.

RADIO_TEST_TXMC 

TX modulated carrier.

RADIO_TEST_TXSWEEP 

TX sweep.

RADIO_TEST_RXC 

RX constant carrier.

RADIO_TEST_RXSWEEP 

RX sweep.

Function Documentation

static void radio_test ( void  )
static

< Continuous radio tests to run.

< Current selection of test.

static void menu_help_testrun_when_idle ( void  )
static

The display can only show one line at a time, scroll right or left to see more text. Also displays value of the variables to be changed in editing mode.

Variable Documentation

uint8_t packet[256]
static

Data packet.

bool sweep = false
static

Sweep enabled.

uint8_t mode_ = RADIO_MODE_MODE_Nrf_2Mbit
static

Transfer mode.

uint8_t data_rate_ = 0
static

Transfer data rate.

uint8_t txpower_menu_ = RADIO_TXPOWER_TXPOWER_0dBm
static

TX power in dBm.

uint8_t channel_ = 0
static

This is used in sweep and varies from channel_start_ to channel_end_.

uint8_t channel_start_ = 0
static

Starting channel number.

uint8_t channel_end_ = 80
static

End channel number.

uint8_t delayms_ = 10
static

Delay in ms (0ms - 99ms).

uint8_t js_state_last = JS_BUTTON_NONE
static

Previous Joystick state.

uint8_t js_state = JS_BUTTON_NONE
static

Current Joystick state.

bool sweep_tx_ = false
static

Boolean for TX Sweep.

bool in_menu = true
static

Browsing menu if true and false while editing some value (defaults to true at power up).

uint8_t current_menu_pos = 0
static

Current menu option selected (defaults to first one in the list).

uint8_t current_scroll_pos = 0
static

Current scroll position in the selection text (defaults to first character).

uint32_t* p_variables[MAX_MENU_OPTIONS]
static
Initial value:
=
{
(uint32_t *)&channel_start_,
(uint32_t *)&channel_end_,
(uint32_t *)0,
(uint32_t *)&delayms_,
(uint32_t *)0,
(uint32_t *)&data_rate_,
(uint32_t *)0,
(uint32_t *)&txpower_menu_,
(uint32_t *)0,
(uint32_t *)0,
(uint32_t *)0,
}
const char* help_menu[MAX_MENU_OPTIONS]
static
Initial value:
=
{
"Enter start channel for Sweep/Channel for constant carrier",
"Enter end channel for Sweep ",
"Start TX carrier ",
"Enter delay on each channel (1ms-99ms) ",
"Cancel Sweep/Carrier ",
"Enter data rate('0'=250 Kb/s, '1'=1 Mb/s and '2'=2 Mb/s) ",
"Start modulated TX carrier ",
"Enter output Power('0'=+4 dBm, '1'=0 dBm,...,'7'=-40 dBm):",
"Start RX sweep ",
"Start TX sweep ",
"Start RX carrier "
}