BME SmartLab / RF24

Dependents:   BabaTalp-NRF

Fork of RF24_fork by Marcell Rausch

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RF24.h Source File

RF24.h

Go to the documentation of this file.
00001 /*
00002  Copyright (C) 2011 J. Coliz <maniacbug@ymail.com>
00003 
00004  This program is free software; you can redistribute it and/or
00005  modify it under the terms of the GNU General Public License
00006  version 2 as published by the Free Software Foundation.
00007  */
00008 
00009 /**
00010  * @file RF24.h
00011  *
00012  * Class declaration for RF24 and helper enums
00013  */
00014  
00015 /*
00016  * Mbed support added by Akash Vibhute <akash.roboticist@gmail.com>
00017  * Porting completed on Nov/05/2015
00018  *
00019  * Updated 1: Synced with TMRh20's RF24 library on Nov/04/2015 from https://github.com/TMRh20
00020  * Updated 2: Synced with TMRh20's RF24 library on Apr/18/2015 from https://github.com/TMRh20
00021  *
00022  */
00023  
00024 #ifndef __RF24_H__
00025 #define __RF24_H__
00026 
00027 #include "RF24_config.h"
00028 #include <mbed.h>
00029 
00030 
00031 
00032 
00033 /**
00034  * Power Amplifier level.
00035  *
00036  * For use with setPALevel()
00037  */
00038 typedef enum { RF24_PA_MIN = 0,RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX, RF24_PA_ERROR } rf24_pa_dbm_e ;
00039 
00040 /**
00041  * Data rate.  How fast data moves through the air.
00042  *
00043  * For use with setDataRate()
00044  */
00045 typedef enum { RF24_1MBPS = 0, RF24_2MBPS, RF24_250KBPS } rf24_datarate_e;
00046 
00047 /**
00048  * CRC Length.  How big (if any) of a CRC is included.
00049  *
00050  * For use with setCRCLength()
00051  */
00052 typedef enum { RF24_CRC_DISABLED = 0, RF24_CRC_8, RF24_CRC_16 } rf24_crclength_e;
00053 
00054 /**
00055  * Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
00056  */
00057 
00058 class RF24
00059 {
00060 private:
00061 
00062   SPI spi;
00063   DigitalOut ce_pin; /**< "Chip Enable" pin, activates the RX or TX role */
00064   DigitalOut csn_pin; /**< SPI Chip select */
00065   uint16_t spi_speed; /**< SPI Bus Speed */
00066     
00067   Timer mainTimer;
00068   
00069   bool p_variant; /* False for RF24L01 and true for RF24L01P */
00070   uint8_t payload_size; /**< Fixed size of payloads */
00071   bool dynamic_payloads_enabled; /**< Whether dynamic payloads are enabled. */
00072   uint8_t pipe0_reading_address[5]; /**< Last address set on pipe 0 for reading. */
00073   uint8_t addr_width; /**< The address width to use - 3,4 or 5 bytes. */
00074   uint32_t txRxDelay; /**< Var for adjusting delays depending on datarate */
00075 
00076 protected:
00077   /**
00078    * SPI transactions
00079    *
00080    * Common code for SPI transactions including CSN toggle
00081    *
00082    */
00083   inline void beginTransaction();
00084 
00085   inline void endTransaction();
00086 
00087 public:
00088 
00089   /**
00090    * @name Primary public interface
00091    *
00092    *  These are the main methods you need to operate the chip
00093    */
00094   /**@{*/
00095 
00096   /**
00097    * Arduino Constructor
00098    *
00099    * Creates a new instance of this driver.  Before using, you create an instance
00100    * and send in the unique pins that this chip is connected to.
00101    *
00102    * @param _cepin The pin attached to Chip Enable on the RF module
00103    * @param _cspin The pin attached to Chip Select
00104    */
00105   RF24(PinName mosi, PinName miso, PinName sck, PinName _cepin, PinName _csnpin);
00106 
00107   
00108     
00109     
00110     
00111     
00112     
00113     
00114     
00115     
00116     
00117     
00118     
00119     
00120     
00121     
00122     
00123     
00124     
00125 
00126   /**
00127    * Begin operation of the chip
00128    * 
00129    * Call this in setup(), before calling any other methods.
00130    * @code radio.begin() @endcode
00131    */
00132   bool begin(void);
00133 
00134   /**
00135    * Start listening on the pipes opened for reading.
00136    *
00137    * 1. Be sure to call openReadingPipe() first.  
00138    * 2. Do not call write() while in this mode, without first calling stopListening().
00139    * 3. Call available() to check for incoming traffic, and read() to get it. 
00140    *  
00141    * @code
00142    * Open reading pipe 1 using address CCCECCCECC
00143    *  
00144    * byte address[] = { 0xCC,0xCE,0xCC,0xCE,0xCC };
00145    * radio.openReadingPipe(1,address);
00146    * radio.startListening();
00147    * @endcode
00148    */
00149   void startListening(void);
00150 
00151   /**
00152    * Stop listening for incoming messages, and switch to transmit mode.
00153    *
00154    * Do this before calling write().
00155    * @code
00156    * radio.stopListening();
00157    * radio.write(&data,sizeof(data));
00158    * @endcode
00159    */
00160   void stopListening(void);
00161 
00162   /**
00163    * Check whether there are bytes available to be read
00164    * @code
00165    * if(radio.available()){
00166    *   radio.read(&data,sizeof(data));
00167    * }
00168    * @endcode
00169    * @return True if there is a payload available, false if none is
00170    */
00171   bool available(void);
00172 
00173   /**
00174    * Read the available payload
00175    *
00176    * The size of data read is the fixed payload size, see getPayloadSize()
00177    *
00178    * @note I specifically chose 'void*' as a data type to make it easier
00179    * for beginners to use.  No casting needed.
00180    *
00181    * @note No longer boolean. Use available to determine if packets are
00182    * available. Interrupt flags are now cleared during reads instead of
00183    * when calling available().
00184    *
00185    * @param buf Pointer to a buffer where the data should be written
00186    * @param len Maximum number of bytes to read into the buffer
00187    *
00188    * @code
00189    * if(radio.available()){
00190    *   radio.read(&data,sizeof(data));
00191    * }
00192    * @endcode
00193    * @return No return value. Use available().
00194    */
00195   void read( void* buf, uint8_t len );
00196 
00197   /**
00198    * Be sure to call openWritingPipe() first to set the destination
00199    * of where to write to.
00200    *
00201    * This blocks until the message is successfully acknowledged by
00202    * the receiver or the timeout/retransmit maxima are reached.  In
00203    * the current configuration, the max delay here is 60-70ms.
00204    *
00205    * The maximum size of data written is the fixed payload size, see
00206    * getPayloadSize().  However, you can write less, and the remainder
00207    * will just be filled with zeroes.
00208    *
00209    * TX/RX/RT interrupt flags will be cleared every time write is called
00210    *
00211    * @param buf Pointer to the data to be sent
00212    * @param len Number of bytes to be sent
00213    *
00214    * @code
00215    * radio.stopListening();
00216    * radio.write(&data,sizeof(data));
00217    * @endcode
00218    * @return True if the payload was delivered successfully false if not
00219    */
00220   bool write( const void* buf, uint8_t len );
00221 
00222   /**
00223    * New: Open a pipe for writing via byte array. Old addressing format retained
00224    * for compatibility.
00225    *
00226    * Only one writing pipe can be open at once, but you can change the address
00227    * you'll write to. Call stopListening() first.
00228    *
00229    * Addresses are assigned via a byte array, default is 5 byte address length
00230 s   *
00231    * @code
00232    *   uint8_t addresses[][6] = {"1Node","2Node"};
00233    *   radio.openWritingPipe(addresses[0]);
00234    * @endcode
00235    * @code
00236    *  uint8_t address[] = { 0xCC,0xCE,0xCC,0xCE,0xCC };
00237    *  radio.openWritingPipe(address);
00238    *  address[0] = 0x33;
00239    *  radio.openReadingPipe(1,address);
00240    * @endcode
00241    * @see setAddressWidth
00242    *
00243    * @param address The address of the pipe to open. Coordinate these pipe
00244    * addresses amongst nodes on the network.
00245    */
00246 
00247   void openWritingPipe(const uint8_t *address);
00248 
00249   /**
00250    * Open a pipe for reading
00251    *
00252    * Up to 6 pipes can be open for reading at once.  Open all the required
00253    * reading pipes, and then call startListening().
00254    *
00255    * @see openWritingPipe
00256    * @see setAddressWidth
00257    *
00258    * @note Pipes 0 and 1 will store a full 5-byte address. Pipes 2-5 will technically 
00259    * only store a single byte, borrowing up to 4 additional bytes from pipe #1 per the
00260    * assigned address width.
00261    * @warning Pipes 1-5 should share the same address, except the first byte.
00262    * Only the first byte in the array should be unique, e.g.
00263    * @code
00264    *   uint8_t addresses[][6] = {"1Node","2Node"};
00265    *   openReadingPipe(1,addresses[0]);
00266    *   openReadingPipe(2,addresses[1]);
00267    * @endcode
00268    *
00269    * @warning Pipe 0 is also used by the writing pipe.  So if you open
00270    * pipe 0 for reading, and then startListening(), it will overwrite the
00271    * writing pipe.  Ergo, do an openWritingPipe() again before write().
00272    *
00273    * @param number Which pipe# to open, 0-5.
00274    * @param address The 24, 32 or 40 bit address of the pipe to open.
00275    */
00276 
00277   void openReadingPipe(uint8_t number, const uint8_t *address);
00278 
00279    /**@}*/
00280   /**
00281    * @name Advanced Operation
00282    *
00283    *  Methods you can use to drive the chip in more advanced ways
00284    */
00285   /**@{*/
00286 
00287   /**
00288    * Print a giant block of debugging information to stdout
00289    *
00290    * @warning Does nothing if stdout is not defined.  See fdevopen in stdio.h
00291    * The printf.h file is included with the library for Arduino.
00292    * @code
00293    * #include <printf.h>
00294    * setup(){
00295    *  Serial.begin(115200);
00296    *  printf_begin();
00297    *  ...
00298    * }
00299    * @endcode
00300    */
00301   void printDetails(void);
00302 
00303   /**
00304    * Test whether there are bytes available to be read in the
00305    * FIFO buffers. 
00306    *
00307    * @param[out] pipe_num Which pipe has the payload available
00308    *  
00309    * @code
00310    * uint8_t pipeNum;
00311    * if(radio.available(&pipeNum)){
00312    *   radio.read(&data,sizeof(data));
00313    *   Serial.print("Got data on pipe");
00314    *   Serial.println(pipeNum);
00315    * }
00316    * @endcode
00317    * @return True if there is a payload available, false if none is
00318    */
00319   bool available(uint8_t* pipe_num);
00320 
00321   /**
00322    * Check if the radio needs to be read. Can be used to prevent data loss
00323    * @return True if all three 32-byte radio buffers are full
00324    */
00325   bool rxFifoFull();
00326 
00327   /**
00328    * Enter low-power mode
00329    *
00330    * To return to normal power mode, call powerUp().
00331    *
00332    * @note After calling startListening(), a basic radio will consume about 13.5mA
00333    * at max PA level.
00334    * During active transmission, the radio will consume about 11.5mA, but this will
00335    * be reduced to 26uA (.026mA) between sending.
00336    * In full powerDown mode, the radio will consume approximately 900nA (.0009mA)   
00337    *
00338    * @code
00339    * radio.powerDown();
00340    * avr_enter_sleep_mode(); // Custom function to sleep the device
00341    * radio.powerUp();
00342    * @endcode
00343    */
00344   void powerDown(void);
00345 
00346   /**
00347    * Leave low-power mode - required for normal radio operation after calling powerDown()
00348    * 
00349    * To return to low power mode, call powerDown().
00350    * @note This will take up to 5ms for maximum compatibility 
00351    */
00352   void powerUp(void) ;
00353 
00354   /**
00355   * Write for single NOACK writes. Optionally disables acknowledgements/autoretries for a single write.
00356   *
00357   * @note enableDynamicAck() must be called to enable this feature
00358   *
00359   * Can be used with enableAckPayload() to request a response
00360   * @see enableDynamicAck()
00361   * @see setAutoAck()
00362   * @see write()
00363   *
00364   * @param buf Pointer to the data to be sent
00365   * @param len Number of bytes to be sent
00366   * @param multicast Request ACK (0), NOACK (1)
00367   */
00368   bool write( const void* buf, uint8_t len, const bool multicast );
00369 
00370   /**
00371    * This will not block until the 3 FIFO buffers are filled with data.
00372    * Once the FIFOs are full, writeFast will simply wait for success or
00373    * timeout, and return 1 or 0 respectively. From a user perspective, just
00374    * keep trying to send the same data. The library will keep auto retrying
00375    * the current payload using the built in functionality.
00376    * @warning It is important to never keep the nRF24L01 in TX mode and FIFO full for more than 4ms at a time. If the auto
00377    * retransmit is enabled, the nRF24L01 is never in TX mode long enough to disobey this rule. Allow the FIFO
00378    * to clear by issuing txStandBy() or ensure appropriate time between transmissions.
00379    *
00380    * @code
00381    * Example (Partial blocking):
00382    *
00383    *            radio.writeFast(&buf,32);  // Writes 1 payload to the buffers
00384    *            txStandBy();               // Returns 0 if failed. 1 if success. Blocks only until MAX_RT timeout or success. Data flushed on fail.
00385    *
00386    *            radio.writeFast(&buf,32);  // Writes 1 payload to the buffers
00387    *            txStandBy(1000);           // Using extended timeouts, returns 1 if success. Retries failed payloads for 1 seconds before returning 0.
00388    * @endcode
00389    *
00390    * @see txStandBy()
00391    * @see write()
00392    * @see writeBlocking()
00393    *
00394    * @param buf Pointer to the data to be sent
00395    * @param len Number of bytes to be sent
00396    * @return True if the payload was delivered successfully false if not
00397    */
00398   bool writeFast( const void* buf, uint8_t len );
00399 
00400   /**
00401   * WriteFast for single NOACK writes. Disables acknowledgements/autoretries for a single write.
00402   *
00403   * @note enableDynamicAck() must be called to enable this feature
00404   * @see enableDynamicAck()
00405   * @see setAutoAck()
00406   *
00407   * @param buf Pointer to the data to be sent
00408   * @param len Number of bytes to be sent
00409   * @param multicast Request ACK (0) or NOACK (1)
00410   */
00411   bool writeFast( const void* buf, uint8_t len, const bool multicast );
00412 
00413   /**
00414    * This function extends the auto-retry mechanism to any specified duration.
00415    * It will not block until the 3 FIFO buffers are filled with data.
00416    * If so the library will auto retry until a new payload is written
00417    * or the user specified timeout period is reached.
00418    * @warning It is important to never keep the nRF24L01 in TX mode and FIFO full for more than 4ms at a time. If the auto
00419    * retransmit is enabled, the nRF24L01 is never in TX mode long enough to disobey this rule. Allow the FIFO
00420    * to clear by issuing txStandBy() or ensure appropriate time between transmissions.
00421    *
00422    * @code
00423    * Example (Full blocking):
00424    *
00425    *            radio.writeBlocking(&buf,32,1000); //Wait up to 1 second to write 1 payload to the buffers
00426    *            txStandBy(1000);                   //Wait up to 1 second for the payload to send. Return 1 if ok, 0 if failed.
00427    *                                               //Blocks only until user timeout or success. Data flushed on fail.
00428    * @endcode
00429    * @note If used from within an interrupt, the interrupt should be disabled until completion, and sei(); called to enable millis().
00430    * @see txStandBy()
00431    * @see write()
00432    * @see writeFast()
00433    *
00434    * @param buf Pointer to the data to be sent
00435    * @param len Number of bytes to be sent
00436    * @param timeout User defined timeout in milliseconds.
00437    * @return True if the payload was loaded into the buffer successfully false if not
00438    */
00439   bool writeBlocking( const void* buf, uint8_t len, uint32_t timeout );
00440 
00441   /**
00442    * This function should be called as soon as transmission is finished to
00443    * drop the radio back to STANDBY-I mode. If not issued, the radio will
00444    * remain in STANDBY-II mode which, per the data sheet, is not a recommended
00445    * operating mode.
00446    *
00447    * @note When transmitting data in rapid succession, it is still recommended by
00448    * the manufacturer to drop the radio out of TX or STANDBY-II mode if there is
00449    * time enough between sends for the FIFOs to empty. This is not required if auto-ack
00450    * is enabled.
00451    *
00452    * Relies on built-in auto retry functionality.
00453    *
00454    * @code
00455    * Example (Partial blocking):
00456    *
00457    *            radio.writeFast(&buf,32);
00458    *            radio.writeFast(&buf,32);
00459    *            radio.writeFast(&buf,32);  //Fills the FIFO buffers up
00460    *            bool ok = txStandBy();     //Returns 0 if failed. 1 if success.
00461    *                                       //Blocks only until MAX_RT timeout or success. Data flushed on fail.
00462    * @endcode
00463    * @see txStandBy(unsigned long timeout)
00464    * @return True if transmission is successful
00465    *
00466    */
00467    bool txStandBy();
00468 
00469   /**
00470    * This function allows extended blocking and auto-retries per a user defined timeout
00471    * @code
00472    *    Fully Blocking Example:
00473    *
00474    *            radio.writeFast(&buf,32);
00475    *            radio.writeFast(&buf,32);
00476    *            radio.writeFast(&buf,32);   //Fills the FIFO buffers up
00477    *            bool ok = txStandBy(1000);  //Returns 0 if failed after 1 second of retries. 1 if success.
00478    *                                        //Blocks only until user defined timeout or success. Data flushed on fail.
00479    * @endcode
00480    * @note If used from within an interrupt, the interrupt should be disabled until completion, and sei(); called to enable millis().
00481    * @param timeout Number of milliseconds to retry failed payloads
00482    * @return True if transmission is successful
00483    *
00484    */
00485    bool txStandBy(uint32_t timeout, bool startTx = 0);
00486 
00487   /**
00488    * Write an ack payload for the specified pipe
00489    *
00490    * The next time a message is received on @p pipe, the data in @p buf will
00491    * be sent back in the acknowledgement.
00492    * @see enableAckPayload()
00493    * @see enableDynamicPayloads()
00494    * @warning Only three of these can be pending at any time as there are only 3 FIFO buffers.<br> Dynamic payloads must be enabled.
00495    * @note Ack payloads are handled automatically by the radio chip when a payload is received. Users should generally
00496    * write an ack payload as soon as startListening() is called, so one is available when a regular payload is received.
00497    * @note Ack payloads are dynamic payloads. This only works on pipes 0&1 by default. Call 
00498    * enableDynamicPayloads() to enable on all pipes.
00499    *
00500    * @param pipe Which pipe# (typically 1-5) will get this response.
00501    * @param buf Pointer to data that is sent
00502    * @param len Length of the data to send, up to 32 bytes max.  Not affected
00503    * by the static payload set by setPayloadSize().
00504    */
00505   void writeAckPayload(uint8_t pipe, const void* buf, uint8_t len);
00506 
00507   /**
00508    * Determine if an ack payload was received in the most recent call to
00509    * write(). The regular available() can also be used.
00510    *
00511    * Call read() to retrieve the ack payload.
00512    *
00513    * @return True if an ack payload is available.
00514    */
00515   bool isAckPayloadAvailable(void);
00516 
00517   /**
00518    * Call this when you get an interrupt to find out why
00519    *
00520    * Tells you what caused the interrupt, and clears the state of
00521    * interrupts.
00522    *
00523    * @param[out] tx_ok The send was successful (TX_DS)
00524    * @param[out] tx_fail The send failed, too many retries (MAX_RT)
00525    * @param[out] rx_ready There is a message waiting to be read (RX_DS)
00526    */
00527   void whatHappened(bool& tx_ok,bool& tx_fail,bool& rx_ready);
00528 
00529   /**
00530    * Non-blocking write to the open writing pipe used for buffered writes
00531    *
00532    * @note Optimization: This function now leaves the CE pin high, so the radio
00533    * will remain in TX or STANDBY-II Mode until a txStandBy() command is issued. Can be used as an alternative to startWrite()
00534    * if writing multiple payloads at once.
00535    * @warning It is important to never keep the nRF24L01 in TX mode with FIFO full for more than 4ms at a time. If the auto
00536    * retransmit/autoAck is enabled, the nRF24L01 is never in TX mode long enough to disobey this rule. Allow the FIFO
00537    * to clear by issuing txStandBy() or ensure appropriate time between transmissions.
00538    *
00539    * @see write()
00540    * @see writeFast()
00541    * @see startWrite()
00542    * @see writeBlocking()
00543    *
00544    * For single noAck writes see:
00545    * @see enableDynamicAck()
00546    * @see setAutoAck()
00547    *
00548    * @param buf Pointer to the data to be sent
00549    * @param len Number of bytes to be sent
00550    * @param multicast Request ACK (0) or NOACK (1)
00551    * @return True if the payload was delivered successfully false if not
00552    */
00553   void startFastWrite( const void* buf, uint8_t len, const bool multicast, bool startTx = 1 );
00554 
00555   /**
00556    * Non-blocking write to the open writing pipe
00557    *
00558    * Just like write(), but it returns immediately. To find out what happened
00559    * to the send, catch the IRQ and then call whatHappened().
00560    *
00561    * @see write()
00562    * @see writeFast()
00563    * @see startFastWrite()
00564    * @see whatHappened()
00565    *
00566    * For single noAck writes see:
00567    * @see enableDynamicAck()
00568    * @see setAutoAck()
00569    *
00570    * @param buf Pointer to the data to be sent
00571    * @param len Number of bytes to be sent
00572    * @param multicast Request ACK (0) or NOACK (1)
00573    *
00574    */
00575   void startWrite( const void* buf, uint8_t len, const bool multicast );
00576   
00577   /**
00578    * This function is mainly used internally to take advantage of the auto payload
00579    * re-use functionality of the chip, but can be beneficial to users as well.
00580    *
00581    * The function will instruct the radio to re-use the data in the FIFO buffers,
00582    * and instructs the radio to re-send once the timeout limit has been reached.
00583    * Used by writeFast and writeBlocking to initiate retries when a TX failure
00584    * occurs. Retries are automatically initiated except with the standard write().
00585    * This way, data is not flushed from the buffer until switching between modes.
00586    *
00587    * @note This is to be used AFTER auto-retry fails if wanting to resend
00588    * using the built-in payload reuse features.
00589    * After issuing reUseTX(), it will keep reending the same payload forever or until
00590    * a payload is written to the FIFO, or a flush_tx command is given.
00591    */
00592    void reUseTX();
00593 
00594   /**
00595    * Empty the transmit buffer. This is generally not required in standard operation.
00596    * May be required in specific cases after stopListening() , if operating at 250KBPS data rate.
00597    *
00598    * @return Current value of status register
00599    */
00600   uint8_t flush_tx(void);
00601 
00602   /**
00603    * Test whether there was a carrier on the line for the
00604    * previous listening period.
00605    *
00606    * Useful to check for interference on the current channel.
00607    *
00608    * @return true if was carrier, false if not
00609    */
00610   bool testCarrier(void);
00611 
00612   /**
00613    * Test whether a signal (carrier or otherwise) greater than
00614    * or equal to -64dBm is present on the channel. Valid only
00615    * on nRF24L01P (+) hardware. On nRF24L01, use testCarrier().
00616    *
00617    * Useful to check for interference on the current channel and
00618    * channel hopping strategies.
00619    *
00620    * @code
00621    * bool goodSignal = radio.testRPD();
00622    * if(radio.available()){
00623    *    Serial.println(goodSignal ? "Strong signal > 64dBm" : "Weak signal < 64dBm" );
00624    *    radio.read(0,0);
00625    * }
00626    * @endcode
00627    * @return true if signal => -64dBm, false if not
00628    */
00629   bool testRPD(void) ;
00630 
00631   /**
00632    * Test whether this is a real radio, or a mock shim for
00633    * debugging.  Setting either pin to 0xff is the way to
00634    * indicate that this is not a real radio.
00635    *
00636    * @return true if this is a legitimate radio
00637    */
00638   bool isValid() { return ce_pin != 0xff && csn_pin != 0xff; }
00639   
00640    /**
00641    * Close a pipe after it has been previously opened.
00642    * Can be safely called without having previously opened a pipe.
00643    * @param pipe Which pipe # to close, 0-5.
00644    */
00645   void closeReadingPipe( uint8_t pipe ) ;
00646 
00647    /**
00648    * Enable error detection by un-commenting #define FAILURE_HANDLING in RF24_config.h
00649    * If a failure has been detected, it usually indicates a hardware issue. By default the library
00650    * will cease operation when a failure is detected.  
00651    * This should allow advanced users to detect and resolve intermittent hardware issues.  
00652    *   
00653    * In most cases, the radio must be re-enabled via radio.begin(); and the appropriate settings
00654    * applied after a failure occurs, if wanting to re-enable the device immediately.
00655    * 
00656    * Usage: (Failure handling must be enabled per above)
00657    *  @code
00658    *  if(radio.failureDetected){ 
00659    *    radio.begin();                       // Attempt to re-configure the radio with defaults
00660    *    radio.failureDetected = 0;           // Reset the detection value
00661    *    radio.openWritingPipe(addresses[1]); // Re-configure pipe addresses
00662    *    radio.openReadingPipe(1,addresses[0]);
00663    *    report_failure();                    // Blink leds, send a message, etc. to indicate failure
00664    *  }
00665    * @endcode
00666   */
00667   //#if defined (FAILURE_HANDLING)
00668     bool failureDetected; 
00669   //#endif
00670     
00671   /**@}*/
00672 
00673   /**@}*/
00674   /**
00675    * @name Optional Configurators
00676    *
00677    *  Methods you can use to get or set the configuration of the chip.
00678    *  None are required.  Calling begin() sets up a reasonable set of
00679    *  defaults.
00680    */
00681   /**@{*/
00682 
00683   /**
00684   * Set the address width from 3 to 5 bytes (24, 32 or 40 bit)
00685   *
00686   * @param a_width The address width to use: 3,4 or 5
00687   */
00688 
00689   void setAddressWidth(uint8_t a_width);
00690   
00691   /**
00692    * Set the number and delay of retries upon failed submit
00693    *
00694    * @param delay How long to wait between each retry, in multiples of 250us,
00695    * max is 15.  0 means 250us, 15 means 4000us.
00696    * @param count How many retries before giving up, max 15
00697    */
00698   void setRetries(uint8_t delay, uint8_t count);
00699 
00700   /**
00701    * Set RF communication channel
00702    *
00703    * @param channel Which RF channel to communicate on, 0-125
00704    */
00705   void setChannel(uint8_t channel);
00706   
00707     /**
00708    * Get RF communication channel
00709    *
00710    * @return The currently configured RF Channel
00711    */
00712   uint8_t getChannel(void);
00713 
00714   /**
00715    * Set Static Payload Size
00716    *
00717    * This implementation uses a pre-stablished fixed payload size for all
00718    * transmissions.  If this method is never called, the driver will always
00719    * transmit the maximum payload size (32 bytes), no matter how much
00720    * was sent to write().
00721    *
00722    * @todo Implement variable-sized payloads feature
00723    *
00724    * @param size The number of bytes in the payload
00725    */
00726   void setPayloadSize(uint8_t size);
00727 
00728   /**
00729    * Get Static Payload Size
00730    *
00731    * @see setPayloadSize()
00732    *
00733    * @return The number of bytes in the payload
00734    */
00735   uint8_t getPayloadSize(void);
00736 
00737   /**
00738    * Get Dynamic Payload Size
00739    *
00740    * For dynamic payloads, this pulls the size of the payload off
00741    * the chip
00742    *
00743    * @note Corrupt packets are now detected and flushed per the
00744    * manufacturer.
00745    * @code
00746    * if(radio.available()){
00747    *   if(radio.getDynamicPayloadSize() < 1){
00748    *     // Corrupt payload has been flushed
00749    *     return; 
00750    *   }
00751    *   radio.read(&data,sizeof(data));
00752    * }
00753    * @endcode
00754    *
00755    * @return Payload length of last-received dynamic payload
00756    */
00757   uint8_t getDynamicPayloadSize(void);
00758 
00759   /**
00760    * Enable custom payloads on the acknowledge packets
00761    *
00762    * Ack payloads are a handy way to return data back to senders without
00763    * manually changing the radio modes on both units.
00764    *
00765    * @note Ack payloads are dynamic payloads. This only works on pipes 0&1 by default. Call 
00766    * enableDynamicPayloads() to enable on all pipes.
00767    */
00768   void enableAckPayload(void);
00769 
00770   /**
00771    * Enable dynamically-sized payloads
00772    *
00773    * This way you don't always have to send large packets just to send them
00774    * once in a while.  This enables dynamic payloads on ALL pipes.
00775    *
00776    */
00777   void enableDynamicPayloads(void);
00778   
00779   /**
00780    * Enable dynamic ACKs (single write multicast or unicast) for chosen messages
00781    *
00782    * @note To enable full multicast or per-pipe multicast, use setAutoAck()
00783    *
00784    * @warning This MUST be called prior to attempting single write NOACK calls
00785    * @code
00786    * radio.enableDynamicAck();
00787    * radio.write(&data,32,1);  // Sends a payload with no acknowledgement requested
00788    * radio.write(&data,32,0);  // Sends a payload using auto-retry/autoACK
00789    * @endcode
00790    */
00791   void enableDynamicAck();
00792   
00793   /**
00794    * Determine whether the hardware is an nRF24L01+ or not.
00795    *
00796    * @return true if the hardware is nRF24L01+ (or compatible) and false
00797    * if its not.
00798    */
00799   bool isPVariant(void) ;
00800 
00801   /**
00802    * Enable or disable auto-acknowlede packets
00803    *
00804    * This is enabled by default, so it's only needed if you want to turn
00805    * it off for some reason.
00806    *
00807    * @param enable Whether to enable (true) or disable (false) auto-acks
00808    */
00809   void setAutoAck(bool enable);
00810 
00811   /**
00812    * Enable or disable auto-acknowlede packets on a per pipeline basis.
00813    *
00814    * AA is enabled by default, so it's only needed if you want to turn
00815    * it off/on for some reason on a per pipeline basis.
00816    *
00817    * @param pipe Which pipeline to modify
00818    * @param enable Whether to enable (true) or disable (false) auto-acks
00819    */
00820   void setAutoAck( uint8_t pipe, bool enable ) ;
00821 
00822   /**
00823    * Set Power Amplifier (PA) level to one of four levels:
00824    * RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH and RF24_PA_MAX
00825    *
00826    * The power levels correspond to the following output levels respectively:
00827    * NRF24L01: -18dBm, -12dBm,-6dBM, and 0dBm
00828    *
00829    * SI24R1: -6dBm, 0dBm, 3dBM, and 7dBm.
00830    *
00831    * @param level Desired PA level.
00832    */
00833   void setPALevel ( uint8_t level );
00834 
00835   /**
00836    * Fetches the current PA level.
00837    *
00838    * NRF24L01: -18dBm, -12dBm, -6dBm and 0dBm
00839    * SI24R1:   -6dBm, 0dBm, 3dBm, 7dBm
00840    *
00841    * @return Returns values 0 to 3 representing the PA Level.
00842    */
00843    uint8_t getPALevel( void );
00844 
00845   /**
00846    * Set the transmission data rate
00847    *
00848    * @warning setting RF24_250KBPS will fail for non-plus units
00849    *
00850    * @param speed RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
00851    * @return true if the change was successful
00852    */
00853   bool setDataRate(rf24_datarate_e speed);
00854 
00855   /**
00856    * Fetches the transmission data rate
00857    *
00858    * @return Returns the hardware's currently configured datarate. The value
00859    * is one of 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS, as defined in the
00860    * rf24_datarate_e enum.
00861    */
00862   rf24_datarate_e getDataRate( void ) ;
00863 
00864   /**
00865    * Set the CRC length
00866    * <br>CRC checking cannot be disabled if auto-ack is enabled
00867    * @param length RF24_CRC_8 for 8-bit or RF24_CRC_16 for 16-bit
00868    */
00869   void setCRCLength(rf24_crclength_e length);
00870 
00871   /**
00872    * Get the CRC length
00873    * <br>CRC checking cannot be disabled if auto-ack is enabled
00874    * @return RF24_DISABLED if disabled or RF24_CRC_8 for 8-bit or RF24_CRC_16 for 16-bit
00875    */
00876   rf24_crclength_e getCRCLength(void);
00877 
00878   /**
00879    * Disable CRC validation
00880    * 
00881    * @warning CRC cannot be disabled if auto-ack/ESB is enabled.
00882    */
00883   void disableCRC( void ) ;
00884 
00885   /**
00886   * The radio will generate interrupt signals when a transmission is complete,
00887   * a transmission fails, or a payload is received. This allows users to mask
00888   * those interrupts to prevent them from generating a signal on the interrupt
00889   * pin. Interrupts are enabled on the radio chip by default.
00890   *
00891   * @code
00892   *     Mask all interrupts except the receive interrupt:
00893   *
00894   *     radio.maskIRQ(1,1,0);
00895   * @endcode
00896   *
00897   * @param tx_ok  Mask transmission complete interrupts
00898   * @param tx_fail  Mask transmit failure interrupts
00899   * @param rx_ready Mask payload received interrupts
00900   */
00901   void maskIRQ(bool tx_ok,bool tx_fail,bool rx_ready);
00902   
00903   /**@}*/
00904   /**
00905    * @name Deprecated
00906    *
00907    *  Methods provided for backwards compabibility.
00908    */
00909   /**@{*/
00910 
00911 
00912   /**
00913    * Open a pipe for reading
00914    * @note For compatibility with old code only, see new function
00915    *
00916    * @warning Pipes 1-5 should share the first 32 bits.
00917    * Only the least significant byte should be unique, e.g.
00918    * @code
00919    *   openReadingPipe(1,0xF0F0F0F0AA);
00920    *   openReadingPipe(2,0xF0F0F0F066);
00921    * @endcode
00922    *
00923    * @warning Pipe 0 is also used by the writing pipe.  So if you open
00924    * pipe 0 for reading, and then startListening(), it will overwrite the
00925    * writing pipe.  Ergo, do an openWritingPipe() again before write().
00926    *
00927    * @param number Which pipe# to open, 0-5.
00928    * @param address The 40-bit address of the pipe to open.
00929    */
00930   void openReadingPipe(uint8_t number, uint64_t address);
00931 
00932   /**
00933    * Open a pipe for writing
00934    * @note For compatibility with old code only, see new function
00935    *
00936    * Addresses are 40-bit hex values, e.g.:
00937    *
00938    * @code
00939    *   openWritingPipe(0xF0F0F0F0F0);
00940    * @endcode
00941    *
00942    * @param address The 40-bit address of the pipe to open.
00943    */
00944   void openWritingPipe(uint64_t address);
00945 
00946   /**
00947    * Checks if the chip is connected to the SPI bus
00948    */
00949   bool isChipConnected();
00950 
00951 private:
00952 
00953   /**
00954    * @name Low-level internal interface.
00955    *
00956    *  Protected methods that address the chip directly.  Regular users cannot
00957    *  ever call these.  They are documented for completeness and for developers who
00958    *  may want to extend this class.
00959    */
00960   /**@{*/
00961 
00962   /**
00963    * Set chip select pin
00964    *
00965    * Running SPI bus at PI_CLOCK_DIV2 so we don't waste time transferring data
00966    * and best of all, we make use of the radio's FIFO buffers. A lower speed
00967    * means we're less likely to effectively leverage our FIFOs and pay a higher
00968    * AVR runtime cost as toll.
00969    *
00970    * @param mode HIGH to take this unit off the SPI bus, LOW to put it on
00971    */
00972   void csn(bool mode);
00973 
00974   /**
00975    * Set chip enable
00976    *
00977    * @param level HIGH to actively begin transmission or LOW to put in standby.  Please see data sheet
00978    * for a much more detailed description of this pin.
00979    */
00980   void ce(bool level);
00981 
00982   /**
00983    * Read a chunk of data in from a register
00984    *
00985    * @param reg Which register. Use constants from nRF24L01.h
00986    * @param buf Where to put the data
00987    * @param len How many bytes of data to transfer
00988    * @return Current value of status register
00989    */
00990   uint8_t read_register(uint8_t reg, uint8_t* buf, uint8_t len);
00991 
00992   /**
00993    * Read single byte from a register
00994    *
00995    * @param reg Which register. Use constants from nRF24L01.h
00996    * @return Current value of register @p reg
00997    */
00998   uint8_t read_register(uint8_t reg);
00999 
01000   /**
01001    * Write a chunk of data to a register
01002    *
01003    * @param reg Which register. Use constants from nRF24L01.h
01004    * @param buf Where to get the data
01005    * @param len How many bytes of data to transfer
01006    * @return Current value of status register
01007    */
01008   uint8_t write_register(uint8_t reg, const uint8_t* buf, uint8_t len);
01009 
01010   /**
01011    * Write a single byte to a register
01012    *
01013    * @param reg Which register. Use constants from nRF24L01.h
01014    * @param value The new value to write
01015    * @return Current value of status register
01016    */
01017   uint8_t write_register(uint8_t reg, uint8_t value);
01018 
01019   /**
01020    * Write the transmit payload
01021    *
01022    * The size of data written is the fixed payload size, see getPayloadSize()
01023    *
01024    * @param buf Where to get the data
01025    * @param len Number of bytes to be sent
01026    * @return Current value of status register
01027    */
01028   uint8_t write_payload(const void* buf, uint8_t len, const uint8_t writeType);
01029 
01030   /**
01031    * Read the receive payload
01032    *
01033    * The size of data read is the fixed payload size, see getPayloadSize()
01034    *
01035    * @param buf Where to put the data
01036    * @param len Maximum number of bytes to read
01037    * @return Current value of status register
01038    */
01039   uint8_t read_payload(void* buf, uint8_t len);
01040 
01041   /**
01042    * Empty the receive buffer
01043    *
01044    * @return Current value of status register
01045    */
01046   uint8_t flush_rx(void);
01047 
01048   /**
01049    * Retrieve the current status of the chip
01050    *
01051    * @return Current value of status register
01052    */
01053   uint8_t get_status(void);
01054 
01055   #if !defined (MINIMAL)
01056   /**
01057    * Decode and print the given status to stdout
01058    *
01059    * @param status Status value to print
01060    *
01061    * @warning Does nothing if stdout is not defined.  See fdevopen in stdio.h
01062    */
01063   void print_status(uint8_t status);
01064 
01065   /**
01066    * Decode and print the given 'observe_tx' value to stdout
01067    *
01068    * @param value The observe_tx value to print
01069    *
01070    * @warning Does nothing if stdout is not defined.  See fdevopen in stdio.h
01071    */
01072   void print_observe_tx(uint8_t value);
01073 
01074   /**
01075    * Print the name and value of an 8-bit register to stdout
01076    *
01077    * Optionally it can print some quantity of successive
01078    * registers on the same line.  This is useful for printing a group
01079    * of related registers on one line.
01080    *
01081    * @param name Name of the register
01082    * @param reg Which register. Use constants from nRF24L01.h
01083    * @param qty How many successive registers to print
01084    */
01085   void print_byte_register(const char* name, uint8_t reg, uint8_t qty = 1);
01086 
01087   /**
01088    * Print the name and value of a 40-bit address register to stdout
01089    *
01090    * Optionally it can print some quantity of successive
01091    * registers on the same line.  This is useful for printing a group
01092    * of related registers on one line.
01093    *
01094    * @param name Name of the register
01095    * @param reg Which register. Use constants from nRF24L01.h
01096    * @param qty How many successive registers to print
01097    */
01098   void print_address_register(const char* name, uint8_t reg, uint8_t qty = 1);
01099 #endif
01100   /**
01101    * Turn on or off the special features of the chip
01102    *
01103    * The chip has certain 'features' which are only available when the 'features'
01104    * are enabled.  See the datasheet for details.
01105    */
01106   void toggle_features(void);
01107 
01108   /**
01109    * Built in spi transfer function to simplify repeating code repeating code
01110    */
01111 
01112   uint8_t spiTrans(uint8_t cmd);
01113   
01114   #if defined (FAILURE_HANDLING) || defined (RF24_LINUX)
01115     void errNotify(void);
01116   #endif
01117   
01118   /**@}*/
01119 
01120 };
01121 
01122 
01123 /**
01124  * @example GettingStarted.ino
01125  * <b>For Arduino</b><br>
01126  * <b>Updated: TMRh20 2014 </b><br>
01127  *
01128  * This is an example of how to use the RF24 class to communicate on a basic level. Configure and write this sketch to two
01129  * different nodes. Put one of the nodes into 'transmit' mode by connecting with the serial monitor and <br>
01130  * sending a 'T'. The ping node sends the current time to the pong node, which responds by sending the value
01131  * back. The ping node can then see how long the whole cycle took. <br>
01132  * @note For a more efficient call-response scenario see the GettingStarted_CallResponse.ino example.
01133  * @note When switching between sketches, the radio may need to be powered down to clear settings that are not "un-set" otherwise
01134  */
01135 
01136  /**
01137  * @example GettingStarted.cpp
01138  * <b>For Raspberry Pi</b><br>
01139  * <b>Updated: TMRh20 2014 </b><br>
01140  *
01141  * This is an example of how to use the RF24 class to communicate on a basic level. Configure and write this sketch to two
01142  * different nodes. Put one of the nodes into 'transmit' mode by connecting with the serial monitor and <br>
01143  * sending a 'T'. The ping node sends the current time to the pong node, which responds by sending the value
01144  * back. The ping node can then see how long the whole cycle took. <br>
01145  * @note For a more efficient call-response scenario see the GettingStarted_CallResponse.ino example.
01146  */
01147  
01148 /**
01149  * @example GettingStarted_CallResponse.ino
01150  * <b>For Arduino</b><br>
01151  * <b>New: TMRh20 2014</b><br>
01152  *
01153  * This example continues to make use of all the normal functionality of the radios including
01154  * the auto-ack and auto-retry features, but allows ack-payloads to be written optionlly as well. <br>
01155  * This allows very fast call-response communication, with the responding radio never having to
01156  * switch out of Primary Receiver mode to send back a payload, but having the option to switch to <br>
01157  * primary transmitter if wanting to initiate communication instead of respond to a commmunication.
01158  */
01159  
01160  /**
01161  * @example GettingStarted_Call_Response.cpp
01162  * <b>For Raspberry Pi</b><br>
01163  * <b>New: TMRh20 2014</b><br>
01164  *
01165  * This example continues to make use of all the normal functionality of the radios including
01166  * the auto-ack and auto-retry features, but allows ack-payloads to be written optionlly as well. <br>
01167  * This allows very fast call-response communication, with the responding radio never having to
01168  * switch out of Primary Receiver mode to send back a payload, but having the option to switch to <br>
01169  * primary transmitter if wanting to initiate communication instead of respond to a commmunication.
01170  */
01171 
01172  /**
01173  * @example GettingStarted_HandlingData.ino
01174  * <b>Dec 2014 - TMRh20</b><br>
01175  *
01176  * This example demonstrates how to send multiple variables in a single payload and work with data. As usual, it is
01177  * generally important to include an incrementing value like millis() in the payloads to prevent errors.
01178  */
01179  
01180 /**
01181  * @example Transfer.ino
01182  * <b>For Arduino</b><br>
01183  * This example demonstrates half-rate transfer using the FIFO buffers<br>
01184  *
01185  * It is an example of how to use the RF24 class.  Write this sketch to two
01186  * different nodes.  Put one of the nodes into 'transmit' mode by connecting <br>
01187  * with the serial monitor and sending a 'T'.  The data transfer will begin,
01188  * with the receiver displaying the payload count. (32Byte Payloads) <br>
01189  */
01190  
01191  /**
01192  * @example Transfer.cpp
01193  * <b>For Raspberry Pi</b><br>
01194  * This example demonstrates half-rate transfer using the FIFO buffers<br>
01195  *
01196  * It is an example of how to use the RF24 class.  Write this sketch to two
01197  * different nodes.  Put one of the nodes into 'transmit' mode by connecting <br>
01198  * with the serial monitor and sending a 'T'.  The data transfer will begin,
01199  * with the receiver displaying the payload count. (32Byte Payloads) <br>
01200  */
01201 
01202 /**
01203  * @example TransferTimeouts.ino
01204  * <b>New: TMRh20 </b><br>
01205  * This example demonstrates the use of and extended timeout period and
01206  * auto-retries/auto-reUse to increase reliability in noisy or low signal scenarios. <br>
01207  *
01208  * Write this sketch to two different nodes.  Put one of the nodes into 'transmit'
01209  * mode by connecting with the serial monitor and sending a 'T'.  The data <br>
01210  * transfer will begin, with the receiver displaying the payload count and the
01211  * data transfer rate.
01212  */
01213 
01214 /**
01215  * @example starping.pde
01216  *
01217  * This sketch is a more complex example of using the RF24 library for Arduino.
01218  * Deploy this on up to six nodes.  Set one as the 'pong receiver' by tying the
01219  * role_pin low, and the others will be 'ping transmit' units.  The ping units
01220  * unit will send out the value of millis() once a second.  The pong unit will
01221  * respond back with a copy of the value.  Each ping unit can get that response
01222  * back, and determine how long the whole cycle took.
01223  *
01224  * This example requires a bit more complexity to determine which unit is which.
01225  * The pong receiver is identified by having its role_pin tied to ground.
01226  * The ping senders are further differentiated by a byte in eeprom.
01227  */
01228 
01229 /**
01230  * @example pingpair_ack.ino
01231  * <b>Update: TMRh20</b><br>
01232  * This example continues to make use of all the normal functionality of the radios including
01233  * the auto-ack and auto-retry features, but allows ack-payloads to be written optionlly as well.<br>
01234  * This allows very fast call-response communication, with the responding radio never having to
01235  * switch out of Primary Receiver mode to send back a payload, but having the option to if wanting<br>
01236  * to initiate communication instead of respond to a commmunication.
01237  */
01238 
01239 /**
01240  * @example pingpair_irq.ino
01241  * <b>Update: TMRh20</b><br>
01242  * This is an example of how to user interrupts to interact with the radio, and a demonstration
01243  * of how to use them to sleep when receiving, and not miss any payloads.<br>
01244  * The pingpair_sleepy example expands on sleep functionality with a timed sleep option for the transmitter.
01245  * Sleep functionality is built directly into my fork of the RF24Network library<br>
01246  */
01247 
01248  /**
01249  * @example pingpair_irq_simple.ino
01250  * <b>Dec 2014 - TMRh20</b><br>
01251  * This is an example of how to user interrupts to interact with the radio, with bidirectional communication.
01252  */
01253  
01254 /**
01255  * @example pingpair_sleepy.ino
01256  * <b>Update: TMRh20</b><br>
01257  * This is an example of how to use the RF24 class to create a battery-
01258  * efficient system.  It is just like the GettingStarted_CallResponse example, but the<br>
01259  * ping node powers down the radio and sleeps the MCU after every
01260  * ping/pong cycle, and the receiver sleeps between payloads. <br>
01261  */
01262 
01263  /**
01264  * @example rf24ping85.ino
01265  * <b>New: Contributed by https://github.com/tong67</b><br>
01266  * This is an example of how to use the RF24 class to communicate with ATtiny85 and other node. <br>
01267  */
01268  
01269  /**
01270  * @example timingSearch3pin.ino
01271  * <b>New: Contributed by https://github.com/tong67</b><br>
01272  * This is an example of how to determine the correct timing for ATtiny when using only 3-pins
01273  */
01274   
01275 /**
01276  * @example pingpair_dyn.ino
01277  *
01278  * This is an example of how to use payloads of a varying (dynamic) size on Arduino.
01279  */
01280  
01281  /**
01282  * @example pingpair_dyn.cpp
01283  *
01284  * This is an example of how to use payloads of a varying (dynamic) size on Raspberry Pi.
01285  */
01286 
01287 /**
01288  * @example pingpair_dyn.py
01289  *
01290  * This is a python example for RPi of how to use payloads of a varying (dynamic) size.
01291  */ 
01292  
01293 /**
01294  * @example pingpair_dyn.ino
01295  *
01296  * This is an example of how to use payloads of a varying (dynamic) size.
01297  */
01298  
01299  /**
01300  * @example pingpair_dyn.ino
01301  *
01302  * This is an example of how to use payloads of a varying (dynamic) size.
01303  */
01304 
01305 /**
01306  * @example scanner.ino
01307  *
01308  * Example to detect interference on the various channels available.
01309  * This is a good diagnostic tool to check whether you're picking a
01310  * good channel for your application.
01311  *
01312  * Inspired by cpixip.
01313  * See http://arduino.cc/forum/index.php/topic,54795.0.html
01314  */
01315 
01316 /**
01317  * @mainpage Optimized High Speed Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
01318  *
01319  * @section Goals Design Goals
01320  *
01321  * This library fork is designed to be...
01322  * @li More compliant with the manufacturer specified operation of the chip, while allowing advanced users
01323  * to work outside the recommended operation.
01324  * @li Utilize the capabilities of the radio to their full potential via Arduino
01325  * @li More reliable, responsive, bug-free and feature rich
01326  * @li Easy for beginners to use, with well documented examples and features
01327  * @li Consumed with a public interface that's similar to other Arduino standard libraries
01328  *
01329  * @section News News
01330  *
01331  * **Dec 2015**<br>
01332  * - ESP8266 support via Arduino IDE
01333  * - <a href="https://github.com/stewarthou/Particle-RF24">Particle Photon/Core</a> fork available
01334  * - ATTiny2313/4313 support added
01335  * - Python 3 support added
01336  * - RF24 added to Arduino library manager
01337  * - RF24 added to PlatformIO library manager
01338  *
01339  * **March 2015**<br>
01340  * - Uses SPI transactions on Arduino
01341  * - New layout for <a href="Portability.html">easier portability:</a> Break out defines & includes for individual platforms to RF24/utility
01342  * - <a href="MRAA.html">MRAA</a> support added ( Galileo, Edison, etc)
01343  * - <a href="BBB.html">BBB/Generic Linux </a> support via spidev & MRAA
01344  * - Support for RPi 2 added
01345  * - Major Documentation cleanup & update (Move all docs to github.io)
01346  *
01347  *
01348  * If issues are discovered with the documentation, please report them <a href="https://github.com/TMRh20/tmrh20.github.io/issues"> here</a>
01349  *
01350  * <br>
01351  * @section Useful Useful References
01352  *
01353  *
01354  * @li <a href="http://tmrh20.github.io/RF24/classRF24.html"><b>RF24</b> Class Documentation</a>
01355  * @li <a href="https://github.com/TMRh20/RF24/archive/master.zip"><b>Download</b></a>
01356  * @li <a href="https://github.com/tmrh20/RF24/"><b>Source Code</b></a>
01357  * @li <a href="http://tmrh20.blogspot.com/2014/03/high-speed-data-transfers-and-wireless.html"><b>My Blog:</b> RF24 Optimization Overview</a> 
01358  * @li <a href="http://www.nordicsemi.com/files/Product/data_sheet/nRF24L01_Product_Specification_v2_0.pdf">Chip Datasheet</a>
01359  *
01360  * **Additional Information and Add-ons**
01361  *
01362  * @li <a href="http://tmrh20.github.io/RF24Network"> <b>RF24Network:</b> OSI Network Layer for multi-device communication. Create a home sensor network.</a>
01363  * @li <a href="http://tmrh20.github.io/RF24Mesh"> <b>RF24Mesh:</b> Dynamic Mesh Layer for RF24Network</a>
01364  * @li <a href="http://tmrh20.github.io/RF24Ethernet"> <b>RF24Ethernet:</b> TCP/IP Radio Mesh Networking (shares Arduino Ethernet API)</a>
01365  * @li <a href="http://tmrh20.github.io/RF24Audio"> <b>RF24Audio:</b> Realtime Wireless Audio streaming</a>
01366  * @li <a href="http://tmrh20.github.io/">All TMRh20 Documentation Main Page</a>
01367  *
01368  * **More Information and RF24 Based Projects**
01369  *
01370  * @li <a href="http://TMRh20.blogspot.com"> Project Blog: TMRh20.blogspot.com </a>
01371  * @li <a href="http://maniacalbits.blogspot.ca/"> Maniacal Bits Blog</a>
01372  * @li <a href="http://www.mysensors.org/">MySensors.org (User friendly sensor networks/IoT)</a>
01373  * @li <a href="https://github.com/mannkind/RF24Node_MsgProto"> RF24Node_MsgProto (MQTT)</a>
01374  * @li <a href="https://bitbucket.org/pjhardy/rf24sensornet/"> RF24SensorNet </a>
01375  * @li <a href="http://www.homeautomationforgeeks.com/rf24software.shtml">Home Automation for Geeks</a>
01376  * @li <a href="https://maniacbug.wordpress.com/2012/03/30/rf24network/"> Original Maniacbug RF24Network Blog Post</a>
01377  * @li <a href="https://github.com/maniacbug/RF24"> ManiacBug on GitHub (Original Library Author)</a>
01378  * 
01379  *
01380  * <br>
01381  *
01382  * @section Platform_Support Platform Support Pages
01383  *
01384  * @li <a href="Arduino.html"><b>Arduino</b></a> (Uno, Nano, Mega, Due, Galileo, etc)
01385  * @li <a href="ATTiny.html"><b>ATTiny</b></a>
01386  * @li Linux ( <a href="RPi.html"><b>RPi</b></a> , <a href="BBB.html"><b>BBB</b></a>, <a href="MRAA.html"><b>MRAA</b></a> supported boards ( Galileo, Edison, etc))
01387  * @li <a href="Python.html"><b>Python</b></a> wrapper available for RPi
01388  *
01389  * <br>
01390  * **General µC Pin layout** (See the individual board support pages for more info)
01391  *
01392  * The table below shows how to connect the the pins of the NRF24L01(+) to different boards.
01393  * CE and CSN are configurable.
01394  *
01395  * | PIN | NRF24L01 | Arduino UNO | ATtiny25/45/85 [0] | ATtiny44/84 [1] | LittleWire [2]          |    RPI     | RPi -P1 Connector |
01396  * |-----|----------|-------------|--------------------|-----------------|-------------------------|------------|-------------------|
01397  * |  1  |   GND    |   GND       |     pin 4          |    pin 14       | GND                     | rpi-gnd    |     (25)          |
01398  * |  2  |   VCC    |   3.3V      |     pin 8          |    pin  1       | regulator 3.3V required | rpi-3v3    |     (17)          |
01399  * |  3  |   CE     |   digIO 7   |     pin 2          |    pin 12       | pin to 3.3V             | rpi-gpio22 |     (15)          |
01400  * |  4  |   CSN    |   digIO 8   |     pin 3          |    pin 11       | RESET                   | rpi-gpio8  |     (24)          |
01401  * |  5  |   SCK    |   digIO 13  |     pin 7          |    pin  9       | SCK                     | rpi-sckl   |     (23)          |
01402  * |  6  |   MOSI   |   digIO 11  |     pin 6          |    pin  7       | MOSI                    | rpi-mosi   |     (19)          |
01403  * |  7  |   MISO   |   digIO 12  |     pin 5          |    pin  8       | MISO                    | rpi-miso   |     (21)          |
01404  * |  8  |   IRQ    |      -      |        -           |         -       | -                       |    -       |       -           |
01405  *
01406  * @li [0] https://learn.sparkfun.com/tutorials/tiny-avr-programmer-hookup-guide/attiny85-use-hints
01407  * @li [1] http://highlowtech.org/?p=1695
01408  * @li [2] http://littlewire.cc/   
01409  * <br><br><br>
01410  *
01411  *
01412  *
01413  *
01414  * @page Arduino Arduino
01415  * 
01416  * RF24 is fully compatible with Arduino boards <br>
01417  * See <b> http://www.arduino.cc/en/Reference/Board </b> and <b> http://arduino.cc/en/Reference/SPI </b> for more information
01418  * 
01419  * RF24 makes use of the standard hardware SPI pins (MISO,MOSI,SCK) and requires two additional pins, to control
01420  * the chip-select and chip-enable functions.<br>
01421  * These pins must be chosen and designated by the user, in RF24 radio(ce_pin,cs_pin); and can use any 
01422  * available pins.
01423  * 
01424  * <br>
01425  * @section ARD_DUE Arduino Due
01426  * 
01427  * RF24 makes use of the extended SPI functionality available on the Arduino Due, and requires one of the
01428  * defined hardware SS/CS pins to be designated in RF24 radio(ce_pin,cs_pin);<br>
01429  * See http://arduino.cc/en/Reference/DueExtendedSPI for more information
01430  *
01431  * Initial Due support taken from https://github.com/mcrosson/RF24/tree/due
01432  *
01433  * <br>
01434  * @section Alternate_SPI Alternate SPI Support
01435  *
01436  * RF24 supports alternate SPI methods, in case the standard hardware SPI pins are otherwise unavailable.
01437  * 
01438  * <br>
01439  * **Software Driven SPI**
01440  *
01441  * Software driven SPI is provided by the <a href=https://github.com/greiman/DigitalIO>DigitalIO</a> library
01442  *
01443  * Setup:<br>
01444  * 1. Install the digitalIO library<br>
01445  * 2. Open RF24_config.h in a text editor. Uncomment the line #define SOFTSPI<br>
01446  * 3. In your sketch, add #include DigitalIO.h
01447  *
01448  * @note Note: Pins are listed as follows and can be modified by editing the RF24_config.h file<br>
01449  *
01450  *     const uint8_t SOFT_SPI_MISO_PIN = 16;
01451  *     const uint8_t SOFT_SPI_MOSI_PIN = 15;
01452  *     const uint8_t SOFT_SPI_SCK_PIN = 14;
01453  *
01454  * <br>
01455  * **Alternate Hardware (UART) Driven  SPI**
01456  *
01457  * The Serial Port (UART) on Arduino can also function in SPI mode, and can double-buffer data, while the 
01458  * default SPI hardware cannot.
01459  *
01460  * The SPI_UART library is available at https://github.com/TMRh20/Sketches/tree/master/SPI_UART
01461  * 
01462  * Enabling:
01463  * 1. Install the SPI_UART library
01464  * 2. Edit RF24_config.h and uncomment #define SPI_UART
01465  * 3. In your sketch, add @code #include <SPI_UART.h> @endcode
01466  *
01467  * SPI_UART SPI Pin Connections:
01468  * | NRF |Arduino Uno Pin|
01469  * |-----|---------------|
01470  * | MOSI| TX(0)         |
01471  * | MISO| RX(1)         |
01472  * | SCK | XCK(4)        |
01473  * | CE  | User Specified|
01474  * | CSN | User Specified|
01475  *
01476  *
01477  * @note SPI_UART on Mega boards requires soldering to an unused pin on the chip. <br>See
01478  * https://github.com/TMRh20/RF24/issues/24 for more information on SPI_UART.
01479  * 
01480  * @page ATTiny ATTiny
01481  *
01482  * ATTiny support is built into the library, so users are not required to include SPI.h in their sketches<br>
01483  * See the included rf24ping85 example for pin info and usage
01484  * 
01485  * Some versions of Arduino IDE may require a patch to allow use of the full program space on ATTiny<br>
01486  * See https://github.com/TCWORLD/ATTinyCore/tree/master/PCREL%20Patch%20for%20GCC for ATTiny patch
01487  *
01488  * ATTiny board support initially added from https://github.com/jscrane/RF24
01489  *
01490  * @section Hardware Hardware Configuration
01491  * By tong67 ( https://github.com/tong67 )
01492  * 
01493  *    **ATtiny25/45/85 Pin map with CE_PIN 3 and CSN_PIN 4**
01494  * @code
01495  *                                 +-\/-+
01496  *                   NC      PB5  1|o   |8  Vcc --- nRF24L01  VCC, pin2 --- LED --- 5V
01497  *    nRF24L01  CE, pin3 --- PB3  2|    |7  PB2 --- nRF24L01  SCK, pin5
01498  *    nRF24L01 CSN, pin4 --- PB4  3|    |6  PB1 --- nRF24L01 MOSI, pin6
01499  *    nRF24L01 GND, pin1 --- GND  4|    |5  PB0 --- nRF24L01 MISO, pin7
01500  *                                 +----+ 
01501  * @endcode
01502  *
01503  * <br>
01504  *    **ATtiny25/45/85 Pin map with CE_PIN 3 and CSN_PIN 3** => PB3 and PB4 are free to use for application <br>
01505  *    Circuit idea from http://nerdralph.blogspot.ca/2014/01/nrf24l01-control-with-3-attiny85-pins.html <br>
01506  *   Original RC combination was 1K/100nF. 22K/10nF combination worked better.                          <br>
01507  *  For best settletime delay value in RF24::csn() the timingSearch3pin.ino sketch can be used.         <br>
01508  *    This configuration is enabled when CE_PIN and CSN_PIN are equal, e.g. both 3                      <br>
01509  *    Because CE is always high the power consumption is higher than for 5 pins solution                <br>
01510  * @code
01511  *                                                                                           ^^         
01512  *                                 +-\/-+           nRF24L01   CE, pin3 ------|              //         
01513  *                           PB5  1|o   |8  Vcc --- nRF24L01  VCC, pin2 ------x----------x--|<|-- 5V    
01514  *                   NC      PB3  2|    |7  PB2 --- nRF24L01  SCK, pin5 --|<|---x-[22k]--|  LED         
01515  *                   NC      PB4  3|    |6  PB1 --- nRF24L01 MOSI, pin6  1n4148 |                       
01516  *    nRF24L01 GND, pin1 -x- GND  4|    |5  PB0 --- nRF24L01 MISO, pin7         |                       
01517  *                        |        +----+                                       |                       
01518  *                        |-----------------------------------------------||----x-- nRF24L01 CSN, pin4  
01519  *                                                                      10nF                            
01520  * @endcode
01521  *
01522  * <br>
01523  *    **ATtiny24/44/84 Pin map with CE_PIN 8 and CSN_PIN 7** <br>
01524  *  Schematic provided and successfully tested by Carmine Pastore (https://github.com/Carminepz) <br>
01525  * @code
01526  *                                  +-\/-+                                                              
01527  *    nRF24L01  VCC, pin2 --- VCC  1|o   |14 GND --- nRF24L01  GND, pin1
01528  *                            PB0  2|    |13 AREF
01529  *                            PB1  3|    |12 PA1
01530  *                            PB3  4|    |11 PA2 --- nRF24L01   CE, pin3
01531  *                            PB2  5|    |10 PA3 --- nRF24L01  CSN, pin4
01532  *                            PA7  6|    |9  PA4 --- nRF24L01  SCK, pin5
01533  *    nRF24L01 MISO, pin7 --- PA6  7|    |8  PA5 --- nRF24L01 MOSI, pin6
01534  *                                  +----+
01535  *  @endcode                     
01536  *  
01537  * <br>
01538  *    **ATtiny2313/4313 Pin map with CE_PIN 12 and CSN_PIN 13** <br>
01539  * @code
01540  *                                  +-\/-+                                                              
01541  *                            PA2  1|o   |20 VCC --- nRF24L01  VCC, pin2
01542  *                            PD0  2|    |19 PB7 --- nRF24L01  SCK, pin5
01543  *                            PD1  3|    |18 PB6 --- nRF24L01 MOSI, pin6
01544  *                            PA1  4|    |17 PB5 --- nRF24L01 MISO, pin7
01545  *                            PA0  5|    |16 PB4 --- nRF24L01  CSN, pin4
01546  *                            PD2  6|    |15 PB3 --- nRF24L01   CE, pin3
01547  *                            PD3  7|    |14 PB2
01548  *                            PD4  8|    |13 PB1
01549  *                            PD5  9|    |12 PB0
01550  *    nRF24L01  GND, pin1 --- GND 10|    |11 PD6
01551  *                                  +----+
01552  *  @endcode                     
01553  *
01554  * <br><br><br>
01555  *
01556  *
01557  * 
01558  * 
01559  *
01560  *
01561  * @page BBB BeagleBone Black
01562  *
01563  * BeagleBone Black is supported via MRAA or SPIDEV.
01564  *
01565  *  @note The SPIDEV option should work with most Linux systems supporting SPIDEV. <br>
01566  *  Users may need to edit the RF24/utility/BBB/spi.cpp file to configure the spi device. (Defaults: "/dev/spidev1.0";  or  "/dev/spidev1.1"; )
01567  *
01568  * <br>
01569  * @section AutoInstall Automated Install 
01570  *(**Designed & Tested on RPi** - Defaults to SPIDEV on BBB)
01571  *
01572  * 
01573  * 1. Download the install.sh file from http://tmrh20.github.io/RF24Installer/RPi/install.sh
01574  * @code wget http://tmrh20.github.io/RF24Installer/RPi/install.sh @endcode
01575  * 2. Make it executable:
01576  * @code chmod +x install.sh @endcode
01577  * 3. Run it and choose your options
01578  * @code ./install.sh @endcode
01579  * 4. Run an example from one of the libraries
01580  * @code 
01581  * cd rf24libs/RF24/examples_RPi  
01582  * @endcode
01583  * Edit the gettingstarted example, to set your pin configuration
01584  * @code nano gettingstarted.cpp
01585  * make  
01586  * sudo ./gettingstarted  
01587  * @endcode
01588  *
01589  * <br>
01590  * @section ManInstall Manual Install
01591  * 1. Make a directory to contain the RF24 and possibly RF24Network lib and enter it: 
01592  * @code
01593  *  mkdir ~/rf24libs 
01594  *  cd ~/rf24libs
01595 *  @endcode
01596  * 2. Clone the RF24 repo:
01597  *    @code git clone https://github.com/tmrh20/RF24.git RF24 @endcode
01598  * 3. Change to the new RF24 directory
01599  *    @code cd RF24 @endcode
01600  * 4. Build the library, and run an example file: 
01601  * **Note:** See the <a href="http://iotdk.intel.com/docs/master/mraa/index.html">MRAA </a> documentation for more info on installing MRAA
01602  *    @code sudo make install  OR  sudo make install RF24_MRAA=1 @endcode
01603  * @code
01604  * cd examples_RPi  
01605  * @endcode
01606  * Edit the gettingstarted example, to set your pin configuration
01607  * @code nano gettingstarted.cpp 
01608  * make 
01609  * sudo ./gettingstarted
01610  * @endcode
01611  *
01612  * <br><br>
01613  *   
01614  * @page MRAA MRAA
01615  *  
01616  * MRAA is a Low Level Skeleton Library for Communication on GNU/Linux platforms <br>
01617  * See http://iotdk.intel.com/docs/master/mraa/index.html for more information
01618  *
01619  * RF24 supports all MRAA supported platforms, but might not be tested on each individual platform due to the wide range of hardware support:<br>
01620  * <a href="https://github.com/TMRh20/RF24/issues">Report an RF24 bug or issue </a>
01621  *
01622  * @section Setup Setup
01623  * 1. Install the MRAA lib
01624  * 2. As per your device, SPI may need to be enabled
01625  * 
01626  * @section MRAA_Install Install 
01627  *
01628  * 1. Make a directory to contain the RF24 and possibly RF24Network lib and enter it: 
01629  * @code
01630  *  mkdir ~/rf24libs 
01631  *  cd ~/rf24libs
01632 *  @endcode
01633  * 2. Clone the RF24 repo:
01634  *    @code git clone https://github.com/tmrh20/RF24.git RF24 @endcode
01635  * 3. Change to the new RF24 directory
01636  *    @code cd RF24 @endcode
01637  * 4. Build the library: 
01638  *    @code sudo make install -B RF24_MRAA=1 @endcode
01639  * 5. Configure the correct pins in gettingstarted.cpp (See http://iotdk.intel.com/docs/master/mraa/index.html )
01640  *    @code
01641  *    cd examples_RPi  
01642  *    nano gettingstarted.cpp 
01643  *    @endcode
01644  * 6. Build an example
01645  *    @code
01646  *    make  
01647  *    sudo ./gettingstarted
01648  *    @endcode
01649  *
01650  * <br><br><br>
01651  *
01652  * 
01653  *
01654  *
01655  * @page RPi Raspberry Pi
01656  *
01657  * RF24 supports a variety of Linux based devices via various drivers. Some boards like RPi can utilize multiple methods
01658  * to drive the GPIO and SPI functionality.
01659  *
01660  * <br>
01661  * @section PreConfig Potential PreConfiguration
01662  *
01663  * If SPI is not already enabled, load it on boot:
01664  * @code sudo raspi-config  @endcode
01665  * A. Update the tool via the menu as required<br>
01666  * B. Select **Advanced** and **enable the SPI kernel module** <br>
01667  * C. Update other software and libraries:
01668  * @code sudo apt-get update @endcode
01669  * @code sudo apt-get upgrade @endcode 
01670  * <br>
01671  * @section AutoInstall Automated Install
01672  *
01673  * 1. Download the install.sh file from http://tmrh20.github.io/RF24Installer/RPi/install.sh
01674  * @code wget http://tmrh20.github.io/RF24Installer/RPi/install.sh @endcode
01675  * 2. Make it executable:
01676  * @code chmod +x install.sh @endcode
01677  * 3. Run it and choose your options
01678  * @code ./install.sh @endcode
01679  * 4. Run an example from one of the libraries
01680  * @code 
01681  * cd rf24libs/RF24/examples_RPi  
01682  * make  
01683  * sudo ./gettingstarted  
01684  * @endcode
01685  * <br><br>
01686  * @section ManInstall Manual Install
01687  * 1. Make a directory to contain the RF24 and possibly RF24Network lib and enter it: 
01688  * @code
01689  *  mkdir ~/rf24libs 
01690  *  cd ~/rf24libs
01691 *  @endcode
01692  * 2. Clone the RF24 repo:
01693  *    @code git clone https://github.com/tmrh20/RF24.git RF24 @endcode
01694  * 3. Change to the new RF24 directory
01695  *    @code cd RF24 @endcode
01696  * 4. Build the library, and run an example file: 
01697  * @code sudo make install
01698  * cd examples_RPi  
01699  * make  
01700  * sudo ./gettingstarted
01701  * @endcode
01702  *
01703  * <br><br>
01704  * @section Build Build Options
01705  * The default build on Raspberry Pi utilizes the included **BCM2835** driver from http://www.airspayce.com/mikem/bcm2835
01706  * 1. @code sudo make install -B @endcode
01707  *
01708  * Build using the **MRAA** library from http://iotdk.intel.com/docs/master/mraa/index.html <br>
01709  * MRAA is not included. See the <a href="MRAA.html">MRAA</a> platform page for more information.
01710  *
01711  * 1. Install, and build MRAA:
01712  * @code
01713  * git clone https://github.com/intel-iot-devkit/mraa.git
01714  * cd mraa
01715  * mkdir build
01716  * cd build
01717  * cmake .. -DBUILDSWIGNODE=OFF
01718  * sudo make install
01719  * @endcode
01720  *
01721  * 2. Complete the install <br>
01722  * @code nano /etc/ld.so.conf @endcode
01723  * Add the line @code /usr/local/lib/arm-linux-gnueabihf @endcode
01724  * Run @code sudo ldconfig @endcode
01725  *
01726  * 3. Install RF24, using MRAA
01727  * @code sudo make install -B RF24_MRAA=1 @endcode
01728  * See the gettingstarted example for an example of pin configuration
01729  *
01730  * Build using **spidev**:
01731  *
01732  * 1. Edit the RF24/utility/BBB/spi.cpp file
01733  * 2. Change the default device definition to @code this->device = "/dev/spidev0.0";; @endcode
01734  * 3. Run @code sudo make install -B RF24_SPIDEV=1 @endcode
01735  * 4. See the gettingstarted example for an example of pin configuration
01736  *
01737  * <br>
01738  * @section Pins Connections and Pin Configuration
01739  *
01740  *
01741  * Using pin 15/GPIO 22 for CE, pin 24/GPIO8 (CE0) for CSN
01742  *
01743  * Can use either RPi CE0 or CE1 pins for radio CSN.<br>
01744  * Choose any RPi output pin for radio CE pin.
01745  *
01746  * **BCM2835 Constructor:**
01747  * @code
01748  *  RF24 radio(RPI_V2_GPIO_P1_15,BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ);
01749  *   or
01750  *  RF24 radio(RPI_V2_GPIO_P1_15,BCM2835_SPI_CS1, BCM2835_SPI_SPEED_8MHZ);
01751  *  
01752  *  RPi B+:
01753  *  RF24 radio(RPI_BPLUS_GPIO_J8_15,RPI_BPLUS_GPIO_J8_24, BCM2835_SPI_SPEED_8MHZ);
01754  *  or
01755  *  RF24 radio(RPI_BPLUS_GPIO_J8_15,RPI_BPLUS_GPIO_J8_26, BCM2835_SPI_SPEED_8MHZ);
01756  *
01757  *  General:
01758  *  RF24 radio(22,0);
01759  *  or
01760  *  RF24 radio(22,1);
01761  *
01762  * @endcode
01763  * See the gettingstarted example for an example of pin configuration
01764  *
01765  * See http://www.airspayce.com/mikem/bcm2835/index.html for BCM2835 class documentation.
01766  * <br><br>
01767  * **MRAA Constructor:**
01768  *
01769  * @code RF24 radio(15,0); @endcode
01770  *
01771  * See http://iotdk.intel.com/docs/master/mraa/rasppi.html
01772  * <br><br>
01773  * **SPI_DEV Constructor**
01774  *
01775  * @code RF24 radio(22,0); @endcode
01776  *
01777  * See http://pi.gadgetoid.com/pinout
01778  *
01779  * **Pins:**  
01780  *
01781  * | PIN | NRF24L01 |    RPI     | RPi -P1 Connector |
01782  * |-----|----------|------------|-------------------|
01783  * |  1  |   GND    | rpi-gnd    |     (25)          |
01784  * |  2  |   VCC    | rpi-3v3    |     (17)          |
01785  * |  3  |   CE     | rpi-gpio22 |     (15)          |
01786  * |  4  |   CSN    | rpi-gpio8  |     (24)          |
01787  * |  5  |   SCK    | rpi-sckl   |     (23)          |
01788  * |  6  |   MOSI   | rpi-mosi   |     (19)          |
01789  * |  7  |   MISO   | rpi-miso   |     (21)          |
01790  * |  8  |   IRQ    |    -       |       -           |
01791  *   
01792  *   
01793  *  
01794  *  
01795  * <br><br>
01796  ****************
01797  *   
01798  * Based on the arduino lib from J. Coliz <maniacbug@ymail.com>  <br>
01799  * the library was berryfied by Purinda Gunasekara <purinda@gmail.com> <br>  
01800  * then forked from github stanleyseow/RF24 to https://github.com/jscrane/RF24-rpi  <br>
01801  * Network lib also based on https://github.com/farconada/RF24Network
01802  *
01803  * 
01804  *
01805  * 
01806  * <br><br><br>
01807  * 
01808  *
01809  *  
01810  * @page Python Python Wrapper (by https://github.com/mz-fuzzy)
01811  * 
01812  * @section Install Installation:  
01813  * 
01814  * Install the boost libraries:  (Note: Only the python libraries should be needed, this is just for simplicity)
01815  *
01816  * @code sudo apt-get install libboost1.50-all @endcode
01817  *
01818  * Build the library:  
01819  *
01820  * @code ./setup.py build   @endcode
01821  *
01822  * Install the library 
01823  *
01824  * @code sudo ./setup.py install  @endcode
01825  *
01826  * 
01827  * See the additional <a href="pages.html">Platform Support</a> pages for information on connecting your hardware  <br>
01828  * See the included <a href="pingpair_dyn_8py-example.html">example </a> for usage information.   
01829  * 
01830  * Running the Example:  
01831  * 
01832  * Edit the pingpair_dyn.py example to configure the appropriate pins per the above documentation:  
01833  *
01834  * @code nano pingpair_dyn.py   @endcode
01835  *
01836  * Configure another device, Arduino or RPi with the <a href="pingpair_dyn_8py-example.html">pingpair_dyn</a> example  
01837  *
01838  * Run the example  
01839  *
01840  * @code sudo ./pingpair_dyn.py  @endcode
01841  *
01842  * <br><br><br>
01843  *
01844  *
01845  * @page Portability RF24 Portability
01846  *
01847  * The RF24 radio driver mainly utilizes the <a href="http://arduino.cc/en/reference/homePage">Arduino API</a> for GPIO, SPI, and timing functions, which are easily replicated
01848  * on various platforms. <br>Support files for these platforms are stored under RF24/utility, and can be modified to provide 
01849  * the required functionality.
01850  * 
01851  * <br>
01852  * @section Hardware_Templates Basic Hardware Template
01853  *
01854  * **RF24/utility**
01855  *
01856  * The RF24 library now includes a basic hardware template to assist in porting to various platforms. <br> The following files can be included
01857  * to replicate standard Arduino functions as needed, allowing devices from ATTiny to Raspberry Pi to utilize the same core RF24 driver.
01858  *
01859  * | File               |                   Purpose                                                    | 
01860  * |--------------------|------------------------------------------------------------------------------| 
01861  * | RF24_arch_config.h | Basic Arduino/AVR compatibility, includes for remaining support files, etc   | 
01862  * | includes.h         | Linux only. Defines specific platform, include correct RF24_arch_config file | 
01863  * | spi.h              | Provides standardized SPI ( transfer() ) methods                         | 
01864  * | gpio.h             | Provides standardized GPIO ( digitalWrite() ) methods                        | 
01865  * | compatibility.h    | Provides standardized timing (millis(), delay()) methods                     | 
01866  * | your_custom_file.h | Provides access to custom drivers for spi,gpio, etc                          | 
01867  *
01868  * <br>
01869  * Examples are provided via the included hardware support templates in **RF24/utility** <br>
01870  * See the <a href="modules.html">modules</a> page for examples of class declarations 
01871  *
01872  *<br>
01873  * @section Device_Detection Device Detection
01874  *
01875  * 1. The main detection for Linux devices is done in the Makefile, with the includes.h from the proper hardware directory copied to RF24/utility/includes.h <br>
01876  * 2. Secondary detection is completed in RF24_config.h, causing the include.h file to be included for all supported Linux devices <br>
01877  * 3. RF24.h contains the declaration for SPI and GPIO objects 'spi' and 'gpio' to be used for porting-in related functions.
01878  *
01879  * <br>
01880  * @section Ported_Code Code
01881  * To have your ported code included in this library, or for assistance in porting, create a pull request or open an issue at https://github.com/TMRh20/RF24
01882  * 
01883  *
01884  *<br><br><br>
01885  */
01886 
01887 #endif // __RF24_H__
01888