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

Radio Receiver Example Application main file. More...

Macros

#define PACKET_S1_FIELD_SIZE   (0UL)
 
#define PACKET_S0_FIELD_SIZE   (0UL)
 
#define PACKET_LENGTH_FIELD_SIZE   (0UL)
 

Functions

int main (void)
 Function for application main entry.
 
static uint32_t swap_bits (uint32_t inp)
 Function for swapping/mirroring bits in a byte. More...
 
static uint32_t bytewise_bitswap (uint32_t inp)
 Function for swapping bits in a 32 bit word for each byte individually. More...
 
void radio_configure ()
 Function for configuring the radio to operate in Shockburst compatible mode. More...
 

Variables

static uint8_t volatile packet [PACKET_PAYLOAD_MAXSIZE]
 

Detailed Description

This file contains the source code for a sample application using the NRF_RADIO to receive.

example_board_setup_a.jpg
Use board setup A for this example.

Macro Definition Documentation

#define PACKET_S1_FIELD_SIZE   (0UL)

Packet S1 field size in bits.

#define PACKET_S0_FIELD_SIZE   (0UL)

Packet S0 field size in bits.

#define PACKET_LENGTH_FIELD_SIZE   (0UL)

Packet length field size in bits.

Function Documentation

static uint32_t swap_bits ( uint32_t  inp)
static
* output_bit_7 = input_bit_0
* output_bit_6 = input_bit_1
*           :
* output_bit_0 = input_bit_7
*
Parameters
[in]inpis the input byte to be swapped.
Returns
Returns the swapped/mirrored input byte.
static uint32_t bytewise_bitswap ( uint32_t  inp)
static

The bits are swapped as follows:

* output[31:24] = input[24:31] 
* output[23:16] = input[16:23]
* output[15:8]  = input[8:15]
* output[7:0]   = input[0:7]
* 
Parameters
[in]inputis the input word to be swapped.
Returns
Returns the swapped input byte.
void radio_configure ( void  )

To configure the application running on nRF24L series devices:

* uint8_t tx_address[5] = { 0xC0, 0x01, 0x23, 0x45, 0x67 };
* hal_nrf_set_rf_channel(7);
* hal_nrf_set_address_width(HAL_NRF_AW_5BYTES); 
* hal_nrf_set_address(HAL_NRF_TX, tx_address);
* hal_nrf_set_address(HAL_NRF_PIPE0, tx_address); 
* hal_nrf_open_pipe(0, false);
* hal_nrf_set_datarate(HAL_NRF_1MBPS);
* hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT);
* hal_nrf_setup_dynamic_payload(0xFF);
* hal_nrf_enable_dynamic_payload(false);
* 

When transmitting packets with hal_nrf_write_tx_payload(const uint8_t *tx_pload, uint8_t length), match the length with PACKET_STATIC_LENGTH. hal_nrf_write_tx_payload(payload, PACKET_STATIC_LENGTH);

Variable Documentation

uint8_t volatile packet[PACKET_PAYLOAD_MAXSIZE]
static

Received packet buffer.