NRF24L01+ driver interface

Low-level driver for nrf24l01+ transceiver. More...

Detailed Description

Low-level driver for nrf24l01+ transceiver.

Files

file  nrf24l01p.h
 
file  nrf24l01p_settings.h
 Low-level driver for nrf24l01+ transceiver.
 

Data Structures

struct  nrf24l01p_t
 Structure that represents the hardware setup of the nrf24l01+ transceiver. More...
 

Enumerations

enum  nrf24l01p_aw_t { NRF24L01P_AW_3BYTE, NRF24L01P_AW_4BYTE, NRF24L01P_AW_5BYTE }
 Defines the address width of the nrf24l01+ transceiver. More...
 
enum  nrf24l01p_dr_t { NRF24L01P_DR_250KBS, NRF24L01P_DR_1MBS, NRF24L01P_DR_2MBS }
 Defines the RF datarate. More...
 
enum  nrf24l01p_pwr_t { NRF24L01P_PWR_N18DBM = 0, NRF24L01P_PWR_N12DBM, NRF24L01P_PWR_N6DBM, NRF24L01P_PWR_0DBM }
 Defines the RF power level. More...
 
enum  nrf24l01p_rx_pipe_t {
  NRF24L01P_PIPE0 = 0, NRF24L01P_PIPE1, NRF24L01P_PIPE2, NRF24L01P_PIPE3,
  NRF24L01P_PIPE4, NRF24L01P_PIPE5
}
 Defines the datapipe on which the receiver searches for packets. More...
 
enum  nrf24l01p_crc_t { NRF24L01P_CRC_1BYTE = 0, NRF24L01P_CRC_2BYTE }
 Defines the error detection encoding scheme for the nrf24l01p transceiver. More...
 
enum  nrf24l01p_retransmit_delay_t {
  NRF24L01P_RETR_250US = 0, NRF24L01P_RETR_500US, NRF24L01P_RETR_750US, NRF24L01P_RETR_1000US,
  NRF24L01P_RETR_1250US, NRF24L01P_RETR_1500US, NRF24L01P_RETR_1750US, NRF24L01P_RETR_2000US,
  NRF24L01P_RETR_2250US, NRF24L01P_RETR_2500US, NRF24L01P_RETR_2750US, NRF24L01P_RETR_3000US,
  NRF24L01P_RETR_3250US, NRF24L01P_RETR_3500US, NRF24L01P_RETR_3750US, NRF24L01P_RETR_4000US
}
 Defines the automatic retransmission delay defined from end of transmission to start of next treansmission. More...
 
enum  nrf24l01p_rx_event_t { RCV_PKT_NRF24L01P = 0 }
 Defines states for the nrf24l01+ transceiver. More...
 

Functions

int nrf24l01p_read_reg (const nrf24l01p_t *dev, char reg, char *answer)
 Read one register of the nrf24l01+ transceiver. More...
 
int nrf24l01p_write_reg (const nrf24l01p_t *dev, char reg, char write)
 Write one register to the nrf24l01+ transceiver. More...
 
int nrf24l01p_init (nrf24l01p_t *dev, spi_t spi, gpio_t ce, gpio_t csn, gpio_t irq)
 Initialize the nrf24l01+ transceiver. More...
 
int nrf24l01p_on (const nrf24l01p_t *dev)
 Power on the nrf24l01+ transceiver. More...
 
int nrf24l01p_off (const nrf24l01p_t *dev)
 Power off the nrf24l01+ transceiver. More...
 
void nrf24l01p_transmit (const nrf24l01p_t *dev)
 Transmit payload laying in TX FIFO of the nrf24l01+ transceiver. More...
 
int nrf24l01p_read_payload (const nrf24l01p_t *dev, char *answer, unsigned int size)
 Read payload from RX FIFO of the nrf24l01+ transceiver. More...
 
