nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
esb.h File Reference
#include <stdbool.h>
#include <errno.h>
#include <nrf.h>
#include <hal/nrf_radio.h>
#include <zephyr/sys/util.h>
#include <zephyr/types.h>

Go to the source code of this file.

Data Structures

struct  esb_payload
 Enhanced ShockBurst payload. More...
 
struct  esb_evt
 Enhanced ShockBurst event. More...
 
struct  esb_config
 Main configuration structure for the module. More...
 

Macros

#define ESB_DEFAULT_CONFIG
 Default radio parameters.
 
#define ESB_LEGACY_CONFIG
 Default legacy radio parameters.
 
#define ESB_CREATE_PAYLOAD(_pipe, ...)
 Macro to create an initializer for a TX data packet.
 

Typedefs

typedef void(* esb_event_handler) (const struct esb_evt *event)
 Event handler prototype.
 

Enumerations

enum  esb_protocol { ESB_PROTOCOL_ESB , ESB_PROTOCOL_ESB_DPL }
 Enhanced ShockBurst protocols. More...
 
enum  esb_mode { ESB_MODE_PTX , ESB_MODE_PRX }
 Enhanced ShockBurst modes. More...
 
enum  esb_bitrate { ESB_BITRATE_1MBPS = NRF_RADIO_MODE_NRF_1MBIT , ESB_BITRATE_2MBPS = NRF_RADIO_MODE_NRF_2MBIT , ESB_BITRATE_250KBPS = NRF_RADIO_MODE_NRF_250KBIT , ESB_BITRATE_1MBPS_BLE = NRF_RADIO_MODE_BLE_1MBIT }
 Enhanced ShockBurst bitrate modes. More...
 
enum  esb_crc { ESB_CRC_16BIT = RADIO_CRCCNF_LEN_Two , ESB_CRC_8BIT = RADIO_CRCCNF_LEN_One , ESB_CRC_OFF = RADIO_CRCCNF_LEN_Disabled }
 Enhanced ShockBurst CRC modes. More...
 
enum  esb_tx_power
 Enhanced ShockBurst radio transmission power modes. More...
 
enum  esb_tx_mode { ESB_TXMODE_AUTO , ESB_TXMODE_MANUAL , ESB_TXMODE_MANUAL_START }
 Enhanced ShockBurst transmission modes. More...
 
enum  esb_evt_id { ESB_EVENT_TX_SUCCESS , ESB_EVENT_TX_FAILED , ESB_EVENT_RX_RECEIVED }
 Enhanced ShockBurst event IDs. More...
 

Functions

int esb_init (const struct esb_config *config)
 Initialize the Enhanced ShockBurst module.
 
int esb_suspend (void)
 Suspend the Enhanced ShockBurst module.
 
void esb_disable (void)
 Disable the Enhanced ShockBurst module.
 
bool esb_is_idle (void)
 Check if the Enhanced ShockBurst module is idle.
 
int esb_write_payload (const struct esb_payload *payload)
 Write a payload for transmission or acknowledgement.
 
int esb_read_rx_payload (struct esb_payload *payload)
 Read a payload.
 
int esb_start_tx (void)
 Start transmitting data.
 
int esb_start_rx (void)
 Start receiving data.
 
int esb_stop_rx (void)
 Stop data reception.
 
int esb_flush_tx (void)
 Flush the TX buffer.
 
int esb_pop_tx (void)
 Pop the first item from the TX buffer.
 
bool esb_tx_full (void)
 Check if there is some free space left in TX FIFO.
 
int esb_flush_rx (void)
 Flush the RX buffer.
 
int esb_set_address_length (uint8_t length)
 Set the length of the address.
 
int esb_set_base_address_0 (const uint8_t *addr)
 Set the base address for pipe 0.
 
int esb_set_base_address_1 (const uint8_t *addr)
 Set the base address for pipe 1 to pipe 7.
 
int esb_set_prefixes (const uint8_t *prefixes, uint8_t num_pipes)
 Set the number of pipes and the pipe prefix addresses.
 
int esb_enable_pipes (uint8_t enable_mask)
 Enable select pipes.
 
int esb_update_prefix (uint8_t pipe, uint8_t prefix)
 Update pipe prefix.
 
int esb_set_rf_channel (uint32_t channel)
 Set the channel to use for the radio.
 
int esb_get_rf_channel (uint32_t *channel)
 Get the current radio channel.
 
int esb_set_tx_power (int8_t tx_output_power)
 Set the radio output power.
 
int esb_set_retransmit_delay (uint16_t delay)
 Set the packet retransmit delay.
 
int esb_set_retransmit_count (uint16_t count)
 Set the number of retransmission attempts.
 
int esb_set_bitrate (enum esb_bitrate bitrate)
 Set the radio bitrate.
 
int esb_reuse_pid (uint8_t pipe)
 Reuse a packet ID for a specific pipe.