libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Access functions for the 2.4 GHz Radio More...
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... | |
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
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.
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.
void radio_disable | ( | void | ) |
Disable the peripheral.
Definition at line 99 of file radio_common.c.
References RADIO_POWER, and RADIO_POWER_DISABLED.
void radio_disable_crc | ( | void | ) |
void radio_disable_whitening | ( | void | ) |
Disable on the air data whitening.
Definition at line 70 of file radio_common.c.
References RADIO_PCNF1.
void radio_enable | ( | void | ) |
Enable the peripheral.
Definition at line 93 of file radio_common.c.
References RADIO_POWER, and RADIO_POWER_ENABLED.
void radio_enable_rx | ( | void | ) |
Definition at line 243 of file radio_common.c.
References PERIPH_TRIGGER_TASK, and RADIO_TASK_RXEN.
void radio_enable_tx | ( | void | ) |
Definition at line 237 of file radio_common.c.
References PERIPH_TRIGGER_TASK, and RADIO_TASK_TXEN.
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().
void radio_set_addr | ( | uint8_t | addr_index, |
uint32_t | base, | ||
uint8_t | prefix | ||
) |
Definition at line 203 of file radio_common.c.
References RADIO_BASE0, RADIO_BASE1, RADIO_PREFIX_AP, RADIO_PREFIX_AP_MASKED, and RADIO_PREFIX_AP_SET.
void radio_set_balen | ( | uint8_t | ba_len | ) |
Set Base Address length.
[in] | ba_len | uint8_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().
void radio_set_crc_skipaddr | ( | bool | is_skip_addr | ) |
Exclude access address from CRC calculation.
[in] | is_skip_addr | bool 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().
void radio_set_crclen | ( | uint8_t | crc_len | ) |
Set CRC length in number of bytes.
[in] | crc_len | uint8_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().
void radio_set_datawhiteiv | ( | uint8_t | iv | ) |
Set Data Whitening Initialization Vector.
[in] | iv | uint8_t Initialization Vector. For BLE, this is channel index. |
Definition at line 188 of file radio_common.c.
References RADIO_DATAWHITEIV.
void radio_set_frequency | ( | uint8_t | freq | ) |
Set radio frequency.
[in] | freq | uint8_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.
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().
void radio_set_maxlen | ( | uint8_t | maxlen | ) |
Set maximum transmission length in number of bytes.
[in] | maxlen | uint8_t maximum transmission length. |
Definition at line 120 of file radio_common.c.
References RADIO_PCNF1, and RADIO_PCNF1_MAXLEN_MASKED.
void radio_set_mode | ( | enum radio_mode | mode | ) |
Set radio mode.
The function also performs all required overrides for BLE and NRF mode.
[in] | mode | the 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().
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.
void radio_set_packet_ptr | ( | uint8_t * | packet_ptr | ) |
Definition at line 231 of file radio_common.c.
References RADIO_PACKETPTR.
void radio_set_tx_address | ( | uint8_t | addr_index | ) |
Definition at line 222 of file radio_common.c.
References RADIO_TXADDRESS.
void radio_set_txpower | ( | enum radio_txpower | txpower | ) |
Set radio transmission power.
Note, not all supported power levels are BLE compliant.
[in] | txpower | enum radio_txpower |
Definition at line 43 of file radio_common.c.
References RADIO_TXPOWER.