NRF24L01 Library
|
Go to the source code of this file.
Defines | |
#define | _RX_DR (1<<6) |
Data Ready RX FIFO interrupt. | |
#define | _TX_DS (1<<5) |
Data Sent TX FIFO interrupt. | |
#define | _MAX_RT (1<<4) |
Maximum number of TX retransmits interrupt. | |
#define | _POWER_DOWN 0 |
Power Down mode. | |
#define | _POWER_UP (1<<1) |
Power Up mode. | |
#define | _TX_MODE 0 |
Mode radio transmitter. | |
#define | _RX_MODE 1 |
Mode radio receiver. | |
#define | _1Mbps 0 |
Air data rate = 1 Mbps. | |
#define | _2Mbps (1<<3) |
Air data rate = 2 Mbps. | |
#define | _ShockBurst_ON 1 |
Enable ShockBurst. | |
#define | _ShockBurst_OFF 0 |
Disable ShockBurst. | |
#define | CONFIG 0x00 |
#define | EN_AA 0x01 |
#define | EN_RXADDR 0x02 |
#define | SETUP_AW 0x03 |
#define | SETUP_RETR 0x04 |
#define | RF_CH 0x05 |
#define | RF_SETUP 0x06 |
#define | STATUS 0x07 |
#define | OBSERVE_TX 0x08 |
#define | CD 0x09 |
#define | RX_ADDR_P0 0x0A |
#define | RX_ADDR_P1 0x0B |
#define | RX_ADDR_P2 0x0C |
#define | RX_ADDR_P3 0x0D |
#define | RX_ADDR_P4 0x0E |
#define | RX_ADDR_P5 0x0F |
#define | TX_ADDR 0x10 |
#define | RX_PW_P0 0x11 |
#define | RX_PW_P1 0x12 |
#define | RX_PW_P2 0x13 |
#define | RX_PW_P3 0x14 |
#define | RX_PW_P4 0x15 |
#define | RX_PW_P5 0x16 |
#define | FIFO_STATUS 0x17 |
#define | DYNPD 0x1C |
#define | FEATURE 0x1D |
#define | R_REGISTER 0x00 |
#define | W_REGISTER 0x20 |
#define | R_RX_PAYLOAD 0x61 |
#define | W_TX_PAYLOAD 0xA0 |
#define | FLUSH_TX 0xE1 |
#define | FLUSH_RX 0xE2 |
#define | REUSE_TX_PL 0xE3 |
#define | ACTIVATE 0x50 |
#define | R_RX_PL_WID 0x60 |
#define | W_ACK_PAYLOAD 0xA8 |
#define | W_TX_PAYLOAD_NOACK 0x58 |
#define | NOP 0xFF |
Functions | |
char | NRF24L01_ReadReg (char Reg) |
Read a register. | |
char | NRF24L01_WriteReg (char Reg, char Value) |
Returns the STATUS register and then modify a register. | |
char | NRF24L01_ReadRegBuf (char Reg, char *Buf, int Size) |
Returns the STATUS register and then read "n" registers. | |
char | NRF24L01_WriteRegBuf (char Reg, char *Buf, int Size) |
Returns the STATUS register and then write "n" registers. | |
char | NRF24L01_Get_Status (void) |
Returns the STATUS register. | |
char | NRF24L01_Get_CD (void) |
Returns the carrier signal in RX mode (high when detected) | |
void | NRF24L01_Set_Power (char Mode) |
Select power mode. | |
void | NRF24L01_Set_CH (char CH) |
Select the radio channel. | |
void | NRF24L01_Set_ShockBurst (char Mode) |
Select Enhanced ShockBurst ON/OFF. | |
void | NRF24L01_Set_Address_Width (char Width) |
Select the address width. | |
void | NRF24L01_Set_Device_Mode (char Device_Mode) |
Select mode receiver or transmitter. | |
void | NRF24L01_Set_RX_Pipe (char PipeNum, char *Address, int AddressSize, char PayloadSize) |
Enables and configures the pipe receiving the data. | |
void | NRF24L01_Disable_All_Pipes (void) |
Disable all pipes. | |
char | NRF24L01_Clear_Interrupts (void) |
Returns the STATUS register and then clear all interrupts. | |
void | NRF24L01_Set_TX_Address (char *Address, int Size) |
Sets the direction of transmission. | |
void | NRF24L01_Flush_TX (void) |
Empty the transmit buffer. | |
void | NRF24L01_Flush_RX (void) |
Empty the receive buffer. | |
void | NRF24L01_Init (char Device_Mode, char CH, char DataRate, char *Address, char Address_Width, char Size_Payload) |
Initializes the device. | |
void | NRF24L01_RF_TX (void) |
Turn on transmitter, and transmits the data loaded into the buffer. | |
void | NRF24L01_Write_TX_Buf (char *Buf, int Size) |
Writes the buffer of data transmission. | |
void | NRF24L01_Read_RX_Buf (char *Buf, int Size) |
Read the data reception buffer. |
#define _1Mbps 0 |
Air data rate = 1 Mbps.
#define _2Mbps (1<<3) |
Air data rate = 2 Mbps.
#define _MAX_RT (1<<4) |
Maximum number of TX retransmits interrupt.
#define _POWER_DOWN 0 |
Power Down mode.
Minimal current consumption, SPI can be activated
#define _POWER_UP (1<<1) |
#define _RX_DR (1<<6) |
Data Ready RX FIFO interrupt.
#define _RX_MODE 1 |
Mode radio receiver.
#define _ShockBurst_OFF 0 |
Disable ShockBurst.
#define _ShockBurst_ON 1 |
Enable ShockBurst.
Automatic Retransmission (Up to 1 Re-Transmit on fail of AA)
Auto Acknowledgment (data pipe 0)
#define _TX_DS (1<<5) |
Data Sent TX FIFO interrupt.
#define _TX_MODE 0 |
Mode radio transmitter.
#define ACTIVATE 0x50 |
#define CD 0x09 |
#define CONFIG 0x00 |
#define DYNPD 0x1C |
#define EN_AA 0x01 |
#define EN_RXADDR 0x02 |
#define FEATURE 0x1D |
#define FIFO_STATUS 0x17 |
#define FLUSH_RX 0xE2 |
#define FLUSH_TX 0xE1 |
#define NOP 0xFF |
#define OBSERVE_TX 0x08 |
#define R_REGISTER 0x00 |
#define R_RX_PAYLOAD 0x61 |
#define R_RX_PL_WID 0x60 |
#define REUSE_TX_PL 0xE3 |
#define RF_CH 0x05 |
#define RF_SETUP 0x06 |
#define RX_ADDR_P0 0x0A |
#define RX_ADDR_P1 0x0B |
#define RX_ADDR_P2 0x0C |
#define RX_ADDR_P3 0x0D |
#define RX_ADDR_P4 0x0E |
#define RX_ADDR_P5 0x0F |
#define RX_PW_P0 0x11 |
#define RX_PW_P1 0x12 |
#define RX_PW_P2 0x13 |
#define RX_PW_P3 0x14 |
#define RX_PW_P4 0x15 |
#define RX_PW_P5 0x16 |
#define SETUP_AW 0x03 |
#define SETUP_RETR 0x04 |
#define STATUS 0x07 |
#define TX_ADDR 0x10 |
#define W_ACK_PAYLOAD 0xA8 |
#define W_REGISTER 0x20 |
#define W_TX_PAYLOAD 0xA0 |
#define W_TX_PAYLOAD_NOACK 0x58 |
char NRF24L01_Clear_Interrupts | ( | void | ) |
Returns the STATUS register and then clear all interrupts.
void NRF24L01_Disable_All_Pipes | ( | void | ) |
Disable all pipes.
void NRF24L01_Flush_RX | ( | void | ) |
Empty the receive buffer.
void NRF24L01_Flush_TX | ( | void | ) |
Empty the transmit buffer.
char NRF24L01_Get_CD | ( | void | ) |
Returns the carrier signal in RX mode (high when detected)
char NRF24L01_Get_Status | ( | void | ) |
Returns the STATUS register.
void NRF24L01_Init | ( | char | Device_Mode, |
char | CH, | ||
char | DataRate, | ||
char * | Address, | ||
char | Address_Width, | ||
char | Size_Payload | ||
) |
void NRF24L01_Read_RX_Buf | ( | char * | Buf, |
int | Size | ||
) |
Read the data reception buffer.
Buf | Buffer with data received |
Size | Buffer size |
char NRF24L01_ReadReg | ( | char | Reg | ) |
Read a register.
Reg | Register to read |
char NRF24L01_ReadRegBuf | ( | char | Reg, |
char * | Buf, | ||
int | Size | ||
) |
Returns the STATUS register and then read "n" registers.
Reg | Register to read |
Buf | Pointer to a buffer |
Size | Buffer Size |
void NRF24L01_RF_TX | ( | void | ) |
Turn on transmitter, and transmits the data loaded into the buffer.
void NRF24L01_Set_Address_Width | ( | char | Width | ) |
Select the address width.
Width | = 3..5 |
void NRF24L01_Set_CH | ( | char | CH | ) |
Select the radio channel.
CH | = 0..125 |
void NRF24L01_Set_Device_Mode | ( | char | Device_Mode | ) |
void NRF24L01_Set_Power | ( | char | Mode | ) |
void NRF24L01_Set_RX_Pipe | ( | char | PipeNum, |
char * | Address, | ||
int | AddressSize, | ||
char | PayloadSize | ||
) |
Enables and configures the pipe receiving the data.
PipeNum | Number of pipe |
Address | Address |
AddressSize | Address size |
PayloadSize | Buffer size, data receiver |
void NRF24L01_Set_ShockBurst | ( | char | Mode | ) |
Select Enhanced ShockBurst ON/OFF.
Disable this functionality to be compatible with nRF2401
Mode | = _ShockBurst_ON, _ShockBurst_OFF |
void NRF24L01_Set_TX_Address | ( | char * | Address, |
int | Size | ||
) |
Sets the direction of transmission.
Address | Address |
Size | Address size 3..5 |
void NRF24L01_Write_TX_Buf | ( | char * | Buf, |
int | Size | ||
) |
Writes the buffer of data transmission.
Buf | Buffer with data to send |
Size | Buffer size |
char NRF24L01_WriteReg | ( | char | Reg, |
char | Value | ||
) |
Returns the STATUS register and then modify a register.
Reg | Register to change |
Value | New value |
char NRF24L01_WriteRegBuf | ( | char | Reg, |
char * | Buf, | ||
int | Size | ||
) |
Returns the STATUS register and then write "n" registers.
Reg | Registers to change |
Buf | Pointer to a buffer |
Size | Buffer Size |