NRF24L01 Library

nrf24l01.h

Go to the documentation of this file.
00001 /*
00002  * @author
00003  * Copyright (C) 2012 Luis R. Hilario http://www.luisdigital.com
00004  *
00005  */
00006 
00007 // Bits
00008 
00012 #define _RX_DR (1<<6)
00013 
00017 #define _TX_DS (1<<5)
00018 
00022 #define _MAX_RT (1<<4)
00023 
00030 #define _POWER_DOWN     0
00031 
00038 #define _POWER_UP       (1<<1)
00039 
00046 #define _TX_MODE        0
00047 
00054 #define _RX_MODE        1
00055 
00062 #define _1Mbps  0
00063 
00069 #define _2Mbps  (1<<3)
00070 
00079 #define _ShockBurst_ON 1
00080 
00085 #define _ShockBurst_OFF 0
00086 
00087 
00088 // REGISTERS
00089 #define CONFIG          0x00
00090 #define EN_AA           0x01
00091 #define EN_RXADDR       0x02
00092 #define SETUP_AW        0x03
00093 #define SETUP_RETR      0x04
00094 #define RF_CH           0x05
00095 #define RF_SETUP        0x06
00096 #define STATUS          0x07
00097 #define OBSERVE_TX      0x08
00098 #define CD                      0x09
00099 #define RX_ADDR_P0      0x0A
00100 #define RX_ADDR_P1      0x0B
00101 #define RX_ADDR_P2      0x0C
00102 #define RX_ADDR_P3      0x0D
00103 #define RX_ADDR_P4      0x0E
00104 #define RX_ADDR_P5      0x0F
00105 #define TX_ADDR         0x10
00106 #define RX_PW_P0        0x11
00107 #define RX_PW_P1        0x12
00108 #define RX_PW_P2        0x13
00109 #define RX_PW_P3        0x14
00110 #define RX_PW_P4        0x15
00111 #define RX_PW_P5        0x16
00112 #define FIFO_STATUS     0x17
00113 #define DYNPD           0x1C
00114 #define FEATURE         0x1D
00115 
00116 // COMMANDS
00117 #define R_REGISTER                      0x00
00118 #define W_REGISTER                      0x20
00119 #define R_RX_PAYLOAD        0x61
00120 #define W_TX_PAYLOAD        0xA0
00121 #define FLUSH_TX                0xE1
00122 #define FLUSH_RX                        0xE2
00123 #define REUSE_TX_PL             0xE3
00124 #define ACTIVATE            0x50
00125 #define R_RX_PL_WID         0x60
00126 #define W_ACK_PAYLOAD           0xA8
00127 #define W_TX_PAYLOAD_NOACK      0x58
00128 #define NOP                 0xFF
00129 
00130 /*
00131  * SPI functions for NRF24L01
00132  */
00133 char NRF24L01_ReadReg(char Reg);
00134 char NRF24L01_WriteReg(char Reg, char Value);
00135 char NRF24L01_ReadRegBuf(char Reg, char *Buf, int Size);
00136 char NRF24L01_WriteRegBuf(char Reg, char *Buf, int Size);
00137 
00138 /*
00139  * NRF24L01 functions
00140  */
00141 char NRF24L01_Get_Status(void);
00142 char NRF24L01_Get_CD(void);
00143 void NRF24L01_Set_Power(char Mode);
00144 void NRF24L01_Set_CH(char CH);
00145 void NRF24L01_Set_ShockBurst(char Mode);
00146 void NRF24L01_Set_Address_Width(char Width);
00147 void NRF24L01_Set_Device_Mode(char Device_Mode);
00148 void NRF24L01_Set_RX_Pipe(char PipeNum, char *Address, int AddressSize, char PayloadSize);
00149 void NRF24L01_Disable_All_Pipes(void);
00150 char NRF24L01_Clear_Interrupts(void);
00151 void NRF24L01_Set_TX_Address(char *Address, int Size);
00152 void NRF24L01_Flush_TX(void);
00153 void NRF24L01_Flush_RX(void);
00154 void NRF24L01_Init(char Device_Mode, char CH, char DataRate,
00155                 char *Address, char Address_Width, char Size_Payload);
00156 void NRF24L01_RF_TX(void);
00157 void NRF24L01_Write_TX_Buf(char *Buf, int Size);
00158 void NRF24L01_Read_RX_Buf(char *Buf, int Size);
 All Files Functions Defines