NRF52_esb
Enhanced ShockBurst
Enhanced ShockBurst (ESB) is a basic protocol that supports two-way data packet communication including packet buffering, packet acknowledgment, and automatic retransmission of lost packets. More...
Data Structures | |
struct | nrf_esb_payload_t |
Enhanced ShockBurst payload. More... | |
struct | nrf_esb_evt_t |
Enhanced ShockBurst event. More... | |
struct | nrf_esb_config_t |
Main configuration structure for the module. More... | |
Modules | |
ESB resources | |
Typedefs | |
typedef void(* | nrf_esb_event_handler_t )(nrf_esb_evt_t const *p_event) |
Definition of the event handler for the module. | |
Enumerations | |
enum | nrf_esb_protocol_t { NRF_ESB_PROTOCOL_ESB, NRF_ESB_PROTOCOL_ESB_DPL } |
Enhanced ShockBurst protocols. More... | |
enum | nrf_esb_mode_t { NRF_ESB_MODE_PTX, NRF_ESB_MODE_PRX } |
Enhanced ShockBurst modes. More... | |
enum | nrf_esb_bitrate_t { NRF_ESB_BITRATE_2MBPS = RADIO_MODE_MODE_Nrf_2Mbit, NRF_ESB_BITRATE_1MBPS = RADIO_MODE_MODE_Nrf_1Mbit, NRF_ESB_BITRATE_250KBPS = RADIO_MODE_MODE_Nrf_250Kbit, NRF_ESB_BITRATE_1MBPS_BLE = RADIO_MODE_MODE_Ble_1Mbit, NRF_ESB_BITRATE_2MBPS_BLE } |
Enhanced ShockBurst bitrate modes. More... | |
enum | nrf_esb_crc_t { NRF_ESB_CRC_16BIT = RADIO_CRCCNF_LEN_Two, NRF_ESB_CRC_8BIT = RADIO_CRCCNF_LEN_One, NRF_ESB_CRC_OFF = RADIO_CRCCNF_LEN_Disabled } |
Enhanced ShockBurst CRC modes. More... | |
enum | nrf_esb_tx_power_t { NRF_ESB_TX_POWER_4DBM = RADIO_TXPOWER_TXPOWER_Pos4dBm, NRF_ESB_TX_POWER_3DBM = RADIO_TXPOWER_TXPOWER_Pos3dBm, NRF_ESB_TX_POWER_0DBM = RADIO_TXPOWER_TXPOWER_0dBm, NRF_ESB_TX_POWER_NEG4DBM = RADIO_TXPOWER_TXPOWER_Neg4dBm, NRF_ESB_TX_POWER_NEG8DBM = RADIO_TXPOWER_TXPOWER_Neg8dBm, NRF_ESB_TX_POWER_NEG12DBM = RADIO_TXPOWER_TXPOWER_Neg12dBm, NRF_ESB_TX_POWER_NEG16DBM = RADIO_TXPOWER_TXPOWER_Neg16dBm, NRF_ESB_TX_POWER_NEG20DBM = RADIO_TXPOWER_TXPOWER_Neg20dBm, NRF_ESB_TX_POWER_NEG30DBM = RADIO_TXPOWER_TXPOWER_Neg30dBm } |
Enhanced ShockBurst radio transmission power modes. More... | |
enum | nrf_esb_tx_mode_t { NRF_ESB_TXMODE_AUTO, NRF_ESB_TXMODE_MANUAL, NRF_ESB_TXMODE_MANUAL_START } |
Enhanced ShockBurst transmission modes. More... | |
enum | nrf_esb_evt_id_t { NRF_ESB_EVENT_TX_SUCCESS, NRF_ESB_EVENT_TX_FAILED, NRF_ESB_EVENT_RX_RECEIVED } |
Enhanced ShockBurst event IDs used to indicate the type of the event. More... | |
Functions | |
uint32_t | nrf_esb_init (nrf_esb_config_t const *p_config) |
Function for initializing the Enhanced ShockBurst module. | |
uint32_t | nrf_esb_suspend (void) |
Function for suspending the Enhanced ShockBurst module. | |
uint32_t | nrf_esb_disable (void) |
Function for disabling the Enhanced ShockBurst module. | |
bool | nrf_esb_is_idle (void) |
Function for checking if the Enhanced ShockBurst module is idle. | |
uint32_t | nrf_esb_write_payload (nrf_esb_payload_t const *p_payload) |
Function for writing a payload for transmission or acknowledgement. | |
uint32_t | nrf_esb_read_rx_payload (nrf_esb_payload_t *p_payload) |
Function for reading an RX payload. | |
uint32_t | nrf_esb_start_tx (void) |
Function for starting transmission. | |
uint32_t | nrf_esb_start_rx (void) |
Function for starting to transmit data from the FIFO buffer. | |
uint32_t | nrf_esb_stop_rx (void) |
Function for stopping data reception. | |
uint32_t | nrf_esb_flush_tx (void) |
Function for removing remaining items from the TX buffer. | |
uint32_t | nrf_esb_pop_tx (void) |
Function for removing the first item from the TX buffer. | |
uint32_t | nrf_esb_flush_rx (void) |
Function for removing remaining items from the RX buffer. | |
uint32_t | nrf_esb_set_address_length (uint8_t length) |
Function for setting the length of the address. | |
uint32_t | nrf_esb_set_base_address_0 (uint8_t const *p_addr) |
Function for setting the base address for pipe 0. | |
uint32_t | nrf_esb_set_base_address_1 (uint8_t const *p_addr) |
Function for setting the base address for pipe 1 to pipe 7. | |
uint32_t | nrf_esb_set_prefixes (uint8_t const *p_prefixes, uint8_t num_pipes) |
Function for setting the number of pipes and the pipe prefix addresses. | |
uint32_t | nrf_esb_enable_pipes (uint8_t enable_mask) |
Function for enabling pipes. | |
uint32_t | nrf_esb_update_prefix (uint8_t pipe, uint8_t prefix) |
Function for updating the prefix for a pipe. | |
uint32_t | nrf_esb_set_rf_channel (uint32_t channel) |
Function for setting the channel to use for the radio. | |
uint32_t | nrf_esb_get_rf_channel (uint32_t *p_channel) |
Function for getting the current radio channel. | |
uint32_t | nrf_esb_set_tx_power (nrf_esb_tx_power_t tx_output_power) |
Function for setting the radio output power. | |
uint32_t | nrf_esb_set_retransmit_delay (uint16_t delay) |
Function for setting the packet retransmit delay. | |
uint32_t | nrf_esb_set_retransmit_count (uint16_t count) |
Function for setting the number of retransmission attempts. | |
uint32_t | nrf_esb_set_bitrate (nrf_esb_bitrate_t bitrate) |
Function for setting the radio bitrate. | |
uint32_t | nrf_esb_reuse_pid (uint8_t pipe) |
Function for reusing a packet ID for a specific pipe. |
Detailed Description
Enhanced ShockBurst (ESB) is a basic protocol that supports two-way data packet communication including packet buffering, packet acknowledgment, and automatic retransmission of lost packets.
Typedef Documentation
typedef void(* nrf_esb_event_handler_t)(nrf_esb_evt_t const *p_event) |
Enumeration Type Documentation
enum nrf_esb_bitrate_t |
Enhanced ShockBurst bitrate modes.
- Enumerator:
enum nrf_esb_crc_t |
enum nrf_esb_evt_id_t |
enum nrf_esb_mode_t |
enum nrf_esb_protocol_t |
enum nrf_esb_tx_mode_t |
Enhanced ShockBurst transmission modes.
- Enumerator:
NRF_ESB_TXMODE_AUTO Automatic TX mode: When the TX FIFO contains packets and the radio is idle, packets are sent automatically.
NRF_ESB_TXMODE_MANUAL Manual TX mode: Packets are not sent until nrf_esb_start_tx is called.
This mode can be used to ensure consistent packet timing.
NRF_ESB_TXMODE_MANUAL_START Manual start TX mode: Packets are not sent until nrf_esb_start_tx is called.
Then, transmission continues automatically until the TX FIFO is empty.
enum nrf_esb_tx_power_t |
Enhanced ShockBurst radio transmission power modes.
- Enumerator:
Function Documentation
uint32_t nrf_esb_disable | ( | void | ) |
Function for disabling the Enhanced ShockBurst module.
Calling this function disables the Enhanced ShockBurst module immediately. Doing so might stop ongoing communications.
- Note:
- All queues are flushed by this function.
- Return values:
-
NRF_SUCCESS If Enhanced ShockBurst was disabled.
uint32_t nrf_esb_enable_pipes | ( | uint8_t | enable_mask ) |
Function for enabling pipes.
The enable_mask
parameter must contain the same number of pipes as has been configured with nrf_esb_set_prefixes.
- Parameters:
-
enable_mask Bitfield mask to enable or disable pipes. Setting a bit to 0 disables the pipe. Setting a bit to 1 enables the pipe.
- Return values:
-
NRF_SUCCESS If the pipes were enabled and disabled successfully. NRF_ERROR_BUSY If the function failed because the radio is busy. NRF_ERROR_INVALID_PARAM If the function failed because the address given was too close to a zero address.
uint32_t nrf_esb_flush_rx | ( | void | ) |
uint32_t nrf_esb_flush_tx | ( | void | ) |
uint32_t nrf_esb_get_rf_channel | ( | uint32_t * | p_channel ) |
uint32_t nrf_esb_init | ( | nrf_esb_config_t const * | p_config ) |
Function for initializing the Enhanced ShockBurst module.
- Parameters:
-
p_config Parameters for initializing the module.
- Return values:
-
NRF_SUCCESS If initialization was successful. NRF_ERROR_NULL If the p_config
argument was NULL.NRF_ERROR_BUSY If the function failed because the radio is busy.
bool nrf_esb_is_idle | ( | void | ) |
uint32_t nrf_esb_pop_tx | ( | void | ) |
uint32_t nrf_esb_read_rx_payload | ( | nrf_esb_payload_t * | p_payload ) |
Function for reading an RX payload.
- Parameters:
-
[in,out] p_payload Pointer to the structure that contains information and state of the payload.
- Return values:
-
NRF_SUCCESS If the data was read successfully. NRF_ERROR_NULL If the required parameter was NULL. NRF_INVALID_STATE If the module is not initialized.
uint32_t nrf_esb_reuse_pid | ( | uint8_t | pipe ) |
Function for reusing a packet ID for a specific pipe.
The ESB protocol uses a 2-bit sequence number (packet ID) to identify retransmitted packets. By default, the packet ID is incremented for every uploaded packet. Use this function to prevent this and send two different packets with the same packet ID.
- Parameters:
-
[in] pipe Pipe.
- Return values:
-
NRF_SUCCESS If the operation completed successfully. NRF_ERROR_BUSY If the function failed because the radio is busy.
uint32_t nrf_esb_set_address_length | ( | uint8_t | length ) |
Function for setting the length of the address.
- Parameters:
-
[in] length Length of the ESB address (in bytes).
- Return values:
-
NRF_SUCCESS If the address length was set successfully. NRF_ERROR_INVALID_PARAM If the address length was invalid. NRF_ERROR_BUSY If the function failed because the radio is busy.
uint32_t nrf_esb_set_base_address_0 | ( | uint8_t const * | p_addr ) |
Function for setting the base address for pipe 0.
- Parameters:
-
[in] p_addr Pointer to the address data.
- Return values:
-
NRF_SUCCESS If the base address was set successfully. NRF_ERROR_BUSY If the function failed because the radio is busy. NRF_ERROR_INVALID_PARAM If the function failed because the address given was too close to a zero address. NRF_ERROR_NULL If the required parameter was NULL.
uint32_t nrf_esb_set_base_address_1 | ( | uint8_t const * | p_addr ) |
Function for setting the base address for pipe 1 to pipe 7.
- Parameters:
-
[in] p_addr Pointer to the address data.
- Return values:
-
NRF_SUCCESS If the base address was set successfully. NRF_ERROR_BUSY If the function failed because the radio is busy. NRF_ERROR_INVALID_PARAM If the function failed because the address given was too close to a zero address. NRF_ERROR_NULL If the required parameter was NULL.
uint32_t nrf_esb_set_bitrate | ( | nrf_esb_bitrate_t | bitrate ) |
uint32_t nrf_esb_set_prefixes | ( | uint8_t const * | p_prefixes, |
uint8_t | num_pipes | ||
) |
Function for setting the number of pipes and the pipe prefix addresses.
This function configures the number of available pipes, enables the pipes, and sets their prefix addresses.
- Parameters:
-
[in] p_prefixes Pointer to a char array that contains the prefix for each pipe. [in] num_pipes Number of pipes.
- Return values:
-
NRF_SUCCESS If the prefix addresses were set successfully. NRF_ERROR_BUSY If the function failed because the radio is busy. NRF_ERROR_NULL If a required parameter was NULL. NRF_ERROR_INVALID_PARAM If an invalid number of pipes was given or if the address given was too close to a zero address.
uint32_t nrf_esb_set_retransmit_count | ( | uint16_t | count ) |
uint32_t nrf_esb_set_retransmit_delay | ( | uint16_t | delay ) |
uint32_t nrf_esb_set_rf_channel | ( | uint32_t | channel ) |
Function for setting the channel to use for the radio.
The module must be in an idle state to call this function. As a PTX, the application must wait for an idle state and as a PRX, the application must stop RX before changing the channel. After changing the channel, operation can be resumed.
- Parameters:
-
[in] channel Channel to use for radio.
- Return values:
-
NRF_SUCCESS If the operation completed successfully. NRF_INVALID_STATE If the module is not initialized. NRF_ERROR_BUSY If the module was not in idle state. NRF_ERROR_INVALID_PARAM If the channel is invalid (larger than 100).
uint32_t nrf_esb_set_tx_power | ( | nrf_esb_tx_power_t | tx_output_power ) |
uint32_t nrf_esb_start_rx | ( | void | ) |
uint32_t nrf_esb_start_tx | ( | void | ) |
uint32_t nrf_esb_stop_rx | ( | void | ) |
uint32_t nrf_esb_suspend | ( | void | ) |
Function for suspending the Enhanced ShockBurst module.
Calling this function stops ongoing communications without changing the queues.
- Return values:
-
NRF_SUCCESS If Enhanced ShockBurst was suspended. NRF_ERROR_BUSY If the function failed because the radio is busy.
uint32_t nrf_esb_update_prefix | ( | uint8_t | pipe, |
uint8_t | prefix | ||
) |
Function for updating the prefix for a pipe.
- Parameters:
-
pipe Pipe for which to set the prefix. prefix Prefix to set for the pipe.
- Return values:
-
NRF_SUCCESS If the operation completed successfully. NRF_ERROR_BUSY If the function failed because the radio is busy. NRF_ERROR_INVALID_PARAM If the given pipe number was invalid or if the address given was too close to a zero address.
uint32_t nrf_esb_write_payload | ( | nrf_esb_payload_t const * | p_payload ) |
Function for writing a payload for transmission or acknowledgement.
This function writes a payload that is added to the queue. When the module is in PTX mode, the payload is queued for a regular transmission. When the module is in PRX mode, the payload is queued for when a packet is received that requires an acknowledgement with payload.
- Parameters:
-
[in] p_payload Pointer to the structure that contains information and state of the payload.
- Return values:
-
NRF_SUCCESS If the payload was successfully queued for writing. NRF_ERROR_NULL If the required parameter was NULL. NRF_INVALID_STATE If the module is not initialized. NRF_ERROR_NOT_SUPPORTED If p_payload->noack
was false, but selective acknowledgement is not enabled.NRF_ERROR_NO_MEM If the TX FIFO is full. NRF_ERROR_INVALID_LENGTH If the payload length was invalid (zero or larger than the allowed maximum).
Generated on Sun Jul 17 2022 00:47:52 by 1.7.2