libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
RADIO peripheral API

Access functions for the 2.4 GHz Radio More...

Collaboration diagram for RADIO peripheral API:

Functions

void radio_set_txpower (enum radio_txpower txpower)
 Set radio transmission power. More...
 
void radio_set_lsbfirst (void)
 Set bit transmission order to LSB first. More...
 
void radio_set_msbfirst (void)
 Set bit transmission order to MSB first. More...
 
void radio_enable_whitening (void)
 Enable on the air data whitening. More...
 
void radio_disable_whitening (void)
 Disable on the air data whitening. More...
 
void radio_set_crclen (uint8_t crc_len)
 Set CRC length in number of bytes. More...
 
void radio_disable_crc (void)
 Disable CRC calculation. More...
 
void radio_enable (void)
 Enable the peripheral. More...
 
void radio_disable (void)
 Disable the peripheral. More...
 
void radio_set_balen (uint8_t ba_len)
 Set Base Address length. More...
 
void radio_set_maxlen (uint8_t maxlen)
 Set maximum transmission length in number of bytes. More...
 
void radio_set_crc_skipaddr (bool is_skip_addr)
 Exclude access address from CRC calculation. More...
 
void radio_configure_ble (void)
 Configure the radio to be used in BLE mode. More...
 
void radio_configure_packet (uint8_t lf_len_bits, uint8_t s0_len_bytes, uint8_t s1_len_bits)
 Configure the packet. More...
 
void radio_set_frequency (uint8_t freq)
 Set radio frequency. More...
 
void radio_set_datawhiteiv (uint8_t iv)
 Set Data Whitening Initialization Vector. More...
 
void radio_set_addr (uint8_t addr_index, uint32_t base, uint8_t prefix)
 
void radio_set_tx_address (uint8_t addr_index)
 
void radio_set_packet_ptr (uint8_t *packet_ptr)
 
void radio_enable_tx (void)
 
void radio_enable_rx (void)
 
void radio_set_mode (enum radio_mode mode)
 Set radio mode. More...
 

Detailed Description

Access functions for the 2.4 GHz Radio

Access functions for the NRF51 2.4 GHz Radio

LGPL License Terms libopencm3 License

LGPL License Terms libopencm3 License

Author
© 2016 Maxim Sloyko maxim.nosp@m.s@go.nosp@m.ogle..nosp@m.com
© 2016 Maxim Sloyko maxim.nosp@m.s@go.nosp@m.ogle..nosp@m.com

Function Documentation

◆ radio_configure_ble()

void radio_configure_ble ( void  )

Configure the radio to be used in BLE mode.

This needs to be called before the radio can be used in BLE mode. It will set som BLE standard parameters, like Inter-Frame Spacing time, LSB first, enable whitening, properly configure CRC (for advertising) and address length.

Definition at line 147 of file radio_common.c.

References RADIO_BLE_CRCINIT, RADIO_BLE_CRCLEN, RADIO_BLE_CRCPOLY, RADIO_BLE_TIFS, RADIO_CRCINIT, RADIO_CRCPOLY, radio_enable_whitening(), RADIO_MODE_BLE_1MBIT, radio_set_balen(), radio_set_crc_skipaddr(), radio_set_crclen(), radio_set_lsbfirst(), radio_set_mode(), and RADIO_TIFS.

Here is the call graph for this function:

◆ radio_configure_packet()

void radio_configure_packet ( uint8_t  lf_len_bits,
uint8_t  s0_len_bytes,
uint8_t  s1_len_bits 
)

Configure the packet.

See the data sheet for details.

Definition at line 167 of file radio_common.c.

References RADIO_PCNF0, RADIO_PCNF0_LFLEN_MASKED, RADIO_PCNF0_S0LEN_MASKED, and RADIO_PCNF0_S1LEN_MASKED.

◆ radio_disable()

void radio_disable ( void  )

Disable the peripheral.

Definition at line 99 of file radio_common.c.

References RADIO_POWER, and RADIO_POWER_DISABLED.

◆ radio_disable_crc()

void radio_disable_crc ( void  )

Disable CRC calculation.

Definition at line 87 of file radio_common.c.

References RADIO_CRCCNF.

◆ radio_disable_whitening()

void radio_disable_whitening ( void  )

Disable on the air data whitening.

Definition at line 70 of file radio_common.c.

References RADIO_PCNF1.

◆ radio_enable()

void radio_enable ( void  )

Enable the peripheral.

Definition at line 93 of file radio_common.c.

References RADIO_POWER, and RADIO_POWER_ENABLED.

◆ radio_enable_rx()

void radio_enable_rx ( void  )

Definition at line 243 of file radio_common.c.

References PERIPH_TRIGGER_TASK, and RADIO_TASK_RXEN.

◆ radio_enable_tx()

void radio_enable_tx ( void  )

Definition at line 237 of file radio_common.c.

