,

Dependencies:   mbed

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