Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Threaded_LoRa_Modem
RadioHead.h
00001 // RadioHead.h 00002 // Author: Mike McCauley (mikem@airspayce.com) DO NOT CONTACT THE AUTHOR DIRECTLY 00003 // Copyright (C) 2014 Mike McCauley 00004 // $Id: RadioHead.h,v 1.50 2015/08/14 21:20:12 mikem Exp mikem $ 00005 00006 /// \mainpage RadioHead Packet Radio library for embedded microprocessors 00007 /// 00008 /// This is the RadioHead Packet Radio library for embedded microprocessors. 00009 /// It provides a complete object-oriented library for sending and receiving packetized messages 00010 /// via a variety of common data radios and other transports on a range of embedded microprocessors. 00011 /// 00012 /// The version of the package that this documentation refers to can be downloaded 00013 /// from http://www.airspayce.com/mikem/arduino/RadioHead/RadioHead-1.48.zip 00014 /// You can find the latest version at http://www.airspayce.com/mikem/arduino/RadioHead 00015 /// 00016 /// You can also find online help and discussion at 00017 /// http://groups.google.com/group/radiohead-arduino 00018 /// Please use that group for all questions and discussions on this topic. 00019 /// Do not contact the author directly, unless it is to discuss commercial licensing. 00020 /// Before asking a question or reporting a bug, please read 00021 /// - http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/How_to_ask_a_software_question 00022 /// - http://www.catb.org/esr/faqs/smart-questions.html 00023 /// - http://www.chiark.greenend.org.uk/~shgtatham/bugs.html 00024 /// 00025 /// \par Overview 00026 /// 00027 /// RadioHead consists of 2 main sets of classes: Drivers and Managers. 00028 /// 00029 /// - Drivers provide low level access to a range of different packet radios and other packetized message transports. 00030 /// - Managers provide high level message sending and receiving facilities for a range of different requirements. 00031 /// 00032 /// Every RadioHead program will have an instance of a Driver to provide access to the data radio or transport, 00033 /// and a Manager that uses that driver to send and receive messages for the application. The programmer is required 00034 /// to instantiate a Driver and a Manager, and to initialise the Manager. Thereafter the facilities of the Manager 00035 /// can be used to send and receive messages. 00036 /// 00037 /// It is also possible to use a Driver on its own, without a Manager, although this only allows unaddressed, 00038 /// unreliable transport via the Driver's facilities. 00039 /// 00040 /// In some specialised use cases, it is possible to instantiate more than one Driver and more than one Manager. 00041 /// 00042 /// A range of different common embedded microprocessor platforms are supported, allowing your project to run 00043 /// on your choice of processor. 00044 /// 00045 /// Example programs are included to show the main modes of use. 00046 /// 00047 /// \par Drivers 00048 /// 00049 /// The following Drivers are provided: 00050 /// 00051 /// - RH_RF22 00052 /// Works with Hope-RF 00053 /// RF22B and RF23B based transceivers, and compatible chips and modules, 00054 /// including the RFM22B transceiver module such as 00055 /// this bare module: http://www.sparkfun.com/products/10153 00056 /// and this shield: http://www.sparkfun.com/products/11018 00057 /// and this board: http://www.anarduino.com/miniwireless 00058 /// and RF23BP modules such as: http://www.anarduino.com/details.jsp?pid=130 00059 /// Supports GFSK, FSK and OOK. Access to other chip 00060 /// features such as on-chip temperature measurement, analog-digital 00061 /// converter, transmitter power control etc is also provided. 00062 /// 00063 /// - RH_RF24 00064 /// Works with Silicon Labs Si4460/4461/4463/4464 family of transceivers chip, and the equivalent 00065 /// HopeRF RF24/26/27 family of chips and the HopeRF RFM24W/26W/27W modules. 00066 /// Supports GFSK, FSK and OOK. Access to other chip 00067 /// features such as on-chip temperature measurement, analog-digital 00068 /// converter, transmitter power control etc is also provided. 00069 /// 00070 /// - RH_RF69 00071 /// Works with Hope-RF 00072 /// RF69B based radio modules, such as the RFM69 module, (as used on the excellent Moteino and Moteino-USB 00073 /// boards from LowPowerLab http://lowpowerlab.com/moteino/ ) 00074 /// and compatible chips and modules such as RFM69W, RFM69HW, RFM69CW, RFM69HCW (Semtech SX1231, SX1231H). 00075 /// Also works with Anarduino MiniWireless -CW and -HW boards http://www.anarduino.com/miniwireless/ including 00076 /// the marvellous high powered MinWireless-HW (with 20dBm output for excellent range). 00077 /// Supports GFSK, FSK. 00078 /// 00079 /// - RH_NRF24 00080 /// Works with Nordic nRF24 based 2.4GHz radio modules, such as nRF24L01 and others. 00081 /// Also works with Hope-RF RFM73 00082 /// and compatible devices (such as BK2423). nRF24L01 and RFM73 can interoperate 00083 /// with each other. 00084 /// 00085 /// - RH_NRF905 00086 /// Works with Nordic nRF905 based 433/868/915 MHz radio modules. 00087 /// 00088 /// - RH_NRF51 00089 /// Works with Nordic nRF51 compatible 2.4 GHz SoC/devices such as the nRF51822. 00090 /// 00091 /// - RH_RF95 00092 /// Works with Semtech SX1276/77/78 and HopeRF RFM95/96/97/98 and other similar LoRa capable radios. 00093 /// Supports Long Range (LoRa) with spread spectrum frequency hopping, large payloads etc. 00094 /// FSK/GFSK/OOK modes are not (yet) supported. 00095 /// 00096 /// - RH_ASK 00097 /// Works with a range of inexpensive ASK (amplitude shift keying) RF transceivers such as RX-B1 00098 /// (also known as ST-RX04-ASK) receiver; TX-C1 transmitter and DR3100 transceiver; FS1000A/XY-MK-5V transceiver; 00099 /// HopeRF RFM83C / RFM85. Supports ASK (OOK). 00100 /// 00101 /// - RH_Serial 00102 /// Works with RS232, RS422, RS485, RS488 and other point-to-point and multidropped serial connections, 00103 /// or with TTL serial UARTs such as those on Arduino and many other processors, 00104 /// or with data radios with a 00105 /// serial port interface. RH_Serial provides packetization and error detection over any hardware or 00106 /// virtual serial connection. Also builds and runs on Linux and OSX. 00107 /// 00108 /// - RH_TCP 00109 /// For use with simulated sketches compiled and running on Linux. 00110 /// Works with tools/etherSimulator.pl to pass messages between simulated sketches, allowing 00111 /// testing of Manager classes on Linux and without need for real radios or other transport hardware. 00112 /// 00113 /// Drivers can be used on their own to provide unaddressed, unreliable datagrams. 00114 /// All drivers have the same identical API. 00115 /// Or you can use any Driver with any of the Managers described below. 00116 /// 00117 /// We welcome contributions of well tested and well documented code to support other transports. 00118 /// 00119 /// \par Managers 00120 /// 00121 /// The following Mangers are provided: 00122 /// 00123 /// - RHDatagram 00124 /// Addressed, unreliable variable length messages, with optional broadcast facilities. 00125 /// 00126 /// - RHReliableDatagram 00127 /// Addressed, reliable, retransmitted, acknowledged variable length messages. 00128 /// 00129 /// - RHRouter 00130 /// Multi-hop delivery from source node to destination node via 0 or more intermediate nodes, with manual routing. 00131 /// 00132 /// - RHMesh 00133 /// Multi-hop delivery with automatic route discovery and rediscovery. 00134 /// 00135 /// Any Manager may be used with any Driver. 00136 /// 00137 /// \par Platforms 00138 /// 00139 /// A range of platforms is supported: 00140 /// 00141 /// - Arduino and the Arduino IDE (version 1.0 to 1.6.5 and later) 00142 /// Including Diecimila, Uno, Mega, Leonardo, Yun, Due, Zero etc. http://arduino.cc/, Also similar boards such as 00143 /// - Moteino http://lowpowerlab.com/moteino/ 00144 /// - Anarduino Mini http://www.anarduino.com/mini/ 00145 /// - RedBearLab Blend V1.0 http://redbearlab.com/blend/ (with Arduino 1.0.5 and RedBearLab Blend Add-On version 20140701) 00146 /// - MoteinoMEGA https://lowpowerlab.com/shop/moteinomega 00147 /// (with Arduino 1.0.5 and the MoteinoMEGA Arduino Core 00148 /// https://github.com/LowPowerLab/Moteino/tree/master/MEGA/Core) 00149 /// - etc. 00150 /// 00151 /// - ChipKit Uno32 board and the MPIDE development environment 00152 /// http://www.digilentinc.com/Products/Detail.cfm?Prod=CHIPKIT-UNO32 00153 /// 00154 /// - Maple and Flymaple boards with libmaple and the Maple-IDE development environment 00155 /// http://leaflabs.com/devices/maple/ and http://www.open-drone.org/flymaple 00156 /// 00157 /// - Teensy including Teensy 3.1 and earlier built using Arduino IDE 1.0.5 to 1.6.4 and later with 00158 /// teensyduino addon 1.18 to 1.23 and later. 00159 /// http://www.pjrc.com/teensy 00160 /// 00161 /// - ATtiny built using Arduino IDE 1.0.5 with the arduino-tiny support from https://code.google.com/p/arduino-tiny/ 00162 /// (Caution: these are very small processors and not all RadioHead features may be available, depending on memory requirements) 00163 /// 00164 /// - nRF51 compatible Arm chips such as nRF51822 with Arduino 1.6.4 and later using the procedures 00165 /// in http://redbearlab.com/getting-started-nrf51822/ 00166 /// 00167 /// - Raspberry Pi 00168 /// Uses BCM2835 library for GPIO http://www.airspayce.com/mikem/bcm2835/ 00169 /// Currently works only with RH_NRF24 driver or other drivers that do not require interrupt support. 00170 /// Contributed by Mike Poublon. 00171 /// 00172 /// - Linux and OSX 00173 /// Using the RHutil/HardwareSerial class, the RH_Serial driver and any manager will 00174 /// build and run on Linux and OSX. These can be used to build programs that talk securely and reliably to 00175 /// Arduino and other processors or to other Linux or OSX hosts on a reliable, error detected datagram 00176 /// protocol over a serial line. 00177 /// 00178 /// Other platforms are partially supported, such as Generic AVR 8 bit processors, MSP430. 00179 /// We welcome contributions that will expand the range of supported platforms. 00180 /// 00181 /// RadioHead is available (through the efforts of others) 00182 /// for PlatformIO. PlatformIO is a cross-platform code builder and the missing library manager. 00183 /// http://platformio.org/#!/lib/show/124/RadioHead 00184 /// 00185 /// \par History 00186 /// 00187 /// RadioHead was created in April 2014, substantially based on code from some of our other earlier Radio libraries: 00188 /// 00189 /// - RHMesh, RHRouter, RHReliableDatagram and RHDatagram are derived from the RF22 library version 1.39. 00190 /// - RH_RF22 is derived from the RF22 library version 1.39. 00191 /// - RH_RF69 is derived from the RF69 library version 1.2. 00192 /// - RH_ASK is based on the VirtualWire library version 1.26, after significant conversion to C++. 00193 /// - RH_Serial was new. 00194 /// - RH_NRF24 is based on the NRF24 library version 1.12, with some significant changes. 00195 /// 00196 /// During this combination and redevelopment, we have tried to retain all the processor dependencies and support from 00197 /// the libraries that were contributed by other people. However not all platforms can be tested by us, so if you 00198 /// find that support from some platform has not been successfully migrated, please feel free to fix it and send us a 00199 /// patch. 00200 /// 00201 /// Users of RHMesh, RHRouter, RHReliableDatagram and RHDatagram in the previous RF22 library will find that their 00202 /// existing code will run mostly without modification. See the RH_RF22 documentation for more details. 00203 /// 00204 /// \par Installation 00205 /// 00206 /// Install in the usual way: unzip the distribution zip file to the libraries 00207 /// sub-folder of your sketchbook. 00208 /// The example sketches will be visible in in your Arduino, mpide, maple-ide or whatever. 00209 /// http://arduino.cc/en/Guide/Libraries 00210 /// 00211 /// \par Compatible Hardware Suppliers 00212 /// 00213 /// We have had good experiences with the following suppliers of RadioHead compatible hardware: 00214 /// 00215 /// - LittleBird http://littlebirdelectronics.com.au in Australia for all manner of Arduinos and radios. 00216 /// - LowPowerLab http://lowpowerlab.com/moteino in USA for the excellent Moteino and Moteino-USB 00217 /// boards which include Hope-RF RF69B radios on-board. 00218 /// - Anarduino and HopeRF USA (http://www.hoperfusa.com and http://www.anarduino.com) who have a wide range 00219 /// of HopeRF radios and Arduino integrated modules. 00220 /// - SparkFun https://www.sparkfun.com/ in USA who design and sell a wide range of Arduinos and radio modules. 00221 /// 00222 /// \par Donations 00223 /// 00224 /// This library is offered under a free GPL license for those who want to use it that way. 00225 /// We try hard to keep it up to date, fix bugs 00226 /// and to provide free support. If this library has helped you save time or money, please consider donating at 00227 /// http://www.airspayce.com or here: 00228 /// 00229 /// \htmlonly <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_donations" /> <input type="hidden" name="business" value="mikem@airspayce.com" /> <input type="hidden" name="lc" value="AU" /> <input type="hidden" name="item_name" value="Airspayce" /> <input type="hidden" name="item_number" value="RadioHead" /> <input type="hidden" name="currency_code" value="USD" /> <input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHosted" /> <input type="image" alt="PayPal — The safer, easier way to pay online." name="submit" src="https://www.paypalobjects.com/en_AU/i/btn/btn_donateCC_LG.gif" /> <img alt="" src="https://www.paypalobjects.com/en_AU/i/scr/pixel.gif" width="1" height="1" border="0" /></form> \endhtmlonly 00230 /// 00231 /// \par Trademarks 00232 /// 00233 /// RadioHead is a trademark of AirSpayce Pty Ltd. The RadioHead mark was first used on April 12 2014 for 00234 /// international trade, and is used only in relation to data communications hardware and software and related services. 00235 /// It is not to be confused with any other similar marks covering other goods and services. 00236 /// 00237 /// \par Copyright 00238 /// 00239 /// This software is Copyright (C) 2011-2014 Mike McCauley. Use is subject to license 00240 /// conditions. The main licensing options available are GPL V2 or Commercial: 00241 /// 00242 /// \par Open Source Licensing GPL V2 00243 /// 00244 /// This is the appropriate option if you want to share the source code of your 00245 /// application with everyone you distribute it to, and you also want to give them 00246 /// the right to share who uses it. If you wish to use this software under Open 00247 /// Source Licensing, you must contribute all your source code to the open source 00248 /// community in accordance with the GPL Version 2 when your application is 00249 /// distributed. See http://www.gnu.org/copyleft/gpl.html 00250 /// 00251 /// \par Commercial Licensing 00252 /// 00253 /// This is the appropriate option if you are creating proprietary applications 00254 /// and you are not prepared to distribute and share the source code of your 00255 /// application. Contact info@airspayce.com for details (do not use this address for anything other than 00256 /// commercial license enquiries. For all other queries, using the RadioHead mailing list). 00257 /// 00258 /// \par Revision History 00259 /// \version 1.1 2014-04-14<br> 00260 /// Initial public release 00261 /// \version 1.2 2014-04-23<br> 00262 /// Fixed various typos. <br> 00263 /// Added links to compatible Anarduino products.<br> 00264 /// Added RHNRFSPIDriver, RH_NRF24 classes to support Nordic NRF24 based radios. 00265 /// \version 1.3 2014-04-28<br> 00266 /// Various documentation fixups.<br> 00267 /// RHDatagram::setThisAddress() did not set the local copy of thisAddress. Reported by Steve Childress.<br> 00268 /// Fixed a problem on Teensy with RF22 and RF69, where the interrupt pin needs to be set for input, <br> 00269 /// else pin interrupt doesn't work properly. Reported by Steve Childress and patched by 00270 /// Adrien van den Bossche. Thanks.<br> 00271 /// Fixed a problem that prevented RF22 honouring setPromiscuous(true). Reported by Steve Childress.<br> 00272 /// Updated documentation to clarify some issues to do with maximum message lengths 00273 /// reported by Steve Childress.<br> 00274 /// Added support for yield() on systems that support it (currently Arduino 1.5.5 and later) 00275 /// so that spin-loops can suport multitasking. Suggested by Steve Childress.<br> 00276 /// Added RH_RF22::setGpioReversed() so the reversal it can be configured at run-time after 00277 /// radio initialisation. It must now be called _after_ init(). Suggested by Steve Childress.<br> 00278 /// \version 1.4 2014-04-29<br> 00279 /// Fixed further problems with Teensy compatibility for RH_RF22. Tested on Teensy 3.1. 00280 /// The example/rf22_* examples now run out of the box with the wiring connections as documented for Teensy 00281 /// in RH_RF22.<br> 00282 /// Added YIELDs to spin-loops in RHRouter, RHMesh and RHReliableDatagram, RH_NRF24.<br> 00283 /// Tested RH_Serial examples with Teensy 3.1: they now run out of the box.<br> 00284 /// Tested RH_ASK examples with Teensy 3.1: they now run out of the box.<br> 00285 /// Reduced default SPI speed for NRF24 from 8MHz to 1MHz on Teensy, to improve reliability when 00286 /// poor wiring is in use.<br> 00287 /// on some devices such as Teensy.<br> 00288 /// Tested RH_NRF24 examples with Teensy 3.1: they now run out of the box.<br> 00289 /// \version 1.5 2014-04-29<br> 00290 /// Added support for Nordic Semiconductor nRF905 transceiver with RH_NRF905 driver. Also 00291 /// added examples for nRF905 and tested on Teensy 3.1 00292 /// \version 1.6 2014-04-30<br> 00293 /// NRF905 examples were missing 00294 /// \version 1.7 2014-05-03<br> 00295 /// Added support for Arduino Due. Tested with RH_NRF905, RH_Serial, RH_ASK. 00296 /// IMPORTANT CHANGE to interrupt pins on Arduino with RH_RF22 and RH_RF69 constructors: 00297 /// previously, you had to specify the interrupt _number_ not the interrupt _pin_. Arduinos and Uno32 00298 /// are now consistent with all other platforms: you must specify the interrupt pin number. Default 00299 /// changed to pin 2 (a common choice with RF22 shields). 00300 /// Removed examples/maple/maple_rf22_reliable_datagram_client and 00301 /// examples/maple/maple_rf22_reliable_datagram_client since the rf22 examples now work out 00302 /// of the box with Flymaple. 00303 /// Removed examples/uno32/uno32_rf22_reliable_datagram_client and 00304 /// examples/uno32/uno32_rf22_reliable_datagram_client since the rf22 examples now work out 00305 /// of the box with ChipKit Uno32. 00306 /// \version 1.8 2014-05-08 <br> 00307 /// Added support for YIELD in Teensy 2 and 3, suggested by Steve Childress.<br> 00308 /// Documentation updates. Clarify use of headers and Flags<br> 00309 /// Fixed misalignment in RH_RF69 between ModemConfigChoice definitions and the implemented choices 00310 /// which meant you didnt get the choice you thought and GFSK_Rb55555Fd50 hung the transmitter.<br> 00311 /// Preliminary work on Linux simulator. 00312 /// \version 1.9 2014-05-14 <br> 00313 /// Added support for using Timer 2 instead of Timer 1 on Arduino in RH_ASK when 00314 /// RH_ASK_ARDUINO_USE_TIMER2 is defined. With the kind assistance of 00315 /// Luc Small. Thanks!<br> 00316 /// Updated comments in RHReliableDatagram concerning servers, retries, timeouts and delays. 00317 /// Fixed an error in RHReliableDatagram where recvfrom return value was not checked. 00318 /// Reported by Steve Childress.<br> 00319 /// Added Linux simulator support so simple RadioHead sketches can be compiled and run on Linux.<br> 00320 /// Added RH_TCP driver to permit message passing between simulated sketches on Linux.<br> 00321 /// Added example simulator sketches.<br> 00322 /// Added tools/etherSimulator.pl, a simulator of the 'Luminiferous Ether' that passes 00323 /// messages between simulated sketches and can simulate random message loss etc.<br> 00324 /// Fixed a number of typos and improved some documentation.<br> 00325 /// \version 1.10 2014-05-15 <br> 00326 /// Added support for RFM73 modules to RH_NRF24. These 2 radios are very similar, and can interoperate 00327 /// with each other. Added new RH_NRF24::TransmitPower enums for the RFM73, which has a different 00328 /// range of available powers<br> 00329 /// reduced the default SPI bus speed for RH_NRF24 to 1MHz, since so many modules and CPU have problems 00330 /// with 8MHz.<br> 00331 /// \version 1.11 2014-05-18<br> 00332 /// Testing RH_RF22 with RFM23BP and 3.3V Teensy 3.1 and 5V Arduinos. 00333 /// Updated documentation with respect to GPIO and antenna 00334 /// control pins for RFM23. Updated documentation with respect to transmitter power control for RFM23<br> 00335 /// Fixed a problem with RH_RF22 driver, where GPIO TX and RX pins were not configured during 00336 /// initialisation, causing poor transmit power and sensitivity on those RF22/RF23 devices where GPIO controls 00337 /// the antenna selection pins. 00338 /// \version 1.12 2014-05-20<br> 00339 /// Testing with RF69HW and the RH_RF69 driver. Works well with the Anarduino MiniWireless -CW and -HW 00340 /// boards http://www.anarduino.com/miniwireless/ including 00341 /// the marvellous high powered MinWireless-HW (with 20dBm output for excellent range).<br> 00342 /// Clarified documentation of RH_RF69::setTxPower values for different models of RF69.<br> 00343 /// Added RHReliableDatagram::resetRetransmissions().<br> 00344 /// Retransmission count precision increased to uin32_t.<br> 00345 /// Added data about actual power measurements from RFM22 module.<br> 00346 /// \version 1.13 2014-05-23<br> 00347 /// setHeaderFlags(flags) changed to setHeaderFlags(set, clear), enabling any flags to be 00348 /// individually set and cleared by either RadioHead or application code. Requested by Steve Childress.<br> 00349 /// Fixed power output setting for boost power on RF69HW for 18, 19 and 20dBm.<br> 00350 /// Added data about actual power measurements from RFM69W and RFM69HW modules.<br> 00351 /// \version 1.14 2014-05-26<br> 00352 /// RH_RF69::init() now always sets the PA boost back to the default settings, else can get invalid 00353 /// PA power modes after uploading new sketches without a power cycle. Reported by Bryan.<br> 00354 /// Added new macros RH_VERSION_MAJOR RH_VERSION_MINOR, with automatic maintenance in Makefile.<br> 00355 /// Improvements to RH_TCP: constructor now honours the server argument in the form "servername:port".<br> 00356 /// Added YIELD to RHReliableDatagram::recvfromAckTimeout. Requested by Steve Childress.<br> 00357 /// Fixed a problem with RH_RF22 reliable datagram acknowledgements that was introduced in version 1.13. 00358 /// Reported by Steve Childress.<br> 00359 /// \version 1.15 2014-05-27<br> 00360 /// Fixed a problem with the RadioHead .zip link. 00361 /// \version 1.16 2014-05-30 <br> 00362 /// Fixed RH_RF22 so that lastRssi() returns the signal strength in dBm. Suggested by Steve Childress.<br> 00363 /// Added support for getLastPreambleTime() to RH_RF69. Requested by Steve Childress.<br> 00364 /// RH_NRF24::init() now checks if there is a device connected and responding, else init() will fail. 00365 /// Suggested by Steve Brown.<br> 00366 /// RHSoftwareSPI now initialises default values for SPI pins MOSI = 12, MISO = 11 and SCK = 13.<br> 00367 /// Fixed some problems that prevented RH_NRF24 working with mixed software and hardware SPI 00368 /// on different devices: a race condition 00369 /// due to slow SPI transfers and fast acknowledgement.<br> 00370 /// \version 1.17 2014-06-02 <br> 00371 /// Fixed a debug typo in RHReliableDatagram that was introduced in 1.16.<br> 00372 /// RH_NRF24 now sets default power, data rate and channel in init(), in case another 00373 /// app has previously set different values without powerdown.<br> 00374 /// Caution: there are still problems with RH_NRF24 and Software SPI. Do not use.<br> 00375 /// \version 1.18 2014-06-02<br> 00376 /// Improvements to performance of RH_NRF24 statusRead, allowing RH_NRF24 and Software SPI 00377 /// to operate on slow devices like Arduino Uno.<br> 00378 /// \version 1.19 2014-06-19<br> 00379 /// Added examples ask_transmitter.pde and ask_receiver.pde.<br> 00380 /// Fixed an error in the RH_RF22 doc for connection of Teensy to RF22.<br> 00381 /// Improved documentation of start symbol bit patterns in RH_ASK.cpp 00382 /// \version 1.20 2014-06-24<br> 00383 /// Fixed a problem with compiling on platforms such as ATTiny where SS is not defined.<br> 00384 /// Added YIELD to RHMesh::recvfromAckTimeout().<br> 00385 /// \version 1.21 2014-06-24<br> 00386 /// Fixed an issue in RH_Serial where characters might be lost with back-to-back frames. 00387 /// Suggested by Steve Childress.<br> 00388 /// Brought previous RHutil/crc16.h code into mainline RHCRC.cpp to prevent name collisions 00389 /// with other similarly named code in other libraries. Suggested by Steve Childress.<br> 00390 /// Fix SPI bus speed errors on 8MHz Arduinos. 00391 /// \version 1.22 2014-07-01<br> 00392 /// Update RH_ASK documentation for common wiring connections.<br> 00393 /// Testing RH_ASK with HopeRF RFM83C/RFM85 courtesy Anarduino http://www.anarduino.com/<br> 00394 /// Testing RH_NRF24 with Itead Studio IBoard Pro http://imall.iteadstudio.com/iboard-pro.html 00395 /// using both hardware SPI on the ITDB02 Parallel LCD Module Interface pins and software SPI 00396 /// on the nRF24L01+ Module Interface pins. Documented wiring required.<br> 00397 /// Added support for AVR 1284 and 1284p, contributed by Peter Scargill. 00398 /// Added support for Semtech SX1276/77/78 and HopeRF RFM95/96/97/98 and other similar LoRa capable radios 00399 /// in LoRa mode only. Tested with the excellent MiniWirelessLoRa from 00400 /// Anarduino http://www.anarduino.com/miniwireless<br> 00401 /// \version 1.23 2014-07-03<br> 00402 /// Changed the default modulation for RH_RF69 to GFSK_Rb250Fd250, since the previous default 00403 /// was not very reliable.<br> 00404 /// Documented RH_RF95 range tests.<br> 00405 /// Improvements to RH_RF22 RSSI readings so that lastRssi correctly returns the last message in dBm.<br> 00406 /// \version 1.24 2014-07-18 00407 /// Added support for building RadioHead for STM32F4 Discovery boards, using the native STM Firmware libraries, 00408 /// in order to support Codec2WalkieTalkie (http://www.airspayce.com/mikem/Codec2WalkieTalkie) 00409 /// and other projects. See STM32ArduinoCompat.<br> 00410 /// Default modulation for RH_RF95 was incorrectly set to a very slow Bw125Cr48Sf4096 00411 /// \version 1.25 2014-07-25 00412 /// The available() function will longer terminate any current transmission, and force receive mode. 00413 /// Now, if there is no unprocessed incoming message and an outgoing message is currently being transmitted, 00414 /// available() will return false.<br> 00415 /// RHRouter::sendtoWait(uint8_t*, uint8_t, uint8_t, uint8_t) renamed to sendtoFromSourceWait due to conflicts 00416 /// with new sendtoWait() with optional flags.<br> 00417 /// RHMEsh and RHRouter already supported end-to-end application layer flags, but RHMesh::sendtoWait() 00418 /// and RHRouter::sendToWait have now been extended to expose a way to send optional application layer flags. 00419 /// \version 1.26 2014-08-12 00420 /// Fixed a Teensy 2.0 compile problem due yield() not available on Teensy < 3.0. <br> 00421 /// Adjusted the algorithm of RH_RF69::temperatureRead() to more closely reflect reality.<br> 00422 /// Added functions to RHGenericDriver to get driver packet statistics: rxBad(), rxGood(), txGood().<br> 00423 /// Added RH_RF69::printRegisters().<br> 00424 /// RH_RF95::printRegisters() was incorrectly printing the register index instead of the address. 00425 /// Reported by Phang Moh Lim.<br> 00426 /// RH_RF95, added definitions for some more registers that are usable in LoRa mode.<br> 00427 /// RH_RF95::setTxPower now uses RH_RF95_PA_DAC_ENABLE to achieve 21, 22 and 23dBm.<br> 00428 /// RH_RF95, updated power output measurements.<br> 00429 /// Testing RH_RF69 on Teensy 3.1 with RF69 on PJRC breakout board. OK.<br> 00430 /// Improvements so RadioHead will build under Arduino where SPI is not supported, such as 00431 /// ATTiny.<br> 00432 /// Improvements so RadioHead will build for ATTiny using Arduino IDE and tinycore arduino-tiny-0100-0018.zip.<br> 00433 /// Testing RH_ASK on ATTiny85. Reduced RAM footprint. 00434 /// Added helpful documentation. Caution: RAM memory is *very* tight on this platform.<br> 00435 /// RH_RF22 and RH_RF69, added setIdleMode() function to allow the idle mode radio operating state 00436 /// to be controlled for lower idle power consumption at the expense of slower transitions to TX and RX.<br> 00437 /// \version 1.27 2014-08-13 00438 /// All RH_RF69 modulation schemes now have data whitening enabled by default.<br> 00439 /// Tested and added a number of OOK modulation schemes to RH_RF69 Modem config table.<br> 00440 /// Minor improvements to a number of the faster RH_RF69 modulation schemes, but some slower ones 00441 /// are still not working correctly.<br> 00442 /// \version 1.28 2014-08-20 00443 /// Added new RH_RF24 driver to support Si446x, RF24/26/26, RFM24/26/27 family of transceivers. 00444 /// Tested with the excellent 00445 /// Anarduino Mini and RFM24W and RFM26W with the generous assistance of the good people at 00446 /// Anarduino http://www.anarduino.com. 00447 /// \version 1.29 2014-08-21 00448 /// Fixed a compile error in RH_RF24 introduced at the last minute in hte previous release.<br> 00449 /// Improvements to RH_RF69 modulation schemes: now include the AFCBW in teh ModemConfig.<br> 00450 /// ModemConfig RH_RF69::FSK_Rb2Fd5 and RH_RF69::GFSK_Rb2Fd5 are now working.<br> 00451 /// \version 1.30 2014-08-25 00452 /// Fixed some compile problems with ATtiny84 on Arduino 1.5.5 reported by Glen Cook.<br> 00453 /// \version 1.31 2014-08-27 00454 /// Changed RH_RF69 FSK and GFSK modulations from Rb2_4Fd2_4 to Rb2_4Fd4_8 and FSK_Rb4_8Fd4_8 to FSK_Rb4_8Fd9_6 00455 /// since the previous ones were unreliable (they had modulation indexes of 1).<br> 00456 /// \version 1.32 2014-08-28 00457 /// Testing with RedBearLab Blend board http://redbearlab.com/blend/. OK.<br> 00458 /// Changed more RH_RF69 FSK and GFSK slowish modulations to have modulation index of 2 instead of 1. 00459 /// This required chnaging the symbolic names.<br> 00460 /// \version 1.33 2014-09-01 00461 /// Added support for sleep mode in RHGeneric driver, with new mode 00462 /// RHModeSleep and new virtual function sleep().<br> 00463 /// Added support for sleep to RH_RF69, RH_RF22, RH_NRF24, RH_RF24, RH_RF95 drivers.<br> 00464 /// \version 1.34 2014-09-19 00465 /// Fixed compile errors in example rf22_router_test.<br> 00466 /// Fixed a problem with RH_NRF24::setNetworkAddress, also improvements to RH_NRF24 register printing. 00467 /// Patched by Yveaux.<br> 00468 /// Improvements to RH_NRF24 initialisation for version 2.0 silicon.<br> 00469 /// Fixed problem with ambigiguous print call in RH_RFM69 when compiling for Codec2.<br> 00470 /// Fixed a problem with RH_NRF24 on RFM73 where the LNA gain was not set properly, reducing the sensitivity 00471 /// of the receiver. 00472 /// \version 1.35 2014-09-19 00473 /// Fixed a problem with interrupt setup on RH_RF95 with Teensy3.1. Reported by AD.<br> 00474 /// \version 1.36 2014-09-22 00475 /// Improvements to interrupt pin assignments for __AVR_ATmega1284__ and__AVR_ATmega1284P__, provided by 00476 /// Peter Scargill.<br> 00477 /// Work around a bug in Arduino 1.0.6 where digitalPinToInterrupt is defined but NOT_AN_INTERRUPT is not.<br> 00478 /// \version 1.37 2014-10-19 00479 /// Updated doc for connecting RH_NRF24 to Arduino Mega.<br> 00480 /// Changes to RHGenericDriver::setHeaderFlags(), so that the default for the clear argument 00481 /// is now RH_FLAGS_APPLICATION_SPECIFIC, which is less surprising to users. 00482 /// Testing with the excellent MoteinoMEGA from LowPowerLab 00483 /// https://lowpowerlab.com/shop/moteinomega with on-board RFM69W. 00484 /// \version 1.38 2014-12-29 00485 /// Fixed compile warning on some platforms where RH_RF24::send and RH_RF24::writeTxFifo 00486 /// did not return a value.<br> 00487 /// Fixed some more compiler warnings in RH_RF24 on some platforms.<br> 00488 /// Refactored printRegisters for some radios. Printing to Serial 00489 /// is now controlled by the definition of RH_HAVE_SERIAL.<br> 00490 /// Added partial support for ARM M4 w/CMSIS with STM's Hardware Abstraction lib for 00491 /// Steve Childress.<br> 00492 /// \version 1.39 2014-12-30 00493 /// Fix some compiler warnings under IAR.<br> 00494 /// RH_HAVE_SERIAL and Serial.print calls removed for ATTiny platforms.<br> 00495 /// \version 1.40 2015-03-09 00496 /// Added notice about availability on PlatformIO, thanks to Ivan Kravets.<br> 00497 /// Fixed a problem with RH_NRF24 where short packet lengths would occasionally not be trasmitted 00498 /// due to a race condition with RH_NRF24_TX_DS. Reported by Mark Fox.<br> 00499 /// \version 1.41 2015-03-29 00500 /// RH_RF22, RH_RF24, RH_RF69 and RH_RF95 improved to allow driver.init() to be called multiple 00501 /// times without reallocating a new interrupt, allowing the driver to be reinitialised 00502 /// after sleeping or powering down. 00503 /// \version 1.42 2015-05-17 00504 /// Added support for RH_NRF24 driver on Raspberry Pi, using BCM2835 00505 /// library for GPIO pin IO. Contributed by Mike Poublon.<br> 00506 /// Tested RH_NRF24 module with NRF24L01+PA+LNA SMA Antenna Wireless Transceiver modules 00507 /// similar to: http://www.elecfreaks.com/wiki/index.php?title=2.4G_Wireless_nRF24L01p_with_PA_and_LNA 00508 /// works with no software changes. Measured max power output 18dBm.<br> 00509 /// \version 1.43 2015-08-02 00510 /// Added RH_NRF51 driver to support Nordic nRF51 family processor with 2.4GHz radio such 00511 /// as nRF51822, to be built on Arduino 1.6.4 and later. Tested with RedBearLabs nRF51822 board 00512 /// and BLE Nano kit<br> 00513 /// \version 1.44 2015-08-08 00514 /// Fixed errors with compiling on some platforms without serial, such as ATTiny. 00515 /// Reported by Friedrich Müller.<br> 00516 /// \version 1.45 2015-08-13 00517 /// Added support for using RH_Serial on Linux and OSX (new class RHutil/HardwareSerial 00518 /// encapsulates serial ports on those platforms). Example examples/serial*/* upgraded 00519 /// to build and run on Linux and OSX using the tools/simBuild builder. 00520 /// RHMesh, RHRouter and RHReliableDatagram updated so they can use RH_Serial without 00521 /// polling loops on Linux and OSX for CPU efficiency.<br> 00522 /// \version 1.46 2015-08-14 00523 /// Amplified some doc concerning Linux and OSX RH_Serial. Added support for 230400 00524 /// baud rate in HardwareSerial.<br> 00525 /// Added sample sketches nrf51_audio_tx and nrf51_audio_rx which show how to 00526 /// build an audio TX/RX pair with RedBear nRF51822 boards and a SparkFun MCP4725 DAC board. 00527 /// Uses the built-in ADC of the nRF51822 to sample audio at 5kHz and transmit packets 00528 /// to the receiver which plays them via the DAC.<br> 00529 /// \version 1.47 2015-09-18 00530 /// Removed top level Makefile from distribution: its only used by the developer and 00531 /// its presence confuses some people.<br> 00532 /// Fixed a problem with RHReliableDatagram with some versions of Raspberry Pi random() that causes 00533 /// problems: random(min, max) sometimes exceeds its max limit. 00534 /// \version 1.48 2015-09-30 00535 /// Added support for Arduino Zero. Tested on Arduino Zero Pro. 00536 /// 00537 /// \author Mike McCauley. DO NOT CONTACT THE AUTHOR DIRECTLY. USE THE MAILING LIST GIVEN ABOVE 00538 00539 #ifndef RadioHead_h 00540 #define RadioHead_h 00541 00542 // Official version numbers are maintained automatically by Makefile: 00543 #define RH_VERSION_MAJOR 1 00544 #define RH_VERSION_MINOR 48 00545 00546 // Symbolic names for currently supported platform types 00547 #define RH_PLATFORM_ARDUINO 1 00548 #define RH_PLATFORM_MSP430 2 00549 #define RH_PLATFORM_STM32 3 00550 #define RH_PLATFORM_GENERIC_AVR8 4 00551 #define RH_PLATFORM_UNO32 5 00552 #define RH_PLATFORM_UNIX 6 00553 #define RH_PLATFORM_STM32STD 7 00554 #define RH_PLATFORM_STM32F4_HAL 8 00555 #define RH_PLATFORM_RASPI 9 00556 #define RH_PLATFORM_NRF51 10 00557 00558 //////////////////////////////////////////////////// 00559 // Select platform automatically, if possible 00560 #ifndef RH_PLATFORM 00561 #if defined(MPIDE) 00562 #define RH_PLATFORM RH_PLATFORM_UNO32 00563 #elif defined(NRF51) 00564 #define RH_PLATFORM RH_PLATFORM_NRF51 00565 #elif defined(ARDUINO) 00566 #define RH_PLATFORM RH_PLATFORM_ARDUINO 00567 #elif defined(__MSP430G2452__) || defined(__MSP430G2553__) 00568 #define RH_PLATFORM RH_PLATFORM_MSP430 00569 #elif defined(MCU_STM32F103RE) 00570 #define RH_PLATFORM RH_PLATFORM_STM32 00571 #elif defined(USE_STDPERIPH_DRIVER) 00572 #define RH_PLATFORM RH_PLATFORM_STM32STD 00573 #elif defined(RASPBERRY_PI) 00574 #define RH_PLATFORM RH_PLATFORM_RASPI 00575 #elif defined(__unix__) // Linux 00576 #define RH_PLATFORM RH_PLATFORM_UNIX 00577 #elif defined(__APPLE__) // OSX 00578 #define RH_PLATFORM RH_PLATFORM_UNIX 00579 #elif defined(__MBED__) // mbed 00580 #define RH_PLATFORM RH_PLATFORM_MBED 00581 #else 00582 #error Platform not defined! 00583 #endif 00584 #endif 00585 00586 #if defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtinyX4__) || defined(__AVR_ATtinyX5__) || defined(__AVR_ATtiny2313__) || defined(__AVR_ATtiny4313__) || defined(__AVR_ATtinyX313__) 00587 #define RH_PLATFORM_ATTINY 00588 #endif 00589 00590 //////////////////////////////////////////////////// 00591 // Platform specific headers: 00592 #if (RH_PLATFORM == RH_PLATFORM_ARDUINO) 00593 #if (ARDUINO >= 100) 00594 #include <Arduino.h> 00595 #else 00596 #include <wiring.h> 00597 #endif 00598 #ifdef RH_PLATFORM_ATTINY 00599 #warning Arduino TinyCore does not support hardware SPI. Use software SPI instead. 00600 #else 00601 #include <SPI.h> 00602 #define RH_HAVE_HARDWARE_SPI 00603 #define RH_HAVE_SERIAL 00604 #endif 00605 00606 #elif (RH_PLATFORM == RH_PLATFORM_MSP430) // LaunchPad specific 00607 #include "legacymsp430.h" 00608 #include "Energia.h" 00609 #include <SPI.h> 00610 #define RH_HAVE_HARDWARE_SPI 00611 #define RH_HAVE_SERIAL 00612 00613 #elif (RH_PLATFORM == RH_PLATFORM_UNO32) 00614 #include <WProgram.h> 00615 #include <string.h> 00616 #include <SPI.h> 00617 #define RH_HAVE_HARDWARE_SPI 00618 #define memcpy_P memcpy 00619 #define RH_HAVE_SERIAL 00620 00621 #elif (RH_PLATFORM == RH_PLATFORM_STM32) // Maple, Flymaple etc 00622 #include <wirish.h> 00623 #include <stdint.h> 00624 #include <string.h> 00625 #include <HardwareSPI.h> 00626 #define RH_HAVE_HARDWARE_SPI 00627 // Defines which timer to use on Maple 00628 #define MAPLE_TIMER 1 00629 #define PROGMEM 00630 #define memcpy_P memcpy 00631 #define Serial SerialUSB 00632 #define RH_HAVE_SERIAL 00633 00634 #elif (RH_PLATFORM == RH_PLATFORM_STM32STD) // STM32 with STM32F4xx_StdPeriph_Driver 00635 #include <stm32f4xx.h> 00636 #include <wirish.h> 00637 #include <stdint.h> 00638 #include <string.h> 00639 #include <math.h> 00640 #include <HardwareSPI.h> 00641 #define RH_HAVE_HARDWARE_SPI 00642 #define Serial SerialUSB 00643 #define RH_HAVE_SERIAL 00644 00645 #elif (RH_PLATFORM == RH_PLATFORM_GENERIC_AVR8) 00646 #include <avr/io.h> 00647 #include <avr/interrupt.h> 00648 #include <util/delay.h> 00649 #include <string.h> 00650 #include <stdbool.h> 00651 #define RH_HAVE_HARDWARE_SPI 00652 #include <SPI.h> 00653 00654 // For Steve Childress port to ARM M4 w/CMSIS with STM's Hardware Abstraction lib. 00655 // See ArduinoWorkarounds.h (not supplied) 00656 #elif (RH_PLATFORM == RH_PLATFORM_STM32F4_HAL) 00657 #include <ArduinoWorkarounds.h> 00658 #include <stm32f4xx.h> // Also using ST's CubeMX to generate I/O and CPU setup source code for IAR/EWARM, not GCC ARM. 00659 #include <stdint.h> 00660 #include <string.h> 00661 #include <math.h> 00662 #define RH_HAVE_HARDWARE_SPI // using HAL (Hardware Abstraction Libraries from ST along with CMSIS, not arduino libs or pins concept. 00663 00664 #elif (RH_PLATFORM == RH_PLATFORM_RASPI) 00665 #define RH_HAVE_HARDWARE_SPI 00666 #define RH_HAVE_SERIAL 00667 #define PROGMEM 00668 #include <RHutil/RasPi.h> 00669 #include <string.h> 00670 //Define SS for CS0 or pin 24 00671 #define SS 8 00672 00673 #elif (RH_PLATFORM == RH_PLATFORM_NRF51) 00674 #define RH_HAVE_SERIAL 00675 #define PROGMEM 00676 #include <Arduino.h> 00677 00678 #elif (RH_PLATFORM == RH_PLATFORM_UNIX) 00679 // Simulate the sketch on Linux and OSX 00680 #include <RHutil/simulator.h> 00681 #define RH_HAVE_SERIAL 00682 00683 #elif (RH_PLATFORM == RH_PLATFORM_MBED) 00684 #include <mbed.h> 00685 #define RH_HAVE_HARDWARE_SPI 00686 00687 extern Timer _millisTimer; 00688 00689 #define PROGMEM 00690 00691 #define HIGH 1 00692 #define LOW 0 00693 00694 #define millis() _millisTimer.read_ms() 00695 #define delay(ms) wait_us(ms*1000) 00696 #define digitalWrite(pin, val) pin = val 00697 #define digitalRead(pin) pin 00698 #define memcpy_P memcpy 00699 00700 #else 00701 #error Platform unknown! 00702 #endif 00703 00704 00705 #if (RH_PLATFORM == RH_PLATFORM_MBED) 00706 #define PINS PinName 00707 #else 00708 #define PINS uint8_t 00709 #endif 00710 00711 //////////////////////////////////////////////////// 00712 // This is an attempt to make a portable atomic block 00713 #if (RH_PLATFORM == RH_PLATFORM_ARDUINO) 00714 #if defined(__arm__) 00715 #include <RHutil/atomic.h> 00716 #else 00717 #include <util/atomic.h> 00718 #endif 00719 #define ATOMIC_BLOCK_START ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { 00720 #define ATOMIC_BLOCK_END } 00721 #elif (RH_PLATFORM == RH_PLATFORM_UNO32) 00722 #include <peripheral/int.h> 00723 #define ATOMIC_BLOCK_START unsigned int __status = INTDisableInterrupts(); { 00724 #define ATOMIC_BLOCK_END } INTRestoreInterrupts(__status); 00725 #else 00726 // Disabling interrupts not working for your OS (like mbed) 00727 #define ATOMIC_BLOCK_START 00728 #define ATOMIC_BLOCK_END 00729 #endif 00730 00731 //////////////////////////////////////////////////// 00732 // Try to be compatible with systems that support yield() and multitasking 00733 // instead of spin-loops 00734 // Recent Arduino IDE or Teensy 3 has yield() 00735 #if (RH_PLATFORM == RH_PLATFORM_ARDUINO && ARDUINO >= 155 && !defined(RH_PLATFORM_ATTINY)) || (TEENSYDUINO && defined(__MK20DX128__)) 00736 #define YIELD yield(); 00737 #elif (RH_PLATFORM == RH_PLATFORM_MBED) 00738 #define YIELD ThisThread::yield(); 00739 #else 00740 #warning YIELD not enabled 00741 #define YIELD 00742 #endif 00743 00744 //////////////////////////////////////////////////// 00745 // digitalPinToInterrupt is not available prior to Arduino 1.5.6 and 1.0.6 00746 // See http://arduino.cc/en/Reference/attachInterrupt 00747 #ifndef NOT_AN_INTERRUPT 00748 #define NOT_AN_INTERRUPT -1 00749 #endif 00750 #ifndef digitalPinToInterrupt 00751 #if (RH_PLATFORM == RH_PLATFORM_ARDUINO) && !defined(__arm__) 00752 00753 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) 00754 // Arduino Mega, Mega ADK, Mega Pro 00755 // 2->0, 3->1, 21->2, 20->3, 19->4, 18->5 00756 #define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : ((p) >= 18 && (p) <= 21 ? 23 - (p) : NOT_AN_INTERRUPT))) 00757 00758 #elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) 00759 // Arduino 1284 and 1284P - See Manicbug and Optiboot 00760 // 10->0, 11->1, 2->2 00761 #define digitalPinToInterrupt(p) ((p) == 10 ? 0 : ((p) == 11 ? 1 : ((p) == 2 ? 2 : NOT_AN_INTERRUPT))) 00762 00763 #elif defined(__AVR_ATmega32U4__) 00764 // Leonardo, Yun, Micro, Pro Micro, Flora, Esplora 00765 // 3->0, 2->1, 0->2, 1->3, 7->4 00766 #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) 00767 00768 #else 00769 // All other arduino except Due: 00770 // Serial Arduino, Extreme, NG, BT, Uno, Diecimila, Duemilanove, Nano, Menta, Pro, Mini 04, Fio, LilyPad, Ethernet etc 00771 // 2->0, 3->1 00772 #define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT)) 00773 00774 #endif 00775 00776 #elif (RH_PLATFORM == RH_PLATFORM_UNO32) 00777 #define digitalPinToInterrupt(p) ((p) == 38 ? 0 : ((p) == 2 ? 1 : ((p) == 7 ? 2 : ((p) == 8 ? 3 : ((p) == 735 ? 4 : NOT_AN_INTERRUPT))))) 00778 00779 #else 00780 // Everything else (including Due and Teensy) interrupt number the same as the interrupt pin number 00781 #define digitalPinToInterrupt(p) (p) 00782 #endif 00783 #endif 00784 00785 // Slave select pin, some platforms such as ATTiny do not define it. 00786 #ifndef SS 00787 #define SS 10 00788 #endif 00789 00790 // These defs cause trouble on some versions of Arduino 00791 #undef abs 00792 #undef round 00793 #undef double 00794 00795 // This is the address that indicates a broadcast 00796 #define RH_BROADCAST_ADDRESS 0xff 00797 00798 #endif
Generated on Thu Jul 14 2022 12:14:49 by
1.7.2