void nrf24l01p_register (nrf24l01p_t *dev, unsigned int *pid)
 Register a given ID to the nrf24l01+ transceiver. More...
 
int nrf24l01p_enable_dynamic_payload (const nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pipe)
 Enable dynamic payload for the pipe on give nrf24l01+ transceiver. More...
 
int nrf24l01p_enable_dynamic_ack (const nrf24l01p_t *dev)
 Enable dynamic ack for the nrf24l01+ transceiver. More...
 
int nrf24l01p_unregister (nrf24l01p_t *dev, unsigned int pid)
 Unregister the nrf24l01+ transceiver from his ID. More...
 
void nrf24l01p_get_id (const nrf24l01p_t *dev, unsigned int *pid)
 Get ID from the nrf24l01p transceiver. More...
 
void nrf24l01p_start (const nrf24l01p_t *dev)
 Start searching packets while in RX mode. More...
 
void nrf24l01p_stop (const nrf24l01p_t *dev)
 Stop searching packets while in RX mode. More...
 
int nrf24l01p_preload (const nrf24l01p_t *dev, char *data, unsigned int size)
 Preload TX FIFO with payload to transmit. More...
 
int nrf24l01p_set_channel (const nrf24l01p_t *dev, uint8_t chan)
 Set the RF channel for the nrf24l01+ transceiver. More...
 
int nrf24l01p_set_address_width (const nrf24l01p_t *dev, nrf24l01p_aw_t aw)
 Set the address width for the nrf24l01+ transceiver. More...
 
int nrf24l01p_set_payload_width (const nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pipe, uint8_t width)
 Set the RX payload width for the nrf24l01+ transceiver. More...
 
int nrf24l01p_set_tx_address (const nrf24l01p_t *dev, const uint8_t *saddr, unsigned int length)
 Set the TX address for the nrf24l01+ transceiver (byte array). More...
 
int nrf24l01p_set_tx_address_long (const nrf24l01p_t *dev, uint64_t saddr, unsigned int length)
 Set the TX address for the nrf24l01+ transceiver (long int). More...
 
int nrf24l01p_set_rx_address (const nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pipe, const uint8_t *saddr, unsigned int length)
 Set the RX address for the nrf24l01+ transceiver (byte array). More...
 
int nrf24l01p_set_rx_address_long (const nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pipe, uint64_t saddr, unsigned int length)
 Set the RX address for the nrf24l01+ transceiver (long int). More...
 
uint64_t nrf24l01p_get_tx_address_long (const nrf24l01p_t *dev)
 Get the TX address for the nrf24l01+ transceiver (long int). More...
 
uint64_t nrf24l01p_get_rx_address_long (const nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pipe)
 Get the RX address for the nrf24l01+ transceiver (long int). More...
 
int nrf24l01p_set_datarate (const nrf24l01p_t *dev, nrf24l01p_dr_t dr)
 Get the TX address for the nrf24l01+ transceiver (long int). More...
 
int nrf24l01p_get_status (const nrf24l01p_t *dev)
 Get the status (register) of the nrf24l01+ transceiver device. More...
 
int nrf24l01p_set_power (const nrf24l01p_t *dev, int pwr)
 Set the transmit power for the nrf24l01+ transceiver device. More...
 
int nrf24l01p_get_power (const nrf24l01p_t *dev)
 Get the transmit power for the nrf24l01+ transceiver device. More...
 
int nrf24l01p_set_txmode (const nrf24l01p_t *dev)
 Set the nrf24l01+ into TX mode. More...
 
int nrf24l01p_set_rxmode (const nrf24l01p_t *dev)
 Set the nrf24l01+ into RX mode. More...
 
int nrf24l01p_reset_all_interrupts (const nrf24l01p_t *dev)
 Reset all interrupts on the nrf24l01+ transceiver. More...
 
int nrf24l01p_reset_interrupts (const nrf24l01p_t *dev, char intrs)
 Reset interrupts on the nrf24l01+ transceiver. More...
 