References PERIPH_TRIGGER_TASK, and RADIO_TASK_TXEN.

◆ radio_enable_whitening()

void radio_enable_whitening ( void  )

Enable on the air data whitening.

the in-memory data will remain unwhitened.

Definition at line 64 of file radio_common.c.

References RADIO_PCNF1, and RADIO_PCNF1_WHITEEN.

Referenced by radio_configure_ble().

Here is the caller graph for this function:

◆ radio_set_addr()

void radio_set_addr ( uint8_t  addr_index,
uint32_t  base,
uint8_t  prefix 
)

◆ radio_set_balen()

void radio_set_balen ( uint8_t  ba_len)

Set Base Address length.

Parameters
[in]ba_lenuint8_t Base Address length in number of bytes (2-4).

Definition at line 109 of file radio_common.c.

References RADIO_PCNF1, and RADIO_PCNF1_BALEN_MASKED.

Referenced by radio_configure_ble().

Here is the caller graph for this function:

◆ radio_set_crc_skipaddr()

void radio_set_crc_skipaddr ( bool  is_skip_addr)

Exclude access address from CRC calculation.

Parameters
[in]is_skip_addrbool If true, CRC will be calculated over PDU only, if false, it will also include the Access Address.

Definition at line 132 of file radio_common.c.

References RADIO_CRCCNF, and RADIO_CRCCNF_SKIPADDR.

Referenced by radio_configure_ble().

Here is the caller graph for this function:

◆ radio_set_crclen()

void radio_set_crclen ( uint8_t  crc_len)

Set CRC length in number of bytes.

Parameters
[in]crc_lenuint8_t CRC length in number of bytes (1-3), 0 = CRC disabled.

Definition at line 79 of file radio_common.c.

References RADIO_CRCCNF, and RADIO_CRCCNF_LEN_MASKED.

Referenced by radio_configure_ble().

Here is the caller graph for this function:

◆ radio_set_datawhiteiv()

void radio_set_datawhiteiv ( uint8_t  iv)

Set Data Whitening Initialization Vector.

Parameters
[in]ivuint8_t Initialization Vector. For BLE, this is channel index.

Definition at line 188 of file radio_common.c.

References RADIO_DATAWHITEIV.

◆ radio_set_frequency()

void radio_set_frequency ( uint8_t  freq)

Set radio frequency.

Parameters
[in]frequint8_t Frequency offset from 2.4GHz in MHz, for example "29" will tune the radio to 2429MHz

Definition at line 179 of file radio_common.c.

References RADIO_FREQUENCY.

◆ radio_set_lsbfirst()

void radio_set_lsbfirst ( void  )

Set bit transmission order to LSB first.

Definition at line 49 of file radio_common.c.

References RADIO_PCNF1.

Referenced by radio_configure_ble().

Here is the caller graph for this function:

◆ radio_set_maxlen()

void radio_set_maxlen ( uint8_t  maxlen)

Set maximum transmission length in number of bytes.

Parameters
[in]maxlenuint8_t maximum transmission length.

Definition at line 120 of file radio_common.c.

References RADIO_PCNF1, and RADIO_PCNF1_MAXLEN_MASKED.

◆ radio_set_mode()

void radio_set_mode ( enum radio_mode  mode)

Set radio mode.

The function also performs all required overrides for BLE and NRF mode.

Parameters
[in]modethe new mode.

Definition at line 39 of file radio.c.

References FICR_BLE_1MBIT0, FICR_NRF_1MBIT0, FICR_OVERRIDEEN, FICR_OVERRIDEEN_BLE_1MBIT, FICR_OVERRIDEEN_NRF_1MBIT, RADIO_MODE, RADIO_MODE_BLE_1MBIT, RADIO_MODE_NRF_1MBIT, RADIO_OVERRIDE, and RADIO_OVERRIDE4_ENABLE.

Referenced by radio_configure_ble().

Here is the caller graph for this function:

◆ radio_set_msbfirst()

void radio_set_msbfirst ( void  )

Set bit transmission order to MSB first.

Definition at line 55 of file radio_common.c.

References RADIO_PCNF1, and RADIO_PCNF1_ENDIAN_BIG.

◆ radio_set_packet_ptr()

void radio_set_packet_ptr ( uint8_t *  packet_ptr)

Definition at line 231 of file radio_common.c.

References RADIO_PACKETPTR.

◆ radio_set_tx_address()

void radio_set_tx_address ( uint8_t  addr_index)

Definition at line 222 of file radio_common.c.

References RADIO_TXADDRESS.

◆ radio_set_txpower()

void radio_set_txpower ( enum radio_txpower  txpower)

Set radio transmission power.

Note, not all supported power levels are BLE compliant.

Parameters
[in]txpowerenum radio_txpower

Definition at line 43 of file radio_common.c.

References RADIO_TXPOWER.