Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
nrf24l01.h
00001 /****************************************************************************** 00002 * 00003 * File: nrf24l01.h 00004 * 00005 * Copyright S. Brennen Ball, 2006-2007 00006 * 00007 * The author provides no guarantees, warantees, or promises, implied or 00008 * otherwise. By using this software you agree to indemnify the author 00009 * of any damages incurred by using it. 00010 * 00011 *****************************************************************************/ 00012 00013 #ifndef NRF24L01_H_ 00014 #define NRF24L01_H_ 00015 00016 #include <stddef.h> 00017 00018 #ifndef bool 00019 #define bool unsigned char 00020 #endif 00021 #ifndef false 00022 #define false 0 00023 #endif 00024 #ifndef true 00025 #define true !false 00026 #endif 00027 00028 ///////////////////////////////////////////////////////////////////////////////// 00029 // SPI function requirements 00030 // 00031 // The user must define a function to send one byte of data and also return the 00032 // resulting byte of data data through the SPI port. The function used here 00033 // has the function prototype 00034 // 00035 // unsigned char spi_send_read_byte(unsigned char byte); 00036 // 00037 // This function should take the argument unsigned char byte and send it through 00038 // the SPI port to the 24L01. Then, it should wait until the 24L01 has returned 00039 // its response over SPI. This received byte should be the return value of the 00040 // function. 00041 // 00042 // You should also change the include file name below to whatever the name of your 00043 // SPI include file is. 00044 ////////////////////////////////////////////////////////////////////////////////// 00045 //#include "spi1.h" 00046 #define spi_send_read_byte(byte) nRF_spi.write(byte) 00047 00048 00049 ///////////////////////////////////////////////////////////////////////////////// 00050 // Delay function requirements 00051 // 00052 // The user must define a function that delays for the specified number of 00053 // microseconds. This function needs to be as precise as possible, and the use 00054 // of a timer module within your microcontroller is highly recommended. The 00055 // function used here has the prototype 00056 // 00057 // void delay_us(unsigned int microseconds); 00058 // 00059 // You should also change the include file name below to whatever the name of your 00060 // delay include file is. 00061 ////////////////////////////////////////////////////////////////////////////////// 00062 //#include "delays.h" 00063 #define delay_us(microseconds) wait_us(microseconds) 00064 00065 00066 ////////////////////////////////////////////////////////////////////////////////// 00067 // IO pin definitions 00068 // 00069 // Below you will find several definitions and includes. The first is an #include 00070 // for your microcontroller's include file to allow you to use register names 00071 // rather than numbers. The next three are to allow you to control the pins on 00072 // the 24L01 that aren't automatically handled by SPI. These are CE, CSN, and 00073 // IRQ. 00074 // 00075 // The general format of these defines is a define for the IO register the pin is 00076 // attached to. The second define is a mask for the pin. For example, say that 00077 // your CE pin is tied to an IO port with the register name IOPORT1. Also, let's 00078 // say that the IO port is 8-bits wide, and you have attached the pin to pin 0 of 00079 // the port. Then your define would look like this: 00080 // 00081 // #define nrf24l01_CE_IOREGISTER IOPORT1 00082 // #define nrf24l01_CE_PINMASK 0x01 00083 // 00084 // If you have defines in your include file for individual IO pins, you could use 00085 // this define in this file, as well. Using the previous example, assume that in 00086 // your microcontroller's include file, pin 0 of IOPORT1 has a define like this 00087 // 00088 // #define IOPORT1_PIN0 0x01 00089 // 00090 // Then, you could make your defines for the CE pin in this file look like this: 00091 // 00092 // #define nrf24l01_CE_IOREGISTER IOPORT1 00093 // #define nrf24l01_CE_PINMASK IOPORT1_PIN0 00094 // 00095 // You should also change the include file name below to whatever the name of your 00096 // processor's register definition include file is. 00097 ///////////////////////////////////////////////////////////////////////////////////// 00098 //#include "lpc214x.h" 00099 00100 //defines for uC pins CE pin is connected to 00101 //This is used so that the routines can send TX payload data and 00102 // properly initialize the nrf24l01 in TX and RX states. 00103 //Change these definitions (and then recompile) to suit your particular application. 00104 #define nrf24l01_CE_IOREGISTER pinCE 00105 #define nrf24l01_CE_PINMASK 1 00106 00107 //defines for uC pins CSN pin is connected to 00108 //This is used so that the routines can send properly operate the SPI interface 00109 // on the nrf24l01. 00110 //Change these definitions (and then recompile) to suit your particular application. 00111 #define nrf24l01_CSN_IOREGISTER pinCSN 00112 #define nrf24l01_CSN_PINMASK 1 00113 00114 //defines for uC pins IRQ pin is connected to 00115 //This is used so that the routines can poll for IRQ or create an ISR. 00116 //Change these definitions (and then recompile) to suit your particular application. 00117 #define nrf24l01_IRQ_IOREGISTER pinIRQ 00118 #define nrf24l01_IRQ_PINMASK 1 00119 00120 00121 //////////////////////////////////////////////////////////////////////////////////// 00122 // SPI commands 00123 // 00124 // The following are defines for all of the commands and data masks on the SPI 00125 // interface. 00126 //////////////////////////////////////////////////////////////////////////////////// 00127 //SPI command defines 00128 #define nrf24l01_R_REGISTER 0x00 00129 #define nrf24l01_W_REGISTER 0x20 00130 #define nrf24l01_R_RX_PAYLOAD 0x61 00131 #define nrf24l01_W_TX_PAYLOAD 0xA0 00132 #define nrf24l01_FLUSH_TX 0xE1 00133 #define nrf24l01_FLUSH_RX 0xE2 00134 #define nrf24l01_REUSE_TX_PL 0xE3 00135 #define nrf24l01_NOP 0xFF 00136 00137 //SPI command data mask defines 00138 #define nrf24l01_R_REGISTER_DATA 0x1F 00139 #define nrf24l01_W_REGISTER_DATA 0x1F 00140 00141 //////////////////////////////////////////////////////////////////////////////////// 00142 // Register definitions 00143 // 00144 // Below are the defines for each register's address in the 24L01. 00145 //////////////////////////////////////////////////////////////////////////////////// 00146 #define nrf24l01_CONFIG 0x00 00147 #define nrf24l01_EN_AA 0x01 00148 #define nrf24l01_EN_RXADDR 0x02 00149 #define nrf24l01_SETUP_AW 0x03 00150 #define nrf24l01_SETUP_RETR 0x04 00151 #define nrf24l01_RF_CH 0x05 00152 #define nrf24l01_RF_SETUP 0x06 00153 #define nrf24l01_STATUS 0x07 00154 #define nrf24l01_OBSERVE_TX 0x08 00155 #define nrf24l01_CD 0x09 00156 #define nrf24l01_RX_ADDR_P0 0x0A 00157 #define nrf24l01_RX_ADDR_P1 0x0B 00158 #define nrf24l01_RX_ADDR_P2 0x0C 00159 #define nrf24l01_RX_ADDR_P3 0x0D 00160 #define nrf24l01_RX_ADDR_P4 0x0E 00161 #define nrf24l01_RX_ADDR_P5 0x0F 00162 #define nrf24l01_TX_ADDR 0x10 00163 #define nrf24l01_RX_PW_P0 0x11 00164 #define nrf24l01_RX_PW_P1 0x12 00165 #define nrf24l01_RX_PW_P2 0x13 00166 #define nrf24l01_RX_PW_P3 0x14 00167 #define nrf24l01_RX_PW_P4 0x15 00168 #define nrf24l01_RX_PW_P5 0x16 00169 #define nrf24l01_FIFO_STATUS 0x17 00170 00171 //////////////////////////////////////////////////////////////////////////////////// 00172 // Default register values 00173 // 00174 // Below are the defines for each register's default value in the 24L01. Multi-byte 00175 // registers use notation B<X>, where "B" represents "byte" and <X> is the byte 00176 // number. 00177 //////////////////////////////////////////////////////////////////////////////////// 00178 #define nrf24l01_CONFIG_DEFAULT_VAL 0x08 00179 #define nrf24l01_EN_AA_DEFAULT_VAL 0x3F 00180 #define nrf24l01_EN_RXADDR_DEFAULT_VAL 0x03 00181 #define nrf24l01_SETUP_AW_DEFAULT_VAL 0x03 00182 #define nrf24l01_SETUP_RETR_DEFAULT_VAL 0x03 00183 #define nrf24l01_RF_CH_DEFAULT_VAL 0x02 00184 #define nrf24l01_RF_SETUP_DEFAULT_VAL 0x0F 00185 #define nrf24l01_STATUS_DEFAULT_VAL 0x0E 00186 #define nrf24l01_OBSERVE_TX_DEFAULT_VAL 0x00 00187 #define nrf24l01_CD_DEFAULT_VAL 0x00 00188 #define nrf24l01_RX_ADDR_P0_B0_DEFAULT_VAL 0xE7 00189 #define nrf24l01_RX_ADDR_P0_B1_DEFAULT_VAL 0xE7 00190 #define nrf24l01_RX_ADDR_P0_B2_DEFAULT_VAL 0xE7 00191 #define nrf24l01_RX_ADDR_P0_B3_DEFAULT_VAL 0xE7 00192 #define nrf24l01_RX_ADDR_P0_B4_DEFAULT_VAL 0xE7 00193 #define nrf24l01_RX_ADDR_P1_B0_DEFAULT_VAL 0xC2 00194 #define nrf24l01_RX_ADDR_P1_B1_DEFAULT_VAL 0xC2 00195 #define nrf24l01_RX_ADDR_P1_B2_DEFAULT_VAL 0xC2 00196 #define nrf24l01_RX_ADDR_P1_B3_DEFAULT_VAL 0xC2 00197 #define nrf24l01_RX_ADDR_P1_B4_DEFAULT_VAL 0xC2 00198 #define nrf24l01_RX_ADDR_P2_DEFAULT_VAL 0xC3 00199 #define nrf24l01_RX_ADDR_P3_DEFAULT_VAL 0xC4 00200 #define nrf24l01_RX_ADDR_P4_DEFAULT_VAL 0xC5 00201 #define nrf24l01_RX_ADDR_P5_DEFAULT_VAL 0xC6 00202 #define nrf24l01_TX_ADDR_B0_DEFAULT_VAL 0xE7 00203 #define nrf24l01_TX_ADDR_B1_DEFAULT_VAL 0xE7 00204 #define nrf24l01_TX_ADDR_B2_DEFAULT_VAL 0xE7 00205 #define nrf24l01_TX_ADDR_B3_DEFAULT_VAL 0xE7 00206 #define nrf24l01_TX_ADDR_B4_DEFAULT_VAL 0xE7 00207 #define nrf24l01_RX_PW_P0_DEFAULT_VAL 0x00 00208 #define nrf24l01_RX_PW_P1_DEFAULT_VAL 0x00 00209 #define nrf24l01_RX_PW_P2_DEFAULT_VAL 0x00 00210 #define nrf24l01_RX_PW_P3_DEFAULT_VAL 0x00 00211 #define nrf24l01_RX_PW_P4_DEFAULT_VAL 0x00 00212 #define nrf24l01_RX_PW_P5_DEFAULT_VAL 0x00 00213 #define nrf24l01_FIFO_STATUS_DEFAULT_VAL 0x11 00214 00215 //////////////////////////////////////////////////////////////////////////////////// 00216 // Register bitwise definitions 00217 // 00218 // Below are the defines for each register's bitwise fields in the 24L01. 00219 //////////////////////////////////////////////////////////////////////////////////// 00220 //CONFIG register bitwise definitions 00221 #define nrf24l01_CONFIG_RESERVED 0x80 00222 #define nrf24l01_CONFIG_MASK_RX_DR 0x40 00223 #define nrf24l01_CONFIG_MASK_TX_DS 0x20 00224 #define nrf24l01_CONFIG_MASK_MAX_RT 0x10 00225 #define nrf24l01_CONFIG_EN_CRC 0x08 00226 #define nrf24l01_CONFIG_CRCO 0x04 00227 #define nrf24l01_CONFIG_PWR_UP 0x02 00228 #define nrf24l01_CONFIG_PRIM_RX 0x01 00229 00230 //EN_AA register bitwise definitions 00231 #define nrf24l01_EN_AA_RESERVED 0xC0 00232 #define nrf24l01_EN_AA_ENAA_ALL 0x3F 00233 #define nrf24l01_EN_AA_ENAA_P5 0x20 00234 #define nrf24l01_EN_AA_ENAA_P4 0x10 00235 #define nrf24l01_EN_AA_ENAA_P3 0x08 00236 #define nrf24l01_EN_AA_ENAA_P2 0x04 00237 #define nrf24l01_EN_AA_ENAA_P1 0x02 00238 #define nrf24l01_EN_AA_ENAA_P0 0x01 00239 #define nrf24l01_EN_AA_ENAA_NONE 0x00 00240 00241 //EN_RXADDR register bitwise definitions 00242 #define nrf24l01_EN_RXADDR_RESERVED 0xC0 00243 #define nrf24l01_EN_RXADDR_ERX_ALL 0x3F 00244 #define nrf24l01_EN_RXADDR_ERX_P5 0x20 00245 #define nrf24l01_EN_RXADDR_ERX_P4 0x10 00246 #define nrf24l01_EN_RXADDR_ERX_P3 0x08 00247 #define nrf24l01_EN_RXADDR_ERX_P2 0x04 00248 #define nrf24l01_EN_RXADDR_ERX_P1 0x02 00249 #define nrf24l01_EN_RXADDR_ERX_P0 0x01 00250 #define nrf24l01_EN_RXADDR_ERX_NONE 0x00 00251 00252 //SETUP_AW register bitwise definitions 00253 #define nrf24l01_SETUP_AW_RESERVED 0xFC 00254 #define nrf24l01_SETUP_AW 0x03 00255 #define nrf24l01_SETUP_AW_5BYTES 0x03 00256 #define nrf24l01_SETUP_AW_4BYTES 0x02 00257 #define nrf24l01_SETUP_AW_3BYTES 0x01 00258 #define nrf24l01_SETUP_AW_ILLEGAL 0x00 00259 00260 //SETUP_RETR register bitwise definitions 00261 #define nrf24l01_SETUP_RETR_ARD 0xF0 00262 #define nrf24l01_SETUP_RETR_ARD_4000 0xF0 00263 #define nrf24l01_SETUP_RETR_ARD_3750 0xE0 00264 #define nrf24l01_SETUP_RETR_ARD_3500 0xD0 00265 #define nrf24l01_SETUP_RETR_ARD_3250 0xC0 00266 #define nrf24l01_SETUP_RETR_ARD_3000 0xB0 00267 #define nrf24l01_SETUP_RETR_ARD_2750 0xA0 00268 #define nrf24l01_SETUP_RETR_ARD_2500 0x90 00269 #define nrf24l01_SETUP_RETR_ARD_2250 0x80 00270 #define nrf24l01_SETUP_RETR_ARD_2000 0x70 00271 #define nrf24l01_SETUP_RETR_ARD_1750 0x60 00272 #define nrf24l01_SETUP_RETR_ARD_1500 0x50 00273 #define nrf24l01_SETUP_RETR_ARD_1250 0x40 00274 #define nrf24l01_SETUP_RETR_ARD_1000 0x30 00275 #define nrf24l01_SETUP_RETR_ARD_750 0x20 00276 #define nrf24l01_SETUP_RETR_ARD_500 0x10 00277 #define nrf24l01_SETUP_RETR_ARD_250 0x00 00278 #define nrf24l01_SETUP_RETR_ARC 0x0F 00279 #define nrf24l01_SETUP_RETR_ARC_15 0x0F 00280 #define nrf24l01_SETUP_RETR_ARC_14 0x0E 00281 #define nrf24l01_SETUP_RETR_ARC_13 0x0D 00282 #define nrf24l01_SETUP_RETR_ARC_12 0x0C 00283 #define nrf24l01_SETUP_RETR_ARC_11 0x0B 00284 #define nrf24l01_SETUP_RETR_ARC_10 0x0A 00285 #define nrf24l01_SETUP_RETR_ARC_9 0x09 00286 #define nrf24l01_SETUP_RETR_ARC_8 0x08 00287 #define nrf24l01_SETUP_RETR_ARC_7 0x07 00288 #define nrf24l01_SETUP_RETR_ARC_6 0x06 00289 #define nrf24l01_SETUP_RETR_ARC_5 0x05 00290 #define nrf24l01_SETUP_RETR_ARC_4 0x04 00291 #define nrf24l01_SETUP_RETR_ARC_3 0x03 00292 #define nrf24l01_SETUP_RETR_ARC_2 0x02 00293 #define nrf24l01_SETUP_RETR_ARC_1 0x01 00294 #define nrf24l01_SETUP_RETR_ARC_0 0x00 00295 00296 //RF_CH register bitwise definitions 00297 #define nrf24l01_RF_CH_RESERVED 0x80 00298 00299 //RF_SETUP register bitwise definitions 00300 #define nrf24l01_RF_SETUP_RESERVED 0xE0 00301 #define nrf24l01_RF_SETUP_PLL_LOCK 0x10 00302 #define nrf24l01_RF_SETUP_RF_DR 0x08 00303 #define nrf24l01_RF_SETUP_RF_PWR 0x06 00304 #define nrf24l01_RF_SETUP_RF_PWR_0 0x06 00305 #define nrf24l01_RF_SETUP_RF_PWR_6 0x04 00306 #define nrf24l01_RF_SETUP_RF_PWR_12 0x02 00307 #define nrf24l01_RF_SETUP_RF_PWR_18 0x00 00308 #define nrf24l01_RF_SETUP_LNA_HCURR 0x01 00309 00310 //STATUS register bitwise definitions 00311 #define nrf24l01_STATUS_RESERVED 0x80 00312 #define nrf24l01_STATUS_RX_DR 0x40 00313 #define nrf24l01_STATUS_TX_DS 0x20 00314 #define nrf24l01_STATUS_MAX_RT 0x10 00315 #define nrf24l01_STATUS_RX_P_NO 0x0E 00316 #define nrf24l01_STATUS_RX_P_NO_RX_FIFO_NOT_EMPTY 0x0E 00317 #define nrf24l01_STATUS_RX_P_NO_UNUSED 0x0C 00318 #define nrf24l01_STATUS_RX_P_NO_5 0x0A 00319 #define nrf24l01_STATUS_RX_P_NO_4 0x08 00320 #define nrf24l01_STATUS_RX_P_NO_3 0x06 00321 #define nrf24l01_STATUS_RX_P_NO_2 0x04 00322 #define nrf24l01_STATUS_RX_P_NO_1 0x02 00323 #define nrf24l01_STATUS_RX_P_NO_0 0x00 00324 #define nrf24l01_STATUS_TX_FULL 0x01 00325 00326 //OBSERVE_TX register bitwise definitions 00327 #define nrf24l01_OBSERVE_TX_PLOS_CNT 0xF0 00328 #define nrf24l01_OBSERVE_TX_ARC_CNT 0x0F 00329 00330 //CD register bitwise definitions 00331 #define nrf24l01_CD_RESERVED 0xFE 00332 #define nrf24l01_CD_CD 0x01 00333 00334 //RX_PW_P0 register bitwise definitions 00335 #define nrf24l01_RX_PW_P0_RESERVED 0xC0 00336 00337 //RX_PW_P0 register bitwise definitions 00338 #define nrf24l01_RX_PW_P0_RESERVED 0xC0 00339 00340 //RX_PW_P1 register bitwise definitions 00341 #define nrf24l01_RX_PW_P1_RESERVED 0xC0 00342 00343 //RX_PW_P2 register bitwise definitions 00344 #define nrf24l01_RX_PW_P2_RESERVED 0xC0 00345 00346 //RX_PW_P3 register bitwise definitions 00347 #define nrf24l01_RX_PW_P3_RESERVED 0xC0 00348 00349 //RX_PW_P4 register bitwise definitions 00350 #define nrf24l01_RX_PW_P4_RESERVED 0xC0 00351 00352 //RX_PW_P5 register bitwise definitions 00353 #define nrf24l01_RX_PW_P5_RESERVED 0xC0 00354 00355 //FIFO_STATUS register bitwise definitions 00356 #define nrf24l01_FIFO_STATUS_RESERVED 0x8C 00357 #define nrf24l01_FIFO_STATUS_TX_REUSE 0x40 00358 #define nrf24l01_FIFO_STATUS_TX_FULL 0x20 00359 #define nrf24l01_FIFO_STATUS_TX_EMPTY 0x10 00360 #define nrf24l01_FIFO_STATUS_RX_FULL 0x02 00361 #define nrf24l01_FIFO_STATUS_RX_EMPTY 0x01 00362 00363 //////////////////////////////////////////////////////////////////////////////////// 00364 // Function declarations 00365 // 00366 // Below are all function definitions contained in the library. Please see 00367 // nrf24l01.c for comments regarding the usage of each function. 00368 //////////////////////////////////////////////////////////////////////////////////// 00369 //initialization functions 00370 void nrf24l01_initialize(unsigned char config, 00371 unsigned char opt_rx_standby_mode, 00372 unsigned char en_aa, 00373 unsigned char en_rxaddr, 00374 unsigned char setup_aw, 00375 unsigned char setup_retr, 00376 unsigned char rf_ch, 00377 unsigned char rf_setup, 00378 unsigned char * rx_addr_p0, 00379 unsigned char * rx_addr_p1, 00380 unsigned char rx_addr_p2, 00381 unsigned char rx_addr_p3, 00382 unsigned char rx_addr_p4, 00383 unsigned char rx_addr_p5, 00384 unsigned char * tx_addr, 00385 unsigned char rx_pw_p0, 00386 unsigned char rx_pw_p1, 00387 unsigned char rx_pw_p2, 00388 unsigned char rx_pw_p3, 00389 unsigned char rx_pw_p4, 00390 unsigned char rx_pw_p5); 00391 void nrf24l01_initialize_debug(bool rx, unsigned char p0_payload_width, bool enable_auto_ack); 00392 void nrf24l01_initialize_debug_lite(bool rx, unsigned char p0_payload_width); 00393 00394 //power-up, power-down functions 00395 void nrf24l01_power_up(bool rx_active_mode); 00396 void nrf24l01_power_up_param(bool rx_active_mode, unsigned char config); 00397 void nrf24l01_power_down(void); 00398 void nrf24l01_power_down_param(unsigned char config); 00399 00400 //SPI commands defined by the spec 00401 //for regnumber values, see section above titled "register definitions" 00402 //all functions return the STATUS register 00403 unsigned char nrf24l01_write_register(unsigned char regnumber, unsigned char * data, unsigned int len); 00404 unsigned char nrf24l01_read_register(unsigned char regnumber, unsigned char * data, unsigned int len); 00405 unsigned char nrf24l01_write_tx_payload(unsigned char * data, unsigned int len, bool transmit); 00406 unsigned char nrf24l01_read_rx_payload(unsigned char * data, unsigned int len); 00407 unsigned char nrf24l01_flush_tx(void); 00408 unsigned char nrf24l01_flush_rx(void); 00409 unsigned char nrf24l01_reuse_tx_pl(void); 00410 unsigned char nrf24l01_nop(void); 00411 00412 //RX/TX setting functions 00413 void nrf24l01_set_as_rx(bool rx_active_mode); 00414 void nrf24l01_set_as_rx_param(bool rx_active_mode, unsigned char config); 00415 void nrf24l01_rx_standby_to_active(void); 00416 void nrf24l01_rx_active_to_standby(void); 00417 void nrf24l01_set_as_tx(void); 00418 void nrf24l01_set_as_tx_param(unsigned char config); 00419 00420 //register-oriented get/set functions for commonly-used registers during operation 00421 unsigned char nrf24l01_get_config(void); 00422 void nrf24l01_set_config(unsigned char config); 00423 unsigned char nrf24l01_get_rf_ch(void); 00424 void nrf24l01_set_rf_ch(unsigned char channel); 00425 unsigned char nrf24l01_get_status(void); 00426 unsigned char nrf24l01_get_observe_tx(void); 00427 void nrf24l01_set_rx_addr(unsigned char * address, unsigned int len, unsigned char rxpipenum); 00428 void nrf24l01_set_tx_addr(unsigned char * address, unsigned int len); 00429 void nrf24l01_set_rx_pw(unsigned char payloadwidth, unsigned char rxpipenum); 00430 unsigned char nrf24l01_get_rx_pw(unsigned char rxpipenum); 00431 unsigned char nrf24l01_get_fifo_status(void); 00432 00433 //auto-ack and pipe-related functions 00434 bool nrf24l01_aa_enabled(unsigned char rxpipenum); 00435 void nrf24l01_aa_enable(unsigned char rxpipenum); 00436 void nrf24l01_aa_disable(unsigned char rxpipenum); 00437 bool nrf24l01_rx_pipe_enabled(unsigned char rxpipenum); 00438 void nrf24l01_rx_pipe_enable(unsigned char rxpipenum); 00439 void nrf24l01_rx_pipe_disable(unsigned char rxpipenum); 00440 unsigned char nrf24l01_get_plos_cnt(void); 00441 void nrf24l01_clear_plos_cnt(void); 00442 void nrf24l01_clear_plos_cnt_param(unsigned char rf_ch); 00443 unsigned char nrf24l01_get_arc_cnt(void); 00444 00445 //utility functions 00446 bool nrf24l01_cd_active(void); 00447 void nrf24l01_clear_flush(void); 00448 unsigned char nrf24l01_get_rx_pipe(void); 00449 unsigned char nrf24l01_get_rx_pipe_from_status(unsigned char status); 00450 void nrf24l01_get_all_registers(unsigned char * data); 00451 00452 //interrupt check/clear functions 00453 bool nrf24l01_irq_pin_active(void); 00454 bool nrf24l01_irq_rx_dr_active(void); 00455 bool nrf24l01_irq_tx_ds_active(void); 00456 bool nrf24l01_irq_max_rt_active(void); 00457 void nrf24l01_irq_clear_all(void); 00458 void nrf24l01_irq_clear_rx_dr(void); 00459 void nrf24l01_irq_clear_tx_ds(void); 00460 void nrf24l01_irq_clear_max_rt(void); 00461 00462 //FIFO_STATUS check functions 00463 bool nrf24l01_fifo_tx_reuse(void); 00464 bool nrf24l01_fifo_tx_full(void); 00465 bool nrf24l01_fifo_tx_empty(void); 00466 bool nrf24l01_fifo_rx_full(void); 00467 bool nrf24l01_fifo_rx_empty(void); 00468 00469 //IO interface-related functions 00470 void nrf24l01_transmit(void); 00471 void nrf24l01_clear_ce(void); 00472 void nrf24l01_set_ce(void); 00473 void nrf24l01_clear_csn(void); 00474 void nrf24l01_set_csn(void); 00475 bool nrf24l01_ce_pin_active(void); 00476 bool nrf24l01_csn_pin_active(void); 00477 00478 //low-level functions for library use only 00479 unsigned char nrf24l01_execute_command(unsigned char instruction, unsigned char * data, unsigned int len, bool copydata); 00480 void nrf24l01_spi_send_read(unsigned char * data, unsigned int len, bool copydata); 00481 00482 #endif /*NRF24L01_H_*/
Generated on Tue Jul 12 2022 18:14:07 by
1.7.2