int nrf24l01p_mask_interrupt (const nrf24l01p_t *dev, char intr)
 Mask one interrupt on the nrf24l01+ transceiver. More...
 
int nrf24l01p_unmask_interrupt (const nrf24l01p_t *dev, char intr)
 Unmask one interrupt on the nrf24l01+ transceiver. More...
 
int nrf24l01p_enable_pipe (const nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pipe)
 Enable RX datapipe on the nrf24l01+ transceiver. More...
 
int nrf24l01p_disable_pipe (const nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pipe)
 Disable RX datapipe on the nrf24l01+ transceiver. More...
 
int nrf24l01p_disable_crc (const nrf24l01p_t *dev)
 Disable CRC error detection on the nrf24l01+ transceiver. More...
 
int nrf24l01p_enable_crc (const nrf24l01p_t *dev, nrf24l01p_crc_t crc)
 Enable CRC error detection on the nrf24l01+ transceiver. More...
 
int nrf24l01p_setup_auto_ack (const nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pipe, nrf24l01p_retransmit_delay_t delay_retrans, char count_retrans)
 Setup and enable automatic ACK and retransmission on the nrf24l01+ transceiver. More...
 
int nrf24l01p_disable_all_auto_ack (const nrf24l01p_t *dev)
 Disable automatic ACK on the nrf24l01+ transceiver. More...
 
int nrf24l01p_flush_tx_fifo (const nrf24l01p_t *dev)
 Flush TX FIFO on the nrf24l01+ transceiver. More...
 
int nrf24l01p_flush_rx_fifo (const nrf24l01p_t *dev)
 Flush RX FIFO on the nrf24l01+ transceiver. More...
 
void nrf24l01p_rx_cb (void *arg)
 Callback that is called when interrupt occurs on interrupt pin from the nrf24l01+ transceiver. More...
 

Enumeration Type Documentation

◆ nrf24l01p_aw_t

Defines the address width of the nrf24l01+ transceiver.

Enumerator
NRF24L01P_AW_3BYTE 

address width is 3 Byte

NRF24L01P_AW_4BYTE 

address width is 4 Byte

NRF24L01P_AW_5BYTE 

address width is 5 Byte

Definition at line 49 of file nrf24l01p.h.

◆ nrf24l01p_crc_t

Defines the error detection encoding scheme for the nrf24l01p transceiver.

Enumerator
NRF24L01P_CRC_1BYTE 

encoding scheme generates 1 Byte redundancy

NRF24L01P_CRC_2BYTE 

encoding scheme generates 2 Bytes redundancy

Definition at line 90 of file nrf24l01p.h.

◆ nrf24l01p_dr_t

Defines the RF datarate.

Enumerator
NRF24L01P_DR_250KBS 

datarate is 250 kbps

NRF24L01P_DR_1MBS 

datarate is 1 Mbps

NRF24L01P_DR_2MBS 

datarate is 2 Mbps

Definition at line 59 of file nrf24l01p.h.

◆ nrf24l01p_pwr_t

Defines the RF power level.

Enumerator
NRF24L01P_PWR_N18DBM 

power is -18dBm

NRF24L01P_PWR_N12DBM 

power is -12dBm

NRF24L01P_PWR_N6DBM 

power is - 6dBm

NRF24L01P_PWR_0DBM 

power is 0dBm

Definition at line 68 of file nrf24l01p.h.

◆ nrf24l01p_retransmit_delay_t

Defines the automatic retransmission delay defined from end of transmission to start of next treansmission.

Enumerator
NRF24L01P_RETR_250US 

retransmit delay is 250us

NRF24L01P_RETR_500US 

retransmit delay is 500us

NRF24L01P_RETR_750US 

retransmit delay is 750us

NRF24L01P_RETR_1000US 

retransmit delay is 1000us

NRF24L01P_RETR_1250US 

retransmit delay is 1250us

NRF24L01P_RETR_1500US 

retransmit delay is 1500us

NRF24L01P_RETR_1750US 

retransmit delay is 1750us

NRF24L01P_RETR_2000US 

retransmit delay is 2000us

NRF24L01P_RETR_2250US 

retransmit delay is 2250us

NRF24L01P_RETR_2500US 

retransmit delay is 2500us

NRF24L01P_RETR_2750US 

retransmit delay is 2750us

NRF24L01P_RETR_3000US 

retransmit delay is 3000us

NRF24L01P_RETR_3250US 

retransmit delay is 3250us

NRF24L01P_RETR_3500US 

retransmit delay is 3500us

NRF24L01P_RETR_3750US 

retransmit delay is 3750us

NRF24L01P_RETR_4000US 

retransmit delay is 4000us

Definition at line 99 of file nrf24l01p.h.

◆ nrf24l01p_rx_event_t

Defines states for the nrf24l01+ transceiver.

Enumerator
RCV_PKT_NRF24L01P 

transceiver received data

Definition at line 121 of file nrf24l01p.h.

◆ nrf24l01p_rx_pipe_t

Defines the datapipe on which the receiver searches for packets.

Enumerator
NRF24L01P_PIPE0 

RX pipe 0.

NRF24L01P_PIPE1 

RX pipe 1.

NRF24L01P_PIPE2 

RX pipe 2.

NRF24L01P_PIPE3 

RX pipe 3.

NRF24L01P_PIPE4 

RX pipe 4.

NRF24L01P_PIPE5 

RX pipe 5.

Definition at line 78 of file nrf24l01p.h.

Function Documentation

◆ nrf24l01p_disable_all_auto_ack()

int nrf24l01p_disable_all_auto_ack ( const nrf24l01p_t dev)

Disable automatic ACK on the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_disable_crc()

int nrf24l01p_disable_crc ( const nrf24l01p_t dev)

Disable CRC error detection on the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
Returns
0.

◆ nrf24l01p_disable_pipe()

int nrf24l01p_disable_pipe ( const nrf24l01p_t dev,
nrf24l01p_rx_pipe_t  pipe 
)

Disable RX datapipe on the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
[in]pipeRX pipe to disable.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_enable_crc()

int nrf24l01p_enable_crc ( const nrf24l01p_t dev,
nrf24l01p_crc_t  crc 
)

Enable CRC error detection on the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
[in]crcLength of cyclic redundancy check (type nrf24l01p_crc_t).
Returns
0 on success.
-1 on error.

◆ nrf24l01p_enable_dynamic_ack()

int nrf24l01p_enable_dynamic_ack ( const nrf24l01p_t dev)

Enable dynamic ack for the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_enable_dynamic_payload()

int nrf24l01p_enable_dynamic_payload ( const nrf24l01p_t dev,
nrf24l01p_rx_pipe_t  pipe 
)

Enable dynamic payload for the pipe on give nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
[in]pipeRX pipe for which dynamic payload is enabled
Returns
0 on success.
-1 on error.

◆ nrf24l01p_enable_pipe()

int nrf24l01p_enable_pipe ( const nrf24l01p_t dev,
nrf24l01p_rx_pipe_t  pipe 
)

Enable RX datapipe on the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
[in]pipeRX pipe to enable.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_flush_rx_fifo()

int nrf24l01p_flush_rx_fifo ( const nrf24l01p_t dev)

Flush RX FIFO on the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_flush_tx_fifo()

int nrf24l01p_flush_tx_fifo ( const nrf24l01p_t dev)

Flush TX FIFO on the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_get_id()

void nrf24l01p_get_id ( const nrf24l01p_t dev,
unsigned int *  pid 
)

Get ID from the nrf24l01p transceiver.

Parameters
[in]devTransceiver device to use.
[in]pidTransceiver ID.

◆ nrf24l01p_get_power()

int nrf24l01p_get_power ( const nrf24l01p_t dev)

Get the transmit power for the nrf24l01+ transceiver device.

Parameters
[in]devTransceiver device to use.
Returns
TX power value of the nrf24l01+ transceiver.

◆ nrf24l01p_get_rx_address_long()

uint64_t nrf24l01p_get_rx_address_long ( const nrf24l01p_t dev,
nrf24l01p_rx_pipe_t  pipe 
)

Get the RX address for the nrf24l01+ transceiver (long int).

Parameters
[in]devTransceiver device to use.
[in]pipeRX pipe to get the address from.
Returns
RX address of the nrf24l01+ transceiver.
-1 on error.

◆ nrf24l01p_get_status()

int nrf24l01p_get_status ( const nrf24l01p_t dev)

Get the status (register) of the nrf24l01+ transceiver device.

Parameters
[in]devTransceiver device to use.s of the.
Returns
Value of the status register.

◆ nrf24l01p_get_tx_address_long()

uint64_t nrf24l01p_get_tx_address_long ( const nrf24l01p_t dev)

Get the TX address for the nrf24l01+ transceiver (long int).

Parameters
[in]devTransceiver device to use.
Returns
TX address of the nrf24l01+ transceiver.
-1 on error.

◆ nrf24l01p_init()

int nrf24l01p_init ( nrf24l01p_t dev,
spi_t  spi,
gpio_t  ce,
gpio_t  csn,
gpio_t  irq 
)

Initialize the nrf24l01+ transceiver.

@ note This function initializes the transceiver so that it is ready to use.

Parameters
[in]devTransceiver device to use.
[in]spiSPI device to use.
[in]ceGPIO pin to use for chip enable.
[in]csnGPIO pin to use for chip select.
[in]irqGPIO pin to use for interrupt request.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_mask_interrupt()

int nrf24l01p_mask_interrupt ( const nrf24l01p_t dev,
char  intr 
)

Mask one interrupt on the nrf24l01+ transceiver.

Note
There are three interrupts on the nrf24l01+ which can be masked: "MASK_RX_DR", "MASK_TX_DS" and "MASK_MAX_RT". Theay are defined in "include/nrf24l01p_settings.h".
Parameters
[in]devTransceiver device to use.
[in]intrTransceiver device to use.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_off()

int nrf24l01p_off ( const nrf24l01p_t dev)

Power off the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_on()

int nrf24l01p_on ( const nrf24l01p_t dev)

Power on the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_preload()

int nrf24l01p_preload ( const nrf24l01p_t dev,
char *  data,
unsigned int  size 
)

Preload TX FIFO with payload to transmit.

Parameters
[in]devTransceiver device to use.
[in]dataBuffer to preload.
[in]sizeNumber of bytes in buffer. For nrf24l01+ e.g. 32
Returns
Number of bytes that were transferred.
-1 on error.

◆ nrf24l01p_read_payload()

int nrf24l01p_read_payload ( const nrf24l01p_t dev,
char *  answer,
unsigned int  size 
)

Read payload from RX FIFO of the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
[in]answerBuffer to receive bytes to.
[in]sizeNumber of bytes to transfer. For nrf24l01+ in general 32.
Returns
Number of bytes that were transferred.
-1 on error.

◆ nrf24l01p_read_reg()

int nrf24l01p_read_reg ( const nrf24l01p_t dev,
char  reg,
char *  answer 
)

Read one register of the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
[in]regRegister address to read from.
[in]answerByte to read.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_register()

void nrf24l01p_register ( nrf24l01p_t dev,
unsigned int *  pid 
)

Register a given ID to the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
[in]pidID to register.

◆ nrf24l01p_reset_all_interrupts()

int nrf24l01p_reset_all_interrupts ( const nrf24l01p_t dev)

Reset all interrupts on the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
Returns
1 on success.
-1 on error.

◆ nrf24l01p_reset_interrupts()

int nrf24l01p_reset_interrupts ( const nrf24l01p_t dev,
char  intrs 
)

Reset interrupts on the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
[in]intrsInterrupt mask to reset
Returns
1 on success.
-1 on error.

◆ nrf24l01p_rx_cb()

void nrf24l01p_rx_cb ( void *  arg)

Callback that is called when interrupt occurs on interrupt pin from the nrf24l01+ transceiver.

Parameters
[in]argUsed to pass transceiver device "dev".

◆ nrf24l01p_set_address_width()

int nrf24l01p_set_address_width ( const nrf24l01p_t dev,
nrf24l01p_aw_t  aw 
)

Set the address width for the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
[in]awAddress width (type nrf24l01p_aw_t).
Returns
0 on success.
-1 on error.

◆ nrf24l01p_set_channel()

int nrf24l01p_set_channel ( const nrf24l01p_t dev,
uint8_t  chan 
)

Set the RF channel for the nrf24l01+ transceiver.

Note
To ensure non-overlapping channels in 2Mbps mode, don't use directly neighbouring channels in this mode.
Parameters
[in]devTransceiver device to use.
[in]chanBuffer to preload.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_set_datarate()

int nrf24l01p_set_datarate ( const nrf24l01p_t dev,
nrf24l01p_dr_t  dr 
)

Get the TX address for the nrf24l01+ transceiver (long int).

Note
If you chose 2Mbps you should not allocate directly neighboring RF channels.
Parameters
[in]devTransceiver device to use.
[in]drDatarate (of type nrf24l01p_dr_t).
Returns
1 on success.
-1 on error.

◆ nrf24l01p_set_payload_width()

int nrf24l01p_set_payload_width ( const nrf24l01p_t dev,
nrf24l01p_rx_pipe_t  pipe,
uint8_t  width 
)

Set the RX payload width for the nrf24l01+ transceiver.

@ note This function sets the payload width for one packet. If the maximum of 32 bytes is exeeded, this value is set to 32.

Parameters
[in]devTransceiver device to use.
[in]pipeRX pipe to set the payload width.
[in]widthNumber of bytes per packet in RX payload.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_set_power()

int nrf24l01p_set_power ( const nrf24l01p_t dev,
int  pwr 
)

Set the transmit power for the nrf24l01+ transceiver device.

Note
This function rounds the input values to the nearest possible setting.
Parameters
[in]devTransceiver device to use.
[in]pwrTX power for the nrf24l01p transceiver.
Returns
1 on success.
-1 on error.

◆ nrf24l01p_set_rx_address()

int nrf24l01p_set_rx_address ( const nrf24l01p_t dev,
nrf24l01p_rx_pipe_t  pipe,
const uint8_t *  saddr,
unsigned int  length 
)

Set the RX address for the nrf24l01+ transceiver (byte array).

Note
You can either use this function and give it a pointer to a byte array which holds the address to set, or use "nrf24l01p_set_rx_address_long" which requires a uint64_t which holds the address in the LSBs.
Parameters
[in]devTransceiver device to use.
[in]pipeRX pipe to set the address.
[in]saddrByte array which holds the RX address.
[in]lengthNumber of bytes in address array.
Returns
Address length on success.
-1 on error.

◆ nrf24l01p_set_rx_address_long()

int nrf24l01p_set_rx_address_long ( const nrf24l01p_t dev,
nrf24l01p_rx_pipe_t  pipe,
uint64_t  saddr,
unsigned int  length 
)

Set the RX address for the nrf24l01+ transceiver (long int).

Parameters
[in]devTransceiver device to use.
[in]pipeRX pipe to set the address.
[in]saddrLong integer which holds the RX address in LSBs.
[in]lengthNumber of relevant bytes in uint64_t.
Returns
Address length on success.
-1 on error.

◆ nrf24l01p_set_rxmode()

int nrf24l01p_set_rxmode ( const nrf24l01p_t dev)

Set the nrf24l01+ into RX mode.

Parameters
[in]devTransceiver device to use.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_set_tx_address()

int nrf24l01p_set_tx_address ( const nrf24l01p_t dev,
const uint8_t *  saddr,
unsigned int  length 
)

Set the TX address for the nrf24l01+ transceiver (byte array).

Note
You can either use this function and give it a pointer to a byte array which holds the address to set, or use "nrf24l01p_set_tx_address_long" which requires a uint64_t which holds the address in the LSBs.
Parameters
[in]devTransceiver device to use.
[in]saddrByte array which holds the TX address.
[in]lengthNumber of bytes in address array.
Returns
Address length on success.
-1 on error.

◆ nrf24l01p_set_tx_address_long()

int nrf24l01p_set_tx_address_long ( const nrf24l01p_t dev,
uint64_t  saddr,
unsigned int  length 
)

Set the TX address for the nrf24l01+ transceiver (long int).

Parameters
[in]devTransceiver device to use.
[in]saddrLong integer which holds the TX address in LSBs.
[in]lengthNumber of relevant bytes in uint64_t.
Returns
Address length on success.
-1 on error.

◆ nrf24l01p_set_txmode()

int nrf24l01p_set_txmode ( const nrf24l01p_t dev)

Set the nrf24l01+ into TX mode.

Parameters
[in]devTransceiver device to use.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_setup_auto_ack()

int nrf24l01p_setup_auto_ack ( const nrf24l01p_t dev,
nrf24l01p_rx_pipe_t  pipe,
nrf24l01p_retransmit_delay_t  delay_retrans,
char  count_retrans 
)

Setup and enable automatic ACK and retransmission on the nrf24l01+ transceiver.

Note
This function enables automatic acknowledgement for a given RX data pipe and also sets up the mautomatic retransmission behavior.
Parameters
[in]devTransceiver device to use.
[in]pipeRX pipe to setup auto ack.
[in]delay_retransAutomatic retransmission delay (type nrf24l01p_retransmit_delay_t)
[in]count_retransAuto retransmit count.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_start()

void nrf24l01p_start ( const nrf24l01p_t dev)

Start searching packets while in RX mode.

Parameters
[in]devTransceiver device to use.

◆ nrf24l01p_stop()

void nrf24l01p_stop ( const nrf24l01p_t dev)

Stop searching packets while in RX mode.

Parameters
[in]devTransceiver device to use.

◆ nrf24l01p_transmit()

void nrf24l01p_transmit ( const nrf24l01p_t dev)

Transmit payload laying in TX FIFO of the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.

◆ nrf24l01p_unmask_interrupt()

int nrf24l01p_unmask_interrupt ( const nrf24l01p_t dev,
char  intr 
)

Unmask one interrupt on the nrf24l01+ transceiver.

Note
There are three interrupts on the nrf24l01+ which can be unmasked: "MASK_RX_DR", "MASK_TX_DS" and "MASK_MAX_RT". Theay are defined in "include/nrf24l01p_settings.h".
Parameters
[in]devTransceiver device to use.
[in]intrTransceiver device to use.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_unregister()

int nrf24l01p_unregister ( nrf24l01p_t dev,
unsigned int  pid 
)

Unregister the nrf24l01+ transceiver from his ID.

Parameters
[in]devTransceiver device to use.
[in]pidActual ID to unregister.
Returns
0 on success.
-1 on error.

◆ nrf24l01p_write_reg()

int nrf24l01p_write_reg ( const nrf24l01p_t dev,
char  reg,
char  write 
)

Write one register to the nrf24l01+ transceiver.

Parameters
[in]devTransceiver device to use.
[in]regRegister address to write to.
[in]writeByte to write.
Returns
0 on success.
-1 on error.