nRF51 SDK
|
Functions | |
int | main () |
Main function. More... | |
Configuration | |
static uint8_t | my_tx_payload [TX_PAYLOAD_LENGTH] |
Payload to send to PRX. | |
static uint8_t | my_rx_payload [NRF_ESB_CONST_MAX_PAYLOAD_LENGTH] |
Placeholder for received ACK payloads from PRX. | |
#define | PIPE_NUMBER 0 |
We use pipe 0 in this example. | |
#define | BUTTONS NRF_GPIO_PORT_SELECT_PORT0 |
GPIO port for reading from buttons. | |
#define | LEDS NRF_GPIO_PORT_SELECT_PORT1 |
GPIO port for writing to LEDs. | |
#define | TX_PAYLOAD_LENGTH 1 |
We use 1 byte payload length when transmitting. | |
ESB callback function definitions | |
void | nrf_esb_tx_success (uint32_t tx_pipe, int32_t rssi) |
TX success callback. More... | |
void | nrf_esb_tx_failed (uint32_t tx_pipe) |
TX failed callback (PTX mode only). More... | |
void | nrf_esb_rx_data_ready (uint32_t rx_pipe, int32_t rssi) |
RX data ready callback. More... | |
void | nrf_esb_disabled (void) |
Disabled callback. More... | |
This project requires that a device running the Enhanced Shockburst Transmitter (PTX) example be used as a counterpart for receiving the data. This can be on either nRF51 device or a nRF24Lxx device running the esb_ptx_example in the nRFgo SDK.
This example sends a packet and adds a new packet to the TX queue every time it receives an ACK. The contents of GPIO Port BUTTONS are sent in the first payload byte (byte 0). The host sends an acknowledgement that is received by the device. The contents of the first payload byte of the acknowledgement is output on GPIO Port LEDS.
int main | ( | void | ) |
void nrf_esb_tx_success | ( | uint32_t | tx_pipe, |
int32_t | rssi | ||
) |
In PTX mode this function is called after the PTX has sent a packet and received the corresponding ACK packet from a PRX.
In PRX mode this function is called after a payload in ACK is assumed successfully transmitted, that is when the PRX received a new packet (new PID or CRC) and the previous ACK sent to a PTX contained a payload.
tx_pipe | The pipe on which the ACK packet was received. |
rssi | Received signal strength indicator in dBm of measured ACK. |
As the RSSI measurement requires a minimum on-air duration of the received packet, the measured RSSI value will not be reliable when ALL of the following criteria are met:
void nrf_esb_tx_failed | ( | uint32_t | tx_pipe | ) |
This is called after the maximum number of TX attempts were reached for a packet. The packet is deleted from the TX FIFO.
Note that when NRF_ESB_PACKET_NO_ACK is used this callback is always made after sending a packet.
tx_pipe | The pipe that failed to send a packet. |
void nrf_esb_rx_data_ready | ( | uint32_t | rx_pipe, |
int32_t | rssi | ||
) |
PTX mode: This is called after an ACK is received from a PRX containing a payload.
PRX mode: This is called after a packet is received from a PTX ACK is received from a PRX containing a payload.
rx_pipe | is the pipe on which a packet was received. This value must be < NRF_ESB_CONST_PIPE_COUNT. |
rssi | Received signal strength indicator in dBm of packet. |
As the RSSI measurement requires a minimum on-air duration of the received packet, the measured RSSI value will not be reliable when ALL of the following criteria are met:
void nrf_esb_disabled | ( | void | ) |
This is called after ESB enters the disabled state. There is no further CPU use by ESB, the radio is disabled and the timer is powered down.