|
void | nRF24_Init (nrf24_t *nrf_object) |
|
void | nRF24_OpenRxPipe (nrf24_t *nrf_object, uint8_t pipenum, uint64_t address) |
|
void | nRF24_OpenTxPipe (nrf24_t *nrf_object, uint64_t address) |
|
void | nRF24_EventHandler (nrf24_t *nrf_object) |
|
void | nRF24_StartListening (nrf24_t *nrf_object) |
|
void | nRF24_Standby (nrf24_t *nrf_object) |
|
void | nRF24_WriteReg (nrf24_t *nrf_object, uint8_t reg_address, uint8_t value) |
|
void | nRF24_WriteMultReg (nrf24_t *nrf_object, uint8_t reg_address, uint8_t *data_ptr, uint8_t length) |
|
uint8_t | nRF24_ReadReg (nrf24_t *nrf_object, uint8_t reg_address) |
|
uint8_t | nRF24_GetPayloadLength (nrf24_t *nrf_object) |
|
void | nRF24_Write (nrf24_t *nrf_object, uint8_t *buf, uint8_t length) |
|
void | nRF24_Read (nrf24_t *nrf_object, uint8_t *buf, uint8_t length) |
|
void | nRF24_WriteAck (nrf24_t *nrf_object, uint8_t *buf, uint8_t length, uint8_t pipe) |
|
void | nRF24_SetPowerAmplificationLevel (nrf24_t *nrf_object, nrf24_pa_level_e level) |
|
void | nRF24_SetDataRate (nrf24_t *nrf_object, nrf24_datarate_e rate) |
|
void | nRF24_SetCRCMode (nrf24_t *nrf_object, nrf24_crc_mode_e mode) |
|
void | nRF24_SetChannel (nrf24_t *nrf_object, uint8_t channel) |
|
void | nRF24_SetActive (nrf24_t *nrf_object, uint8_t active) |
|
void | nRF24_SetRetries (nrf24_t *nrf_object, uint8_t delay, uint8_t count) |
|
void | nRF24_FlushRx (nrf24_t *nrf_object) |
|
void | nRF24_FlushTx (nrf24_t *nrf_object) |
|
This module provides an interface with the nRF24L01+ built on the SPI module.
TODO: Make this library work with big endian devices
Enumerator |
---|
NRF24_NO_CRC |
|
NRF24_CRC_8BIT |
|
NRF24_CRC_16BIT |
|
Enumerator |
---|
NRF24_250KBPS |
|
NRF24_1MBPS |
|
NRF24_2MBPS |
|
Enumerator |
---|
NRF24_PA_LOW |
|
NRF24_PA_MID |
|
NRF24_PA_HIGH |
|
NRF24_PA_MAX |
|
void nRF24_EventHandler |
( |
nrf24_t * |
nrf_object | ) |
|
Use nRF24_ISR() in the interrupt service routine that detects high to low changes for the IRQ pin.
void nRF24_FlushRx |
( |
nrf24_t * |
nrf_object | ) |
|
void nRF24_FlushTx |
( |
nrf24_t * |
nrf_object | ) |
|
uint8_t nRF24_GetPayloadLength |
( |
nrf24_t * |
nrf_object | ) |
|
Get the length of the payload received
void nRF24_Init |
( |
nrf24_t * |
nrf_object | ) |
|
Initialize nRF24L01+ module with default settings
SPI channel should already be initialized before calling nRF24_Init().
Default Settings:
- Max Retries 15
- Power Amplification Max
- Data Rate 2Mbps
- 16-bit CRC
- Channel 76
- Dynamic Payload Length Feature
- Ack Payload Feature
- Dynamic Ack Payload Feature (allow empty acks)
- Auto Ack Enabled on All Pipes
- Dynamic Payload Enabled for All Pipes
- 5-byte Address Width
Example Usage:
- Parameters
-
nrf_object | Pointer to nfr24_t object. |
void nRF24_OpenRxPipe |
( |
nrf24_t * |
nrf_object, |
|
|
uint8_t |
pipenum, |
|
|
uint64_t |
address |
|
) |
| |
Open a RX pipe for a specific address
Note: for pipes 2-5 only the LSB of the address is used
- Parameters
-
nrf_object | Pointer to nfr24_t object. |
pipenum | Pipe index to use (0-5) |
address | address to receive from |
void nRF24_OpenTxPipe |
( |
nrf24_t * |
nrf_object, |
|
|
uint64_t |
address |
|
) |
| |
Open a TX pipe for a specific address
- Parameters
-
nrf_object | Pointer to nfr24_t object. |
address | address to transmit on |
TODO: We may need to add this back in. I am unsure how using dynamic payload effects the use of the payload length registers
void nRF24_Read |
( |
nrf24_t * |
nrf_object, |
|
|
uint8_t * |
buf, |
|
|
uint8_t |
length |
|
) |
| |
Read the received message
uint8_t nRF24_ReadReg |
( |
nrf24_t * |
nrf_object, |
|
|
uint8_t |
reg_address |
|
) |
| |
void nRF24_SetActive |
( |
nrf24_t * |
nrf_object, |
|
|
uint8_t |
active |
|
) |
| |
void nRF24_SetChannel |
( |
nrf24_t * |
nrf_object, |
|
|
uint8_t |
channel |
|
) |
| |
void nRF24_SetRetries |
( |
nrf24_t * |
nrf_object, |
|
|
uint8_t |
delay, |
|
|
uint8_t |
count |
|
) |
| |
- Parameters
-
delay | delay before retransmit attempt, actual delay = 250us + delay*250us where delay is from 0-15 |
count | retransmit count before triggering max retries interrupt, 0-15 where 0 is no retries and 15 is 15 retries |
void nRF24_Standby |
( |
nrf24_t * |
nrf_object | ) |
|
Disable the nRF24 chip and standby
void nRF24_StartListening |
( |
nrf24_t * |
nrf_object | ) |
|
Start listening on primary RX node
void nRF24_Write |
( |
nrf24_t * |
nrf_object, |
|
|
uint8_t * |
buf, |
|
|
uint8_t |
length |
|
) |
| |
Send a message from a primary TX node
void nRF24_WriteAck |
( |
nrf24_t * |
nrf_object, |
|
|
uint8_t * |
buf, |
|
|
uint8_t |
length, |
|
|
uint8_t |
pipe |
|
) |
| |
Send a message in an ack response payload from a primary RX node
void nRF24_WriteMultReg |
( |
nrf24_t * |
nrf_object, |
|
|
uint8_t |
reg_address, |
|
|
uint8_t * |
data_ptr, |
|
|
uint8_t |
length |
|
) |
| |
void nRF24_WriteReg |
( |
nrf24_t * |
nrf_object, |
|
|
uint8_t |
reg_address, |
|
|
uint8_t |
value |
|
) |
| |