RadioHead
RadioHead.h
1// RadioHead.h
2// Author: Mike McCauley DO NOT CONTACT THE AUTHOR DIRECTLY
3// Copyright (C) 2014 Mike McCauley
4// $Id: RadioHead.h,v 1.89 2020/08/05 04:32:19 mikem Exp mikem $
5
6/*! \mainpage RadioHead Packet Radio library for embedded microprocessors
7
8This is the RadioHead Packet Radio library for embedded microprocessors.
9It provides a complete object-oriented library for sending and receiving packetized messages
10via a variety of common data radios and other transports on a range of embedded microprocessors.
11
12\par Download
13
14The version of the package that this documentation refers to can be downloaded
15from http://www.airspayce.com/mikem/arduino/RadioHead/RadioHead-1.136.zip
16
17You can always find the latest version of the documentation at
18http://www.airspayce.com/mikem/arduino/RadioHead
19
20You can also find online help and discussion at
21http://groups.google.com/group/radiohead-arduino
22Please use that group for all questions and discussions on this topic.
23Do not contact the author directly, unless it is to discuss commercial licensing.
24Before asking a question or reporting a bug, please read
25- http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/How_to_ask_a_software_question
26- http://www.catb.org/esr/faqs/smart-questions.html
27- http://www.chiark.greenend.org.uk/~shgtatham/bugs.html
28
29Caution: Developing this type of software and using data radios
30successfully is challenging and requires a substantial knowledge
31base in software and radio and data transmission technologies and
32theory. It may not be an appropriate project for beginners. If
33you are a beginner, you will need to spend some time gaining
34knowledge in these areas first.
35
36\par Overview
37
38RadioHead consists of 2 main sets of classes: Drivers and Managers.
39
40- Drivers provide low level access to a range of different packet radios and other packetized message transports.
41- Managers provide high level message sending and receiving facilities for a range of different requirements.
42
43Every RadioHead program will have an instance of a Driver to
44provide access to the data radio or transport, and usually a
45Manager that uses that driver to send and receive messages for the
46application. The programmer is required to instantiate a Driver
47and a Manager, and to initialise the Manager. Thereafter the
48facilities of the Manager can be used to send and receive
49messages.
50
51It is also possible to use a Driver on its own, without a Manager, although this only allows unaddressed,
52unreliable transport via the Driver's facilities.
53
54In some specialised use cases, it is possible to instantiate more than one Driver and more than one Manager.
55
56A range of different common embedded microprocessor platforms are supported, allowing your project to run
57on your choice of processor.
58
59Example programs are included to show the main modes of use.
60
61\par Drivers
62
63The following Drivers are provided:
64
65- RH_RF22
66Works with Hope-RF
67RF22B and RF23B based transceivers, and compatible chips and modules,
68including the RFM22B transceiver module such as
69hthis bare module: http://www.sparkfun.com/products/10153
70and this shield: http://www.sparkfun.com/products/11018
71and this board: http://www.anarduino.com/miniwireless
72and RF23BP modules such as: http://www.anarduino.com/details.jsp?pid=130
73Supports GFSK, FSK and OOK. Access to other chip
74features such as on-chip temperature measurement, analog-digital
75converter, transmitter power control etc is also provided.
76
77- RH_RF24
78Works with Silicon Labs Si4460/4461/4463/4464 family of transceivers chip, and the equivalent
79HopeRF RF24/26/27 family of chips and the HopeRF RFM24W/26W/27W modules.
80Supports GFSK, FSK and OOK. Access to other chip
81features such as on-chip temperature measurement, analog-digital
82converter, transmitter power control etc is also provided.
83
84- RH_RF69
85Works with Hope-RF
86RF69B based radio modules, such as the RFM69 module, (as used on the excellent Moteino and Moteino-USB
87boards from LowPowerLab http://lowpowerlab.com/moteino/ )
88and compatible chips and modules such as RFM69W, RFM69HW, RFM69CW, RFM69HCW (Semtech SX1231, SX1231H).
89Also works with Anarduino MiniWireless -CW and -HW boards http://www.anarduino.com/miniwireless/ including
90the marvellous high powered MinWireless-HW (with 20dBm output for excellent range).
91Supports GFSK, FSK.
92
93- RH_NRF24
94Works with Nordic nRF24 based 2.4GHz radio modules, such as nRF24L01 and others.
95Also works with Hope-RF RFM73
96and compatible devices (such as BK2423). nRF24L01 and RFM73 can interoperate
97with each other.
98
99- RH_NRF905
100Works with Nordic nRF905 based 433/868/915 MHz radio modules.
101
102- RH_NRF51
103Works with Nordic nRF51 compatible 2.4 GHz SoC/devices such as the nRF51822.
104Also works with Sparkfun nRF52832 breakout board, with Arduino 1.8.9 and
105Sparkfun nRF52 boards manager 0.2.3.
106
107- RH_RF95
108Works with Semtech SX1276/77/78/79, Modtronix inAir4 and inAir9,
109and HopeRF RFM95/96/97/98 and other similar LoRa capable radios.
110Supports Long Range (LoRa) with spread spectrum frequency hopping, large payloads etc.
111FSK/GFSK/OOK modes are not (yet) supported.
112Also works with the same chips on Linux using LoRa-file-ops Linux driver ioctls to
113transmit and receive RadioHead compatible messages.
114Requires a modified version of LoRa-file-ops driver to be installed,
115and a compatible radio to be connected appropriately:
116https://github.com/starnight/LoRa/tree/file-ops
117See the RH_LoRaFileOps class documentation for more information.
118
119- RH_MRF89
120Works with Microchip MRF89XA and compatible transceivers.
121and modules such as MRF89XAM9A and MRF89XAM8A.
122
123- RH_CC110
124Works with Texas Instruments CC110L transceivers and compatible modules such as
125Anaren AIR BoosterPack 430BOOST-CC110L
126
127- RH_E32
128Works with EBYTE E32-TTL-1W serial radio transceivers (and possibly other transceivers in the same family)
129
130- RH_ASK
131Works with a range of inexpensive ASK (amplitude shift keying) RF transceivers such as RX-B1
132(also known as ST-RX04-ASK) receiver; TX-C1 transmitter and DR3100 transceiver; FS1000A/XY-MK-5V transceiver;
133HopeRF RFM83C / RFM85. Supports ASK (OOK).
134
135- RH_ABZ
136Works with EcoNode SmartTrap, Tlera Grasshopper and family. Almost any board equipped with a muRata cmwx1zzabz module
137should work. Tested with EcoNode SmartTrap, Arduino 1.8.9, GrumpyOldPizza Arduino Core for STM32L0.
138When building for EcoNode SmartTrap in Arduino IDE, select board type Grasshopper-L082CZ.
139This chip and GrumpyOldPizza Arduino Core for STM32L0 are now supported by PlatformIO:
140https://docs.platformio.org/en/latest/platforms/ststm32.html#arduino-stm32l0-configuration-system
141
142- RH_SX126x
143Works with Semtech SX1261/2/8 LoRa capable transceivers.
144Can be confgigured to automatically controls any digital output pins required to control external RF switches or amplifiers.
145Tested with NiceRF LoRa1268-915 and Teensy 3.1.
146https://www.nicerf.com/lora-module/915mhz-lora-module-lora1262.html
147
148- RH_STM32WLx
149Works with STM32WLE5xx and STM32WLE4xx family processors that include a SX1261/2 multi power amplifier transceiver.
150Automatically manages the dedicated SPI interface and interrupt, and the internal SPI slave select and reset pins to the radio.
151Examples provided. Requires the stm32duino package using these instructions:
152https://community.st.com/t5/stm32-mcus/stm32-arduino-stm32duino-tutorial/ta-p/49649
153
154- RH_Serial
155Works with RS232, RS422, RS485, RS488 and other point-to-point and multidropped serial connections,
156or with TTL serial UARTs such as those on Arduino and many other processors,
157or with data radios with a
158serial port interface. RH_Serial provides packetization and error detection over any hardware or
159virtual serial connection. Also builds and runs on Linux and OSX.
160
161- RH_TCP
162For use with simulated sketches compiled and running on Linux.
163Works with tools/etherSimulator.pl to pass messages between simulated sketches, allowing
164testing of Manager classes on Linux and without need for real radios or other transport hardware.
165
166- RHEncryptedDriver
167Adds encryption and decryption to any RadioHead transport driver, using any encrpytion cipher
168supported by ArduinoLibs Cryptographic Library http://rweather.github.io/arduinolibs/crypto.html
169which also supports the newly adopted ASCON lightweight cryptography standard for IoT, as announced by
170National Institute of Standards and Technology (NIST).
171
172Drivers can be used on their own to provide unaddressed, unreliable datagrams.
173All drivers have the same identical API.
174Or you can use any Driver with any of the Managers described below.
175
176We welcome contributions of well tested and well documented code to support other transports.
177
178If your radio or transciever is not on the list above, there is a good chance it
179wont work without modifying RadioHead to suit it. If you wish for
180support for another radio or transciever, and you send 2 of them to
181AirSpayce Pty Ltd, we will consider adding support for it.
182
183\par Managers
184
185The drivers above all provide for unaddressed, unreliable, variable
186length messages, but if you need more than that, the following
187Managers are provided:
188
189- RHDatagram
190 Addressed, unreliable variable length messages, with optional broadcast facilities.
191
192- RHReliableDatagram
193 Addressed, reliable, retransmitted, acknowledged variable length messages.
194
195- RHRouter
196 Multi-hop delivery of RHReliableDatagrams from source node to destination node via 0 or more
197 intermediate nodes, with manual, pre-programmed routing.
198
199- RHMesh
200 Multi-hop delivery of RHReliableDatagrams with automatic route discovery and rediscovery.
201
202Any Manager may be used with any Driver.
203
204\par Platforms
205
206A range of processors and platforms are supported:
207
208- Arduino and the Arduino IDE (version 1.0 to 1.8.1 and 2.1.1 and later)
209Including Diecimila, Uno, Mega, Leonardo, Yun, Due, Zero, Minima and possibly others from http://arduino.cc/,
210 Also similar boards such as
211 - Moteino http://lowpowerlab.com/moteino/
212 - Anarduino Mini http://www.anarduino.com/mini/
213 - RedBearLab Blend V1.0 http://redbearlab.com/blend/ (with Arduino 1.0.5 and RedBearLab Blend Add-On version 20140701)
214 - MoteinoMEGA https://lowpowerlab.com/shop/moteinomega
215 (with Arduino 1.0.5 and the MoteinoMEGA Arduino Core
216 https://github.com/LowPowerLab/Moteino/tree/master/MEGA/Core)
217 - ESP8266 on Arduino IDE and Boards Manager per https://github.com/esp8266/Arduino
218 Tested using Arduino 1.6.8 with esp8266 by ESP8266 Community version 2.1.0
219 Also Arduino 1.8.1 with esp8266 by SparkFun Electronics 2.5.2
220 Examples serial_reliable_datagram_* and ask_* are shown to work.
221 CAUTION: The GHz radio included in the ESP8266 is
222 not yet supported.
223 CAUTION: tests here show that when powered by an FTDI USB-Serial converter,
224 the ESP8266 can draw so much power when transmitting on its GHz WiFi that VCC will sag
225 causing random crashes. We strongly recommend a large cap, say 1000uF 10V on VCC if you are also using the WiFi.
226 - Various Talk2 Whisper boards eg https://wisen.com.au/store/products/whisper-node-lora.
227 Use Arduino Board Manager to install the Talk2 code support.
228 - etc.
229
230- STM32 F4 Discover board, using Arduino 1.8.2 or later and
231 Roger Clarkes Arduino_STM from https://github.com/rogerclarkmelbourne/Arduino_STM32
232 Caution: with this library and board, sending text to Serial causes the board to hang in mysterious ways.
233 Serial2 emits to PA2. The default SPI pins are SCK: PB3, MOSI PB5, MISO PB4.
234 We tested with PB0 as slave select and PB1 as interrupt pin for various radios. RH_ASK and RH_Serial also work.
235 Also works with stm32duino 1.8.0 from https://github.com/stm32duino/Arduino_Core_STM32, wich can be
236 installed on Arduino with BoardManager. Select board: STM32 Discovery F407.
237
238- ChipKIT Core with Arduino IDE on any ChipKIT Core supported Digilent processor (tested on Uno32)
239 http://chipkit.net/wiki/index.php?title=ChipKIT_core
240
241- Maple and Flymaple boards with libmaple and the Maple-IDE development environment
242 http://leaflabs.com/devices/maple/ and http://www.open-drone.org/flymaple
243
244- Teensy including Teensy 3.1 and earlier built using Arduino IDE 1.0.5 to 1.6.4 and later with
245 teensyduino addon 1.18 to 1.23 and later.
246 http://www.pjrc.com/teensy
247
248- Particle Photon https://store.particle.io/collections/photon and ARM3 based CPU with built-in
249 Wi-Fi transceiver and extensive IoT software suport. RadioHead does not support the built-in transceiver
250 but can be used to control other SPI based radios, Serial ports etc.
251 See below for details on how to build RadioHead for Photon
252
253- ATTiny built using Arduino IDE 1.8 and the ATTiny core from
254 https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
255 using the instructions at
256 https://medium.com/jungletronics/attiny85-easy-flashing-through-arduino-b5f896c48189
257 (Caution: these are very small processors and not all RadioHead features may be available, depending on memory requirements)
258 (Caution: we have not had good success building RH_ASK sketches for ATTiny 85 with SpenceKonde ATTinyCore)
259
260- ATtiny Mega (tinyAVR 1-series) chips supported by Spencer Konde's megaTinyCore
261 (https://github.com/SpenceKonde/megaTinyCore)
262 (on Arduino 1.8.9 or later) such as AtTiny 3216, ATtiny 1616 etc. These chips can be easily programmed through their
263 UPDI pin, using an ordinary Arduino board programmed as a jtag2updi programmer as described in
264 https://github.com/SpenceKonde/megaTinyCore/blob/master/MakeUPDIProgrammer.md.
265 Make sure you set the programmer type to jtag2updi in the Arduino Tools->Programmer menu.
266 See https://github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/ImportantInfo.md for links to pinouts
267 and pin numbering information for all the suported chips.
268
269- nRF51 compatible Arm chips such as nRF51822 with Arduino 1.6.4 and later using the procedures
270 in http://redbearlab.com/getting-started-nrf51822/
271
272- nRF52 compatible Arm chips such as as Adafruit BLE Feather board
273 https://www.adafruit.com/product/3406
274
275- Adafruit Feather. These are excellent boards that are available with a variety of radios. We tested with the
276 Feather 32u4 with RFM69HCW radio, with Arduino IDE 1.6.8 and the Adafruit AVR Boards board manager version 1.6.10.
277 https://www.adafruit.com/products/3076
278
279- Adafruit Feather M0 boards with Arduino 1.8.1 and later, using the Arduino and Adafruit SAMD board support.
280 https://learn.adafruit.com/adafruit-feather-m0-basic-proto/using-with-arduino-ide
281
282- ESP32 built using Arduino IDE 1.8.9 or later using the ESP32 toolchain installed per
283 https://github.com/espressif/arduino-esp32 or from the Arduino IDE Board Manager. Tested up to version 3.0.2.
284 The internal 2.4GHz radio is not yet supported. Tested with RFM22 using SPI interface.
285 Uses the VSPI SPI bus by default.
286 You can enable use of the alternative HSPI bus for SPI by defining RH_ESP32_USE_HSPI in RadioHead.h.
287
288- Raspberry Pi
289 Uses BCM2835 library for GPIO http://www.airspayce.com/mikem/bcm2835/
290 Currently works only with RH_NRF24 driver or other drivers that do not require interrupt support.
291 Contributed by Mike Poublon.
292
293- Linux and OSX
294 Using the RHutil/HardwareSerial class, the RH_Serial driver and any manager will
295 build and run on Linux and OSX. These can be used to build programs that talk securely and reliably to
296 Arduino and other processors or to other Linux or OSX hosts on a reliable, error detected (and possibly encrypted) datagram
297 protocol over various types of serial line.
298
299- Mongoose OS, courtesy Paul Austen. Mongoose OSis an Internet of Things Firmware Development Framework
300 available under Apache License Version 2.0. It supports low power, connected microcontrollers such as:
301 ESP32, ESP8266, TI CC3200, TI CC3220, STM32.
302 https://mongoose-os.com/
303
304- muRata cmwx1zzabz module, which includes an STM32L0 processor,
305 a SX1276 LoRa radio and an antenna switch.
306
307- Raspberry Pi Pico, on Arduino, using either the Raspberry Pi Pico/RP2040 core by Earle F. Philhower, version 1.93,
308 installed per https://arduino-pico.readthedocs.io/_/downloads/en/latest/pdf/
309 or the alternative Arduino MBED OS RP2040 core version 2.4.1. At this stage support is partial: RH_ASK works
310 but radio drivers that use interrupts do not (yet) work in either core.
311
312Other platforms are partially supported, such as Generic AVR 8 bit processors, MSP430.
313We welcome contributions that will expand the range of supported platforms.
314
315If your processor is not on the list above, there is a good chance it
316wont work without modifying RadioHead to suit it. If you wish for
317support for another processor, and you send 2 of them to
318AirSpayce Pty Ltd, we will consider adding support for it.
319
320RadioHead is available (through the efforts of others)
321for PlatformIO. PlatformIO is a cross-platform code builder and the missing library manager.
322http://platformio.org/#!/lib/show/124/RadioHead
323
324\par History
325
326RadioHead was created in April 2014, substantially based on code from some of our other earlier Radio libraries:
327
328- RHMesh, RHRouter, RHReliableDatagram and RHDatagram are derived from the RF22 library version 1.39.
329- RH_RF22 is derived from the RF22 library version 1.39.
330- RH_RF69 is derived from the RF69 library version 1.2.
331- RH_ASK is based on the VirtualWire library version 1.26, after significant conversion to C++.
332- RH_Serial was new.
333- RH_NRF24 is based on the NRF24 library version 1.12, with some significant changes.
334
335During this combination and redevelopment, we have tried to retain all the processor dependencies and support from
336the libraries that were contributed by other people. However not all platforms can be tested by us, so if you
337find that support from some platform has not been successfully migrated, please feel free to fix it and send us a
338patch.
339
340Users of RHMesh, RHRouter, RHReliableDatagram and RHDatagram in the previous RF22 library will find that their
341existing code will run mostly without modification. See the RH_RF22 documentation for more details.
342
343\par Installation
344
345For Arduino IDE, install in the usual way: unzip the distribution zip file to the libraries
346sub-folder of your sketchbook.
347The example sketches will be visible in in your Arduino, mpide, maple-ide or whatever.
348http://arduino.cc/en/Guide/Libraries
349
350\par Building for Particle Photon
351
352The Photon is not supported by the Arduino IDE, so it takes a little effort to set up a build environment.
353Heres what we did to enable building of RadioHead example sketches on Linux,
354but there are other ways to skin this cat.
355Basic reference for getting started is: http://particle-firmware.readthedocs.org/en/develop/build/
356- Download the ARM gcc cross compiler binaries and unpack it in a suitable place:
357\code
358cd /tmp
359wget https://launchpad.net/gcc-arm-embedded/5.0/5-2015-q4-major/+download/gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2
360tar xvf gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2
361\endcode
362- If dfu-util and friends not installed on your platform, download dfu-util and friends to somewhere in your path
363\code
364cd ~/bin
365wget http://dfu-util.sourceforge.net/releases/dfu-util-0.8-binaries/linux-i386/dfu-util
366wget http://dfu-util.sourceforge.net/releases/dfu-util-0.8-binaries/linux-i386/dfu-suffix
367wget http://dfu-util.sourceforge.net/releases/dfu-util-0.8-binaries/linux-i386/dfu-prefix
368\endcode
369- Download the Particle firmware (contains headers and libraries require to compile Photon sketches)
370 to a suitable place:
371\code
372cd /tmp
373wget https://github.com/spark/firmware/archive/develop.zip
374unzip develop.zip
375\endcode
376- Make a working area containing the RadioHead library source code and your RadioHead sketch. You must
377 rename the sketch from .pde or .ino to application.cpp
378\code
379cd /tmp
380mkdir RadioHead
381cd RadioHead
382cp /usr/local/projects/arduino/libraries/RadioHead/ *.h .
383cp /usr/local/projects/arduino/libraries/RadioHead/ *.cpp .
384cp /usr/local/projects/arduino/libraries/RadioHead/examples/cc110/cc110_client/cc110_client.pde application.cpp
385\endcode
386- Edit application.cpp and comment out any \#include <SPI.h> so it looks like:
387\code
388 // #include <SPI.h>
389\endcode
390- Connect your Photon by USB. Put it in DFU mode as descibed in Photon documentation. Light should be flashing yellow
391- Compile the RadioHead sketch and install it as the user program (this does not update the rest of the
392 Photon firmware, just the user part:
393\code
394cd /tmp/firmware-develop/main
395PATH=$PATH:/tmp/gcc-arm-none-eabi-5_2-2015q4/bin make APPDIR=/tmp/RadioHead all PLATFORM=photon program-dfu
396\endcode
397- You should see RadioHead compile without errors and download the finished sketch into the Photon.
398
399\par Compatible Hardware Suppliers
400
401We have had good experiences with the following suppliers of RadioHead compatible hardware:
402
403- LittleBird http://littlebirdelectronics.com.au in Australia for all manner of Arduinos and radios.
404- LowPowerLab http://lowpowerlab.com/moteino in USA for the excellent Moteino and Moteino-USB
405 boards which include Hope-RF RF69B radios on-board.
406- Anarduino and HopeRF USA (http://www.hoperfusa.com and http://www.anarduino.com) who have a wide range
407 of HopeRF radios and Arduino integrated modules.
408- SparkFun https://www.sparkfun.com/ in USA who design and sell a wide range of Arduinos and radio modules.
409- Wisen http://wisen.com.au who design and sell a wide range of integrated radio/processor modules including the
410 excellent Talk2 range.
411
412\par Coding Style
413
414RadioHead is designed so it can run on small processors with very
415limited resources and strict timing contraints. As a result, we
416tend only to use the simplest and least demanding (in terms of memory and CPU) C++
417facilities. In particular we avoid as much as possible dynamic
418memory allocation, and the use of complex objects like C++
419strings, IO and buffers. We are happy with this, but we are aware
420that some people may think we are leaving useful tools on the
421table. You should not use this code as an example of how to do
422generalised C++ programming on well resourced processors.
423
424\par Code Contributions
425
426We welcome, and will consider for merging into the mainline, contributions of fixes, patches, improvements etc.
427that meet the following criteria:
428
429- Are generally useful to more than a few people.
430- Are thoroughly tested.
431- Dont break anything else.
432- Are backwards compatible.
433- Are properly and completely documented.
434- Conform to the coding style of the rest of the library.
435- Clearly transfer the ownership of the intellectual property to Mike McCauley
436- Are posted on the Google group as a patch in unified Diff format,
437 made against the latest version of the library.
438
439\par Donations
440
441This library is offered under a free GPL license for those who want to use it that way.
442We try hard to keep it up to date, fix bugs
443and to provide free support. If this library has helped you save time or money, please consider donating at
444http://www.airspayce.com or here:
445
446\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
447
448\subpage packingdata "Passing Sensor Data Between RadioHead nodes"
449
450\par Trademarks
451
452RadioHead is a trademark of AirSpayce Pty Ltd. The RadioHead mark was first used on April 12 2014 for
453international trade, and is used only in relation to data communications hardware and software and related services.
454It is not to be confused with any other similar marks covering other goods and services.
455
456\par Copyright
457
458This software is Copyright (C) 2011-2022 Mike McCauley. Use is subject to license
459conditions. The main licensing options available are GPL V3 or Commercial:
460
461\par Open Source Licensing GPL V3
462
463This is the appropriate option if you want to share the source code of your
464application with everyone you distribute it to, and you also want to give them
465the right to share who uses it. If you wish to use this software under Open
466Source Licensing, you must contribute all your source code to the open source
467community in accordance with the GPL Version 3 when your application is
468distributed. See https://www.gnu.org/licenses/gpl-3.0.html
469
470\par Commercial Licensing
471
472This is the appropriate option if you are creating proprietary applications
473and you are not prepared to distribute and share the source code of your
474application. To purchase a commercial license, contact info@airspayce.com
475
476\par Revision History
477\version 1.1 2014-04-14<br>
478 Initial public release
479\version 1.2 2014-04-23<br>
480 Fixed various typos. <br>
481 Added links to compatible Anarduino products.<br>
482 Added RHNRFSPIDriver, RH_NRF24 classes to support Nordic NRF24 based radios.
483\version 1.3 2014-04-28<br>
484 Various documentation fixups.<br>
485 RHDatagram::setThisAddress() did not set the local copy of thisAddress. Reported by Steve Childress.<br>
486 Fixed a problem on Teensy with RF22 and RF69, where the interrupt pin needs to be set for input, <br>
487 else pin interrupt doesn't work properly. Reported by Steve Childress and patched by
488 Adrien van den Bossche. Thanks.<br>
489 Fixed a problem that prevented RF22 honouring setPromiscuous(true). Reported by Steve Childress.<br>
490 Updated documentation to clarify some issues to do with maximum message lengths
491 reported by Steve Childress.<br>
492 Added support for yield() on systems that support it (currently Arduino 1.5.5 and later)
493 so that spin-loops can suport multitasking. Suggested by Steve Childress.<br>
494 Added RH_RF22::setGpioReversed() so the reversal it can be configured at run-time after
495 radio initialisation. It must now be called _after_ init(). Suggested by Steve Childress.<br>
496\version 1.4 2014-04-29<br>
497 Fixed further problems with Teensy compatibility for RH_RF22. Tested on Teensy 3.1.
498 The example/rf22_* examples now run out of the box with the wiring connections as documented for Teensy
499 in RH_RF22.<br>
500 Added YIELDs to spin-loops in RHRouter, RHMesh and RHReliableDatagram, RH_NRF24.<br>
501 Tested RH_Serial examples with Teensy 3.1: they now run out of the box.<br>
502 Tested RH_ASK examples with Teensy 3.1: they now run out of the box.<br>
503 Reduced default SPI speed for NRF24 from 8MHz to 1MHz on Teensy, to improve reliability when
504 poor wiring is in use.<br>
505 on some devices such as Teensy.<br>
506 Tested RH_NRF24 examples with Teensy 3.1: they now run out of the box.<br>
507\version 1.5 2014-04-29<br>
508 Added support for Nordic Semiconductor nRF905 transceiver with RH_NRF905 driver. Also
509 added examples for nRF905 and tested on Teensy 3.1
510\version 1.6 2014-04-30<br>
511 NRF905 examples were missing
512\version 1.7 2014-05-03<br>
513 Added support for Arduino Due. Tested with RH_NRF905, RH_Serial, RH_ASK.
514 IMPORTANT CHANGE to interrupt pins on Arduino with RH_RF22 and RH_RF69 constructors:
515 previously, you had to specify the interrupt _number_ not the interrupt _pin_. Arduinos and Uno32
516 are now consistent with all other platforms: you must specify the interrupt pin number. Default
517 changed to pin 2 (a common choice with RF22 shields).
518 Removed examples/maple/maple_rf22_reliable_datagram_client and
519 examples/maple/maple_rf22_reliable_datagram_client since the rf22 examples now work out
520 of the box with Flymaple.
521 Removed examples/uno32/uno32_rf22_reliable_datagram_client and
522 examples/uno32/uno32_rf22_reliable_datagram_client since the rf22 examples now work out
523 of the box with ChipKit Uno32.
524\version 1.8 2014-05-08 <br>
525 Added support for YIELD in Teensy 2 and 3, suggested by Steve Childress.<br>
526 Documentation updates. Clarify use of headers and Flags<br>
527 Fixed misalignment in RH_RF69 between ModemConfigChoice definitions and the implemented choices
528 which meant you didnt get the choice you thought and GFSK_Rb55555Fd50 hung the transmitter.<br>
529 Preliminary work on Linux simulator.
530\version 1.9 2014-05-14 <br>
531 Added support for using Timer 2 instead of Timer 1 on Arduino in RH_ASK when
532 RH_ASK_ARDUINO_USE_TIMER2 is defined. With the kind assistance of
533 Luc Small. Thanks!<br>
534 Updated comments in RHReliableDatagram concerning servers, retries, timeouts and delays.
535 Fixed an error in RHReliableDatagram where recvfrom return value was not checked.
536 Reported by Steve Childress.<br>
537 Added Linux simulator support so simple RadioHead sketches can be compiled and run on Linux.<br>
538 Added RH_TCP driver to permit message passing between simulated sketches on Linux.<br>
539 Added example simulator sketches.<br>
540 Added tools/etherSimulator.pl, a simulator of the 'Luminiferous Ether' that passes
541 messages between simulated sketches and can simulate random message loss etc.<br>
542 Fixed a number of typos and improved some documentation.<br>
543\version 1.10 2014-05-15 <br>
544 Added support for RFM73 modules to RH_NRF24. These 2 radios are very similar, and can interoperate
545 with each other. Added new RH_NRF24::TransmitPower enums for the RFM73, which has a different
546 range of available powers<br>
547 reduced the default SPI bus speed for RH_NRF24 to 1MHz, since so many modules and CPU have problems
548 with 8MHz.<br>
549\version 1.11 2014-05-18<br>
550 Testing RH_RF22 with RFM23BP and 3.3V Teensy 3.1 and 5V Arduinos.
551 Updated documentation with respect to GPIO and antenna
552 control pins for RFM23. Updated documentation with respect to transmitter power control for RFM23<br>
553 Fixed a problem with RH_RF22 driver, where GPIO TX and RX pins were not configured during
554 initialisation, causing poor transmit power and sensitivity on those RF22/RF23 devices where GPIO controls
555 the antenna selection pins.
556\version 1.12 2014-05-20<br>
557 Testing with RF69HW and the RH_RF69 driver. Works well with the Anarduino MiniWireless -CW and -HW
558 boards http://www.anarduino.com/miniwireless/ including
559 the marvellous high powered MinWireless-HW (with 20dBm output for excellent range).<br>
560 Clarified documentation of RH_RF69::setTxPower values for different models of RF69.<br>
561 Added RHReliableDatagram::resetRetransmissions().<br>
562 Retransmission count precision increased to uin32_t.<br>
563 Added data about actual power measurements from RFM22 module.<br>
564\version 1.13 2014-05-23<br>
565 setHeaderFlags(flags) changed to setHeaderFlags(set, clear), enabling any flags to be
566 individually set and cleared by either RadioHead or application code. Requested by Steve Childress.<br>
567 Fixed power output setting for boost power on RF69HW for 18, 19 and 20dBm.<br>
568 Added data about actual power measurements from RFM69W and RFM69HW modules.<br>
569\version 1.14 2014-05-26<br>
570 RH_RF69::init() now always sets the PA boost back to the default settings, else can get invalid
571 PA power modes after uploading new sketches without a power cycle. Reported by Bryan.<br>
572 Added new macros RH_VERSION_MAJOR RH_VERSION_MINOR, with automatic maintenance in Makefile.<br>
573 Improvements to RH_TCP: constructor now honours the server argument in the form "servername:port".<br>
574 Added YIELD to RHReliableDatagram::recvfromAckTimeout. Requested by Steve Childress.<br>
575 Fixed a problem with RH_RF22 reliable datagram acknowledgements that was introduced in version 1.13.
576 Reported by Steve Childress.<br>
577\version 1.15 2014-05-27<br>
578 Fixed a problem with the RadioHead .zip link.
579\version 1.16 2014-05-30 <br>
580 Fixed RH_RF22 so that lastRssi() returns the signal strength in dBm. Suggested by Steve Childress.<br>
581 Added support for getLastPreambleTime() to RH_RF69. Requested by Steve Childress.<br>
582 RH_NRF24::init() now checks if there is a device connected and responding, else init() will fail.
583 Suggested by Steve Brown.<br>
584 RHSoftwareSPI now initialises default values for SPI pins MOSI = 12, MISO = 11 and SCK = 13.<br>
585 Fixed some problems that prevented RH_NRF24 working with mixed software and hardware SPI
586 on different devices: a race condition
587 due to slow SPI transfers and fast acknowledgement.<br>
588\version 1.17 2014-06-02 <br>
589 Fixed a debug typo in RHReliableDatagram that was introduced in 1.16.<br>
590 RH_NRF24 now sets default power, data rate and channel in init(), in case another
591 app has previously set different values without powerdown.<br>
592 Caution: there are still problems with RH_NRF24 and Software SPI. Do not use.<br>
593\version 1.18 2014-06-02<br>
594 Improvements to performance of RH_NRF24 statusRead, allowing RH_NRF24 and Software SPI
595 to operate on slow devices like Arduino Uno.<br>
596\version 1.19 2014-06-19<br>
597 Added examples ask_transmitter.pde and ask_receiver.pde.<br>
598 Fixed an error in the RH_RF22 doc for connection of Teensy to RF22.<br>
599 Improved documentation of start symbol bit patterns in RH_ASK.cpp
600\version 1.20 2014-06-24<br>
601 Fixed a problem with compiling on platforms such as ATtiny where SS is not defined.<br>
602 Added YIELD to RHMesh::recvfromAckTimeout().<br>
603\version 1.21 2014-06-24<br>
604 Fixed an issue in RH_Serial where characters might be lost with back-to-back frames.
605 Suggested by Steve Childress.<br>
606 Brought previous RHutil/crc16.h code into mainline RHCRC.cpp to prevent name collisions
607 with other similarly named code in other libraries. Suggested by Steve Childress.<br>
608k Fix SPI bus speed errors on 8MHz Arduinos.
609\version 1.22 2014-07-01<br>
610 Update RH_ASK documentation for common wiring connections.<br>
611 Testing RH_ASK with HopeRF RFM83C/RFM85 courtesy Anarduino http://www.anarduino.com/<br>
612 Testing RH_NRF24 with Itead Studio IBoard Pro http://imall.iteadstudio.com/iboard-pro.html
613 using both hardware SPI on the ITDB02 Parallel LCD Module Interface pins and software SPI
614 on the nRF24L01+ Module Interface pins. Documented wiring required.<br>
615 Added support for AVR 1284 and 1284p, contributed by Peter Scargill.
616 Added support for Semtech SX1276/77/78 and HopeRF RFM95/96/97/98 and other similar LoRa capable radios
617 in LoRa mode only. Tested with the excellent MiniWirelessLoRa from
618 Anarduino http://www.anarduino.com/miniwireless<br>
619\version 1.23 2014-07-03<br>
620 Changed the default modulation for RH_RF69 to GFSK_Rb250Fd250, since the previous default
621 was not very reliable.<br>
622 Documented RH_RF95 range tests.<br>
623 Improvements to RH_RF22 RSSI readings so that lastRssi correctly returns the last message in dBm.<br>
624\version 1.24 2014-07-18
625 Added support for building RadioHead for STM32F4 Discovery boards, using the native STM Firmware libraries,
626 in order to support Codec2WalkieTalkie (http://www.airspayce.com/mikem/Codec2WalkieTalkie)
627 and other projects. See STM32ArduinoCompat.<br>
628 Default modulation for RH_RF95 was incorrectly set to a very slow Bw125Cr48Sf4096
629\version 1.25 2014-07-25
630 The available() function will longer terminate any current transmission, and force receive mode.
631 Now, if there is no unprocessed incoming message and an outgoing message is currently being transmitted,
632 available() will return false.<br>
633 RHRouter::sendtoWait(uint8_t*, uint8_t, uint8_t, uint8_t) renamed to sendtoFromSourceWait due to conflicts
634 with new sendtoWait() with optional flags.<br>
635 RHMEsh and RHRouter already supported end-to-end application layer flags, but RHMesh::sendtoWait()
636 and RHRouter::sendToWait have now been extended to expose a way to send optional application layer flags.
637\version 1.26 2014-08-12
638 Fixed a Teensy 2.0 compile problem due yield() not available on Teensy < 3.0. <br>
639 Adjusted the algorithm of RH_RF69::temperatureRead() to more closely reflect reality.<br>
640 Added functions to RHGenericDriver to get driver packet statistics: rxBad(), rxGood(), txGood().<br>
641 Added RH_RF69::printRegisters().<br>
642 RH_RF95::printRegisters() was incorrectly printing the register index instead of the address.
643 Reported by Phang Moh Lim.<br>
644 RH_RF95, added definitions for some more registers that are usable in LoRa mode.<br>
645 RH_RF95::setTxPower now uses RH_RF95_PA_DAC_ENABLE to achieve 21, 22 and 23dBm.<br>
646 RH_RF95, updated power output measurements.<br>
647 Testing RH_RF69 on Teensy 3.1 with RF69 on PJRC breakout board. OK.<br>
648 Improvements so RadioHead will build under Arduino where SPI is not supported, such as
649 ATtiny.<br>
650 Improvements so RadioHead will build for ATTiny using Arduino IDE and tinycore arduino-tiny-0100-0018.zip.<br>
651 Testing RH_ASK on ATTiny85. Reduced RAM footprint.
652 Added helpful documentation. Caution: RAM memory is *very* tight on this platform.<br>
653 RH_RF22 and RH_RF69, added setIdleMode() function to allow the idle mode radio operating state
654 to be controlled for lower idle power consumption at the expense of slower transitions to TX and RX.<br>
655\version 1.27 2014-08-13
656 All RH_RF69 modulation schemes now have data whitening enabled by default.<br>
657 Tested and added a number of OOK modulation schemes to RH_RF69 Modem config table.<br>
658 Minor improvements to a number of the faster RH_RF69 modulation schemes, but some slower ones
659 are still not working correctly.<br>
660\version 1.28 2014-08-20
661 Added new RH_RF24 driver to support Si446x, RF24/26/26, RFM24/26/27 family of transceivers.
662 Tested with the excellent
663 Anarduino Mini and RFM24W and RFM26W with the generous assistance of the good people at
664 Anarduino http://www.anarduino.com.
665\version 1.29 2014-08-21
666 Fixed a compile error in RH_RF24 introduced at the last minute in hte previous release.<br>
667 Improvements to RH_RF69 modulation schemes: now include the AFCBW in teh ModemConfig.<br>
668 ModemConfig RH_RF69::FSK_Rb2Fd5 and RH_RF69::GFSK_Rb2Fd5 are now working.<br>
669\version 1.30 2014-08-25
670 Fixed some compile problems with ATtiny84 on Arduino 1.5.5 reported by Glen Cook.<br>
671\version 1.31 2014-08-27
672 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
673 since the previous ones were unreliable (they had modulation indexes of 1).<br>
674\version 1.32 2014-08-28
675 Testing with RedBearLab Blend board http://redbearlab.com/blend/. OK.<br>
676 Changed more RH_RF69 FSK and GFSK slowish modulations to have modulation index of 2 instead of 1.
677 This required chnaging the symbolic names.<br>
678\version 1.33 2014-09-01
679 Added support for sleep mode in RHGeneric driver, with new mode
680 RHModeSleep and new virtual function sleep().<br>
681 Added support for sleep to RH_RF69, RH_RF22, RH_NRF24, RH_RF24, RH_RF95 drivers.<br>
682\version 1.34 2014-09-19
683 Fixed compile errors in example rf22_router_test.<br>
684 Fixed a problem with RH_NRF24::setNetworkAddress, also improvements to RH_NRF24 register printing.
685 Patched by Yveaux.<br>
686 Improvements to RH_NRF24 initialisation for version 2.0 silicon.<br>
687 Fixed problem with ambigiguous print call in RH_RFM69 when compiling for Codec2.<br>
688 Fixed a problem with RH_NRF24 on RFM73 where the LNA gain was not set properly, reducing the sensitivity
689 of the receiver.
690\version 1.35 2014-09-19
691 Fixed a problem with interrupt setup on RH_RF95 with Teensy3.1. Reported by AD.<br>
692\version 1.36 2014-09-22
693 Improvements to interrupt pin assignments for __AVR_ATmega1284__ and__AVR_ATmega1284P__, provided by
694 Peter Scargill.<br>
695 Work around a bug in Arduino 1.0.6 where digitalPinToInterrupt is defined but NOT_AN_INTERRUPT is not.<br>
696 \version 1.37 2014-10-19
697 Updated doc for connecting RH_NRF24 to Arduino Mega.<br>
698 Changes to RHGenericDriver::setHeaderFlags(), so that the default for the clear argument
699 is now RH_FLAGS_APPLICATION_SPECIFIC, which is less surprising to users.
700 Testing with the excellent MoteinoMEGA from LowPowerLab
701 https://lowpowerlab.com/shop/moteinomega with on-board RFM69W.
702 \version 1.38 2014-12-29
703 Fixed compile warning on some platforms where RH_RF24::send and RH_RF24::writeTxFifo
704 did not return a value.<br>
705 Fixed some more compiler warnings in RH_RF24 on some platforms.<br>
706 Refactored printRegisters for some radios. Printing to Serial
707 is now controlled by the definition of RH_HAVE_SERIAL.<br>
708 Added partial support for ARM M4 w/CMSIS with STM's Hardware Abstraction lib for
709 Steve Childress.<br>
710 \version 1.39 2014-12-30
711 Fix some compiler warnings under IAR.<br>
712 RH_HAVE_SERIAL and Serial.print calls removed for ATTiny platforms.<br>
713 \version 1.40 2015-03-09
714 Added notice about availability on PlatformIO, thanks to Ivan Kravets.<br>
715 Fixed a problem with RH_NRF24 where short packet lengths would occasionally not be trasmitted
716 due to a race condition with RH_NRF24_TX_DS. Reported by Mark Fox.<br>
717 \version 1.41 2015-03-29
718 RH_RF22, RH_RF24, RH_RF69 and RH_RF95 improved to allow driver.init() to be called multiple
719 times without reallocating a new interrupt, allowing the driver to be reinitialised
720 after sleeping or powering down.
721 \version 1.42 2015-05-17
722 Added support for RH_NRF24 driver on Raspberry Pi, using BCM2835
723 library for GPIO pin IO. Contributed by Mike Poublon.<br>
724 Tested RH_NRF24 module with NRF24L01+PA+LNA SMA Antenna Wireless Transceiver modules
725 similar to: http://www.elecfreaks.com/wiki/index.php?title=2.4G_Wireless_nRF24L01p_with_PA_and_LNA
726 works with no software changes. Measured max power output 18dBm.<br>
727 \version 1.43 2015-08-02
728 Added RH_NRF51 driver to support Nordic nRF51 family processor with 2.4GHz radio such
729 as nRF51822, to be built on Arduino 1.6.4 and later. Tested with RedBearLabs nRF51822 board
730 and BLE Nano kit<br>
731 \version 1.44 2015-08-08
732 Fixed errors with compiling on some platforms without serial, such as ATTiny.
733 Reported by Friedrich Müller.<br>
734 \version 1.45 2015-08-13
735 Added support for using RH_Serial on Linux and OSX (new class RHutil/HardwareSerial
736 encapsulates serial ports on those platforms). Example examples/serial upgraded
737 to build and run on Linux and OSX using the tools/simBuild builder.
738 RHMesh, RHRouter and RHReliableDatagram updated so they can use RH_Serial without
739 polling loops on Linux and OSX for CPU efficiency.<br>
740 \version 1.46 2015-08-14
741 Amplified some doc concerning Linux and OSX RH_Serial. Added support for 230400
742 baud rate in HardwareSerial.<br>
743 Added sample sketches nrf51_audio_tx and nrf51_audio_rx which show how to
744 build an audio TX/RX pair with RedBear nRF51822 boards and a SparkFun MCP4725 DAC board.
745 Uses the built-in ADC of the nRF51822 to sample audio at 5kHz and transmit packets
746 to the receiver which plays them via the DAC.<br>
747\version 1.47 2015-09-18
748 Removed top level Makefile from distribution: its only used by the developer and
749 its presence confuses some people.<br>
750 Fixed a problem with RHReliableDatagram with some versions of Raspberry Pi random() that causes
751 problems: random(min, max) sometimes exceeds its max limit.
752\version 1.48 2015-09-30
753 Added support for Arduino Zero. Tested on Arduino Zero Pro.
754\version 1.49 2015-10-01
755 Fixed problems that prevented interrupts working correctly on Arduino Zero and Due.
756 Builds and runs with 1.6.5 (with 'Arduino SAMD Boards' for Zero version 1.6.1) from arduino.cc.
757 Arduino version 1.7.7 from arduino.org is not currently supported.
758\version 1.50 2015-10-25
759 Verified correct building and operation with Arduino 1.7.7 from arduino.org.
760 Caution: You must burn the bootloader from 1.7.7 to the Arduino Zero before it will
761 work with Arduino 1.7.7 from arduino.org. Conversely, you must burn the bootloader from 1.6.5
762 to the Arduino Zero before it will
763 work with Arduino 1.6.5 from arduino.cc. Sigh.
764 Fixed a problem with RH_NRF905 that prevented the power and frequency ranges being set
765 properly. Reported by Alan Webber.
766\version 1.51 2015-12-11
767 Changes to RH_RF6::setTxPower() to be compatible with SX1276/77/78/79 modules that
768 use RFO transmitter pins instead of PA_BOOST, such as the excellent
769 Modtronix inAir4 http://modtronix.com/inair4.html
770 and inAir9 modules http://modtronix.com/inair9.html. With the kind assistance of
771 David from Modtronix.
772\version 1.52 2015-12-17
773 Added RH_MRF89 module to suport Microchip MRF89XA and compatible transceivers.
774 and modules.<br>
775\version 1.53 2016-01-02
776 Added RH_CC110 module to support Texas Instruments CC110L and compatible transceivers and modules.<br>
777\version 1.54 2016-01-29
778 Added support for ESP8266 processor on Arduino IDE. Examples serial_reliable_datagram_* are shown to work.
779 CAUTION: SPI not supported yet. Timers used by RH_ASK are not tested.
780 The GHz radio included in the ESP8266 is not yet supported.
781\version 1.55 2016-02-12
782 Added macros for htons() and friends to RadioHead.h.
783 Added example sketch serial_gateway.pde. Acts as a transparent gateway between RH_RF22 and RH_Serial,
784 and with minor mods acts as a universal gateway between any 2 RadioHead driver networks.
785 Initial work on supporting STM32 F2 on Particle Photon: new platform type defined.
786 Fixed many warnings exposed by test building for Photon.
787 Particle Photon tested support for RH_Serial, RH_ASK, SPI, RH_CC110 etc.
788 Added notes on how to build RadioHead sketches for Photon.
789\version 1.56 2016-02-18
790 Implemented timers for RH_ASK on ESP8266, added some doc on IO pin selection.
791\version 1.57 2016-02-23
792 Fixed an issue reported by S3B, where RH_RF22 would sometimes not clear the rxbufvalid flag.
793\version 1.58 2-16-04-04
794 Tested RH_RF69 with Arduino Due. OK. Updated doc.<br>
795 Added support for all ChipKIT Core supported boards
796 http://chipkit.net/wiki/index.php?title=ChipKIT_core
797 Tested on ChipKIT Uno32.<br>
798 Digilent Uno32 under the old MPIDE is no longer formally
799 supported but may continue to work for some time.<br>
800\version 1.59 2016-04-12
801 Testing with the excellent Rocket Scream Mini Ultra Pro with the RFM95W and RFM69HCW modules from
802 http://www.rocketscream.com/blog/product/mini-ultra-pro-with-radio/ (915MHz versions). Updated
803 documentation with hints to suit. Caution: requires Arduino 1.6.8 and Arduino SAMD Boards 1.6.5.
804 See also http://www.rocketscream.com/blog/2016/03/10/radio-range-test-with-rfm69hcw/
805 for the vendors tests and range with the RFM69HCW version. They also have an RF95 version equipped with
806 TCXO temperature controllled oscillator for extra frequency stability and support of very slow and
807 long range protocols.
808 These boards are highly recommended. They also include battery charging support.
809\version 1.60 2016-06-25
810 Tested with the excellent talk2 Whisper Node boards
811 (https://talk2.wisen.com.au/ and https://bitbucket.org/talk2/),
812 an Arduino Nano compatible board, which include an on-board RF69 radio, external antenna,
813 run on 2xAA batteries and support low power operations. RF69 examples work without modification.
814 Added support for ESP8266 SPI, provided by David Skinner.
815\version 1.61 2016-07-07
816 Patch to RH_ASK.cpp for ESP8266, to prevent crashes in interrupt handlers. Patch from Alexander Mamchits.
817\version 1.62 2016-08-17
818 Fixed a problem in RH_ASK where _rxInverted was not properly initialised. Reported by "gno.sun.sop".
819 Added support for waitCAD() and isChannelActive() and setCADTimeout() to RHGeneric.
820 Implementation of RH_RF95::isChannelActive() allows the RF95 module to support
821 Channel Activity Detection (CAD). Based on code contributed by Bent Guldbjerg Christensen.
822 Implmentations of isChannelActive() plus documentation for other radio modules wil be welcomed.
823\version 1.63 2016-10-20
824 Testing with Adafruit Feather 32u4 with RFM69HCW. Updated documentation to reflect.<br>
825\version 1.64 2016-12-10
826 RHReliableDatagram now initialises _seenids. Fix from Ben Lim.<br>
827 In RH_NRF51, added get_temperature().<br>
828 In RH_NRF51, added support for AES packet encryption, which required a slight change
829 to the on-air message format.<br>
830\version 1.65 2017-01-11
831 Fixed a race condition with RH_NRF51 that prevented ACKs being reliably received.<br>
832 Removed code in RH_NRF51 that enabled the DC-DC converter. This seems not to be a necessary condition
833 for the radio to work and is now left to the application if that is required.<br>
834 Proven interoperation between nRF51822 and nRF52832.<br>
835 Modification and testing of RH_NRF51 so it works with nRF52 family processors,
836 such Sparkfun nRF52832 breakout board, with Arduino 1.6.13 and
837 Sparkfun nRF52 boards manager 0.2.3 using the procedures outlined in
838 https://learn.sparkfun.com/tutorials/nrf52832-breakout-board-hookup-guide<br>
839 Caution, the Sparkfun development system for Arduino is still immature. We had to
840 rebuild the nrfutil program since the supplied one was not suitable for
841 the Linux host we were developing on. See https://forum.sparkfun.com/viewtopic.php?f=32&t=45071
842 Also, after downloading a sketch in the nRF52832, the program does not start executing cleanly:
843 you have to reset the processor again by pressing the reset button.
844 This appears to be a problem with nrfutil, rather than a bug in RadioHead.
845\version 1.66 2017-01-15
846 Fixed some errors in (unused) register definitions in RH_RF95.h.<br>
847 Fixed a problem that caused compilation errors in RH_NRF51 if the appropriate board
848 support was not installed.
849\version 1.67 2017-01-24
850 Added RH_RF95::frequencyError() to return the estimated centre frequency offset in Hz
851 of the last received message
852\version 1.68 2017-01-25
853 Fixed arithmetic error in RH_RF95::frequencyError() for some platforms.
854\version 1.69 2017-02-02
855 Added RH_RF95::lastSNR() and improved lastRssi() calculations per the manual.
856\version 1.70 2017-02-03
857 Added link to Binpress commercial license purchasing.
858\version 1.71 2017-02-07
859 Improved support for STM32. Patch from Bent Guldbjerg Christensen.
860\version 1.72 2017-03-02
861 In RH_RF24, fixed a problem where some important properties were not set by the ModemConfig.
862 Added properties 2007, 2008, 2009. Also properties 200a was not being set in the chip.
863 Reported by Shannon Bailey and Alan Adamson.
864 Fixed corresponding convert.pl and added it to the distribution.
865\version 1.73 2017-03-04
866 Significant changes to RH_RF24 and its API. It is no longer possible to change the modulation scheme
867 programatically: it proved impossible to cater for all the possible crystal frequencies,
868 base frequency and modulation schemes. Instead you can use one of a small set of supplied radio
869 configuration header files, or generate your own with Silicon Labs WDS application. Changing
870 modulation scheme required editing RH_RF24.cpp to specify the appropriate header and recompiling.
871 convert.pl is now redundant and removed from the distribution.
872\version 1.74 2017-03-08
873 Changed RHReliableDatagram so it would not ACK messages heard addressed to other nodes
874 in promiscuous mode.<br>
875 Added RH_RF24::deviceType() to return the integer value of the connected device.<br>
876 Added documentation about how to connect RFM69 to an ESP8266. Tested OK.<br>
877 RH_RF24 was not correctly changing state in sleep() and setModeIdle().<br>
878 Added example rf24_lowpower_client.pde showing how to put an arduino and radio into a low power
879 mode between transmissions to save battery power.<br>
880 Improvements to RH_RF69::setTxPower so it now takes an optional ishighpowermodule
881 flag to indicate if the connected module is a high power RFM69HW, and so set the power level
882 correctly. Based on code contributed by bob.
883\version 1.75 2017-06-22
884 Fixed broken compiler issues with RH_RF95::frequencyError() reported by Steve Rogerson.<br>
885 Testing with the very excellent Rocket Scream boards equipped with RF95 TCXO modules. The
886 temperature controlled oscillator stabilises the chip enough to be able to use even the slowest
887 protocol Bw125Cr48Sf4096. Caution, the TCXO model radios are not low power when in sleep (consuming
888 about ~600 uA, reported by Phang Moh Lim).<br>
889 Added support for EBYTE E32-TTL-1W and family serial radio transceivers. These RF95 LoRa based radios
890 can deliver reliable messages at up to 7km measured.
891\version 1.76 2017-06-23
892 Fixed a problem with RH_RF95 hanging on transmit under some mysterious circumstances.
893 Reported by several people at https://forum.pjrc.com/threads/41878-Probable-race-condition-in-Radiohead-library?p=146601#post146601 <br>
894 Increased the size of rssi variables to 16 bits to permit RSSI less than -128 as reported by RF95.
895\version 1.77 2017-06-25
896 Fixed a compilation error with lastRssi().<br>
897\version 1.78 2017-07-19
898 Fixed a number of unused variable warnings from g++.<br>
899 Added new module RHEncryptedDriver and examples, contributed by Philippe Rochat, which
900 adds encryption and decryption to any RadioHead transport driver, using any encryption cipher
901 supported by ArduinoLibs Cryptographic Library http://rweather.github.io/arduinolibs/crypto.html
902 Includes several examples.<br>
903\version 1.79 2017-07-25
904 Added documentation about 'Passing Sensor Data Between RadioHead nodes'.<br>
905 Changes to RH_CC110 driver to calculate RSSI in dBm, based on a patch from Jurie Pieterse.<br>
906 Added missing passthroughmethoids to RHEncryptedDriver, allowing it to be used with RHDatagram,
907 RHReliableDatagram etc. Tested with RH_Serial. Added examples
908\version 1.80 2017-10-04
909 Testing with the very fine Talk2 Whisper Node LoRa boards https://wisen.com.au/store/products/whisper-node-lora
910 an Arduino compatible board, which include an on-board RFM95/96 LoRa Radio (Semtech SX1276), external antenna,
911 run on 2xAAA batteries and support low power operations. RF95 examples work without modification.
912 Use Arduino Board Manager to install the Talk2 code support. Upload the code with an FTDI adapter set to 5V.<br>
913 Added support for SPI transactions in development environments that support it with SPI_HAS_TRANSACTION.
914 Tested on ESP32 with RFM-22 and Teensy 3.1 with RF69
915 Added support for ESP32, tested with RFM-22 connected by SPI.<br>
916\version 1.81 2017-11-15
917 RH_CC110, moved setPaTable() from protected to public.<br>
918 RH_RF95 modem config Bw125Cr48Sf4096 altered to enable slow daat rate in register 26
919 as suggested by Dieter Kneffel.
920 Added support for nRF52 compatible Arm chips such as as Adafruit BLE Feather board
921 https://www.adafruit.com/product/3406, with a patch from Mike Bell.<br>
922 Fixed a problem where rev 1.80 broke Adafruit M0 LoRa support by declaring
923 bitOrder variable always as a unsigned char. Reported by Guilherme Jardim.<br>
924 In RH_RF95, all modes now have AGC enabled, as suggested by Dieter Kneffel.<br>
925\version 1.82 2018-01-07
926 Added guard code to RH_NRF24::waitPacketSent() so that if the transmit never completes for some
927 reason, the code will eventually return with FALSE.
928 Added the low-datarate-optimization bit to config for RH_RF95::Bw125Cr48Sf4096.
929 Fix from Jurie Pieterse to ensure RH_CC110::sleep always enters sleep mode.
930 Update ESP32 support to include ASK timers. RH_ASK module is now working on ESP32.
931\version 1.83 2018-02-12
932 Testing adafruit M0 Feather with E32. Updated RH_E32 documentation to show suggested connections
933 and contructor initialisation.<br>
934 Fixed a problem with RHEncryptedDriver that could cause a crash on some platforms when used
935 with RHReliableDatagram. Reported by Joachim Baumann.<br>
936 Improvments to doxygen doc layout in RadioHead.h
937\version 1.84 2018-05-07
938 Compiles with Roger Clarkes Arduino_STM32 https://github.com/rogerclarkmelbourne/Arduino_STM32,
939 to support STM32F103C etc, and STM32 F4 Discovery etc.<br>
940 Tested STM32 F4 Discovery board with RH_RF22, RH_ASK and RH_Serial.
941
942\version 1.85 2018-07-09
943 RHGenericDriver methods changed to virtual, to allow overriding by RHEncrypredDriver:
944 lastRssi(), mode(), setMode(). Reported by Eyal Gal.<br>
945 Fixed a problem with compiling RH_E32 on some older IDEs, contributed by Philippe Rochat.<br>
946 Improvements to RH_RF95 to improve detection of bad packets, contributed by PiNi.<br>
947 Fixed an error in RHEncryptedDriver that caused incorrect message lengths for messages multiples of 16 bytes
948 when STRICT_CONTENT_LEN is defined.<br>
949 Fixed a bug in RHMesh which causes the creation of a route to the address which is the byte
950 behind the end of the route array. Reported by Pascal Gillès de Pélichy.<br>
951\version 1.86 2018-08-28
952 Update commercial licensing, remove binpress.
953\version 1.87 2018-10-06
954 RH_RF22 now resets all registers to default state before initialisation commences. Suggested by Wothke.<br>
955 Added RH_ENABLE_EXPLICIT_RETRY_DEDUP which improves the handling of duplicate detection especially
956 in the case where a transmitter periodically wakes up and start transmitting from the first sequence number.
957 Patch courtesy Justin Newitter. Thanks.
958\version 1.88 2018-11-13
959 Updated to support ATTiny using instructions in
960 https://medium.com/jungletronics/attiny85-easy-flashing-through-arduino-b5f896c48189
961 Updated examples ask_transmitter and ask_receiver to compile cleanly on ATTiny.
962 Tested using ATTiny85 and Arduino 1.8.1. <br>
963\version 1.89 2018-11-15
964 Testing with ATTiny core from https://github.com/SpenceKonde/ATTinyCore and RH_ASK,
965 using example ask_transmitter. This resulted in 'Low Memory, instability may occur',
966 and the resulting sketch would transmit only one packet. Suggest ATTiny users do not use this core, but use
967 the one from https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
968 as described in https://medium.com/jungletronics/attiny85-easy-flashing-through-arduino-b5f896c48189 <br>
969 Added support for RH_RF95::setSpreadingFactor(), RH_RF95::setSignalBandwidth(), RH_RF95::setLowDatarate() and
970 RH_RF95::setPayloadCRC(). Patch from Brian Norman. Thanks.<br>
971
972\version 1.90 2019-05-21
973 Fixed a block size error in RhEncryptedDriver for the case when
974 using STRICT_CONTENT_LEN and sending messages of exactly _blockcipher.blockSize() bytes in length.
975 Reported and patched by Philippe Rochat.
976 Patch from Samuel Archibald to prevent compile errors with RH_AAK.cpp fo ATSAMD51.
977 Fixed a probem in RH_RF69::setSyncWords that prevented setSyncWords(NULL, 0) correctly
978 disabling sync detection and generation. Reported by Federico Maggi.
979 RHHardwareSPI::usingInterrupt() was a noop. Fixed to call SPI.usingInterrupt(interrupt);.
980
981\version 1.91 2019-06-01
982 Fixed a problem with new RHHardwareSPI::usingInterrupt() that prevented compilation on ESP8266
983 which does not have that call.
984
985\version 1.92 2019-07-14
986 Retested serial_reliable_datagram_client.pde and serial_reliable_datagram_server.pde built on Linux
987 as described in their headers, and with USB-RS485 adapters. No changes, working correctly.
988 Testing of nRF5232 with Sparkfun nRF52 board support 0.2.3 shows that there appears to be a problem with
989 interrupt handlers on this board, and none of the interrupt based radio drivers can be expected to work
990 with this chip.
991 Ensured all interrupt routines are flagged with ICACHE_RAM_ATTR when compiled for ESP8266, to prevent crashes.
992
993\version 1.94 2019-09-02
994 Fixed a bug in RHSoftwareSPI where RHGenericSPI::setBitOrder() has no effect for
995 on RHSoftwareSPI. Reported by Peter.<br>
996 Added support in RHRouter for a node to optionally be leaf node, and not participate as a router in the
997 network. See RHRouter::setNodeTypePatch from Alex Evans.<br>
998 Fixed a problem with ESP32 causing compile errors over missing SPI.usingInterrupt().<br>
999
1000\version 1.95 2019-10-14
1001 Fixed some typos in RH_RF05.h macro definitions reported by Clayton Smith.<br>
1002 Patch from Michael Cain from RH_ASK on ESP32, untested by me.<br>
1003 Added support for RPi Zero and Zero W for the RF95, contributed by Brody Mahoney.
1004 Not tested by me.<br>
1005
1006\version 1.96 2019-10-14
1007 Added examples for RPi Zero and Zero W to examples/raspi/rf95, contributed by Brody Mahoney
1008 not tested by me. <br>
1009
1010\version 1.97 2019-11-02
1011 Added support for Mongoose OS, contributed by Paul Austen.
1012
1013\version 1.98 2020-01-06
1014 Rationalised use of RH_PLATFORM_ATTINY to be consistent with other platforms.<br>
1015 Added support for RH_PLATFORM_ATTINY_MEGA, for use with Spencer Konde's megaTinyCore
1016 https://github.com/SpenceKonde/megaTinyCore on Atmel megaAVR ATtiny 1-series chips.
1017 Tested with AtTiny 3217, 3216 and 1614, using
1018 RH_Serial, RH_ASK, and RH_RF22 drivers.<br>
1019
1020\version 1.99 2020-03-07
1021 Release under GPL V3
1022
1023\version 1.100 2020-03-12
1024 Fixed a problem that prevented compilation of RH_NRF51
1025 on Arduino for Sparkfun nRF52832 Breakout board.<br>
1026
1027\version 1.101 2020-04-10
1028 Tested nRF52832 with RFM69W module and RH_RF69, using Software SPI and hardware interrutps OK.<br>
1029 Fixed warnings about 'deleting object of polymorphic class' if driver is dynamically allocated.<br>
1030 Fixed problems in RH_ASK and HardwareSPI to work with STM32F4 Discovery with latest
1031 version of stm32duino https://github.com/stm32duino/Arduino_Core_STM32.
1032 Testing with stm32duino 1.8.0 downloaded with Board Manager per
1033 https://github.com/stm32duino/Arduino_Core_STM32 .
1034 Now builds and run RH_ASK examples with STM32F4 Discovery board.
1035 Build without error for STM32 F1 and F4 but Does not compile for Generic STM32F3.
1036
1037\version 1.102 2020-05-15
1038 Updated RH_RF95::setPayloadCRC to affect CRC generation on outgoing packets as well
1039 as CRC detection and checking on incoming packets.
1040 Added new modem config for RH_RF95. RH_RF95::Bw125Cr45Sf2048
1041 Bw = 125 kHz, Cr = 4/5, Sf = 2048chips/symbol, CRC on. Slow+long range. Tested
1042 against RPI with LoRa-file-ops driver https://github.com/starnight/LoRa/tree/file-ops
1043 and send.c test program.
1044 Fixed a problem with (re-)definition of SS on ESP32, reported and fixed by Justin Newitter.
1045
1046\version 1.103 2020-05-30
1047 Fixed some errors in RH_RF95::setTxPower which cased the power levels to be set incorrectly.
1048 Checked operation and improved documentation. Valid settings are:
1049 2 to 20 (useRFO false) and 0 to 15 (useRFO true). 18, 19 and 20 (useRFO false) turn on the PA_DAC.
1050 Fixed RF95 examples to reflect correct use.
1051 Added RH_ABZ driver, which supports the muRata CMWX1ZZABZ (TypeABZ) module
1052 which includes an STM32L0 processor, a SX1276 LoRa radio and an antenna switch.
1053 Requires the Grumpy Old Pizza Arduino Core installed per https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0
1054 Examples provided.
1055
1056\version 1.104 2020-06-08
1057 Fixed a problem with new RH_ABZ module that prevents compilation with standard 0.0.10 version of STM32L0 <br>
1058 Arduino Core installed with Board Manager: STM32L0_EXTI_CONTROL_PRIORITY_CRITICAL
1059 is only available in later versions.<br>
1060
1061\version 1.105 2020-06-03
1062 Added support for RH_ABZ on STM32L072xx on Grumpy Old Pizza Arduino Core<br>
1063
1064\version 1.106 2020-06-16
1065 Patch from Livio Tenze for RH_RF22 to fix a problem with interrupts on on ESP8266.<br>
1066 Added examples/rf22/rf22_cw, with example showing how to emit a carrier wave (CW).<br>
1067 Reverted delay in RHSPIDriver::init() back to 100ms for all platforms except ABZ, where
1068 100ms interferes with the USB serial port with at least some versions of the core.<br>
1069 Updated and clarified documentation about TCXO use in RH_ABZ and examples.<br>
1070 Fixed documentation SS->NSEL pin for RH_RF22 with AtMega. Seems that SS on that platform
1071 is now defined as pin 10, not 53. Dont know when that changed.<br>
1072
1073\version 1.107 2020-06-26
1074 Improvements to RHEncryptedDriver, so that you will get an explanatory error message if you
1075 include RHEncryptedDriver.h without enabling the class with RH_ENABLE_ENCRYPTION_MODULE in RadioHead.h.<br>
1076 Fixed newly introduced errors when compiling for ATTiny 25/45/85.<br>
1077
1078\version 1.108 2020-07-05
1079 Fixed a problem with RH_RF22 on ESP8266 introcuced in version 1.106 which prevented
1080 messages being received. Some other cleanups in RH_RF22<br>
1081
1082\version 1.109 2020-07-23
1083 Fixed a problem that prevented RHEncryptedDriver compiling when RH_ENCRYPTED_DRIVER was enabled.<br>
1084 Added optiona hops argument to RHRouter and RHMesh recvfromAck() and receivedFomAckTimeout()
1085 to allow the hop count to be retreived if desired.
1086\version 1.110 2020-07-28
1087 Fixed a problem where _spi.beginTransaction and _spi.endTransaction were missing from RHSPIDriver::spiRead.
1088\version 1.111 2020-07-30
1089 Fixed some compilation problems on some platforms with RH_PLATFORM_ATTINY_MEGA and Kondes MegaTinyCore 1.1.2.<br>
1090 Fixed some other errors with Kondes MegaTinyCore 2.0.5: F_CPU_CORRECTED no longer exists,
1091 bitOrder and PinStatus no longer needed.<br>
1092 Improved detection of RH_PLATFORM_ATTINY_MEGA by looking for defined(MEGATINYCORE), defined
1093 in later versions of MegaTinyCore.
1094
1095\version 1.112 2020-08-05
1096 Fixed some compiler warnings in STM32 Discovery and other processors.<br>
1097 Added support for ST's Arduino Core STM32, https://github.com/stm32duino/Arduino_Core_STM32
1098 to RH_ASK, per https://github.com/r-map/rmap/commit/edf9931b21cb7df5b4f67835307255e0fcb301bb.<br>
1099 Added documentation about requirements for code contributions.<br>
1100 Added library.properties file that some IDEs need.<br>
1101 Added support for multithreaded RH_RF95 support on Raspberry Pi, courtesy Tilman Glötzner.<br>
1102 Includes example programs, including for the Dragino Lora/GPS Hat which
1103 send GPS coordinates.<br>
1104
1105\version 1.113 2020-10-15
1106 Changes to RH_ASK on SpenceKonde's megaTinyCore so it will use TCB0 on platforms
1107 where TCB1 is not available.<br>
1108 Minor imprvements to documentation.<br>
1109 Move to local git for source code control.<br>
1110 Added support for RH_ABZ::deinit() for Matt Way.
1111 Fixed compilation error in RH_ASK caused by changes to interrupt API in Arduino_Core_STM32 1.9
1112
1113\version 1.114 2021-03-24
1114 Fixed compile warnings, errors on some platforms, in RH_ASK.cpp for STM32 core 1.9.0
1115 to do with odd behaviour of callback_function_t.<br>
1116 Fixed some problems with SPI transactions in RH_RF69 and RH_RF24 that affected
1117 operations with STM32F030F4. Reported and patched by Adam De Muri.<br>
1118 Added tools/createGPX.pl, contributed by Tilman Glötzner: A perl script to process the dump files that can be
1119 produced with the Dragino LoRa-GPS-hat and rf95_client2 + rf95_server2.
1120 The programs exchange sequence numbers, timestamps and gps coordinates
1121 via Lora which can be used for range measurements or visualization. The
1122 perl script is meant for post processing and converts the log files
1123 into Gpx-files which in turn can be imported to google maps.<br>
1124 Added support for MRF89XAM8A, which has support for different frequency bands to RH_MRF89. Patch courtesy
1125 Michael Kefeder.
1126
1127\version 1.115 2021-03-24
1128 Fix compile error in new MRF89XAM8A support.
1129
1130\version 1.116 2021-03-30
1131 Patch from Vlasta Hajek: 1. Made RH_ASK usable again for ATTINY after breaking changes.
1132 2. Added the possibility to use Timer 1 on ATtiny8x. Tested on ATtiny 85
1133 and ATtiny84 for more than a year.
1134 3. Added patch for ESP32 from jPerotto. This finally makes receiving via
1135 RH_ASK on ESP32 without panics. Tested for more than 6 months.<br>
1136
1137\version 1.117 2021-05-26
1138 Added documention to RH_MRF89 about how to achieve 1μA power consumption in sleep mode.
1139 Courtesy Fernando Faria.<br>
1140 Improved documentation for the meaning of 'len' in all recv*, as suggested by Sean. E. Sean.<br>
1141 waitAvailable and waitAvaiableTimeout now take an optional polldelay argument that
1142 can be useful for introducing on multitasking systems where a driver requires polling.<br>
1143 Fixed compile errors with forward declarations in RH_E32.h and RH_Serial.h on Ardiono IDE on Windows
1144 reported by Skywodd.
1145
1146\version 1.118 2021-07-16
1147 Added a 1 us delay in RHSPIDriver::spiWrite as recommended in
1148 https://forum.pjrc.com/attachment.php?attachmentid=10948&d=1499109224
1149 for corect operation with some fast processors. <br>
1150 Tested Ebyte E22-900T22S radios with serial interface and the examples from
1151 examples/serial/serial_reliable_datagram_* on Linux.
1152 These radios implement a transparent serial connection
1153 using LORA. They can also be configured as independent relays.
1154 You can alter the default configuration of the radios (including frequency,
1155 transmission rates, node addresses etc) by using the
1156 Ebyte RF Settings for E22 tool from https://www.cdebyte.net/download-tools and after
1157 setting the device to configuraiotn mode (M1 high: temporarily remove the M1 link).
1158 Caution, to use this
1159 tool on Windows, you also must install the CH340 USB-Serial port driver, see
1160 https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all#windows-710
1161 These modules can also be configured programatically, but this is not supported by RadioHead. <br>
1162 Fixed compile errors to do with RH_DRAM_ATTR on non-ESP-32 platforms. <br>
1163 Fixed problems reported with crashes in RH_ASK on STM32 boards with core >= 1.9.0 due to
1164 incorrect declaration of interrupt function. <br>
1165
1166\version 1.119 2021-08-02
1167 Changes to RadioHead.h RHHardwareSPI.cpp and RHSPIDriver.cpp for ESP32 support
1168 provided by Juliano Perotto.
1169
1170\version 1.120 2021-11-13
1171 Added intial support for Raspberry Pi Pico, using the Raspberry Pi Pico/RP2040 core by Earle F. Philhower, version 1.93,
1172 installed per https://arduino-pico.readthedocs.io/_/downloads/en/latest/pdf/
1173 RH_ASK works with default pins (11 and 12). But it seems that interrupt callbacks (needed by most SPI based
1174 radio drivers in RadioHead) are not working (yet) in this core, at least when compiled on our Linux platform.
1175 It appears
1176 there is some bug in std::map that causes the interrupt handling to not work correctly
1177 (which I have been able to reproduce in a simple sketch that only uses std::map). This is very strange.
1178 Interrupts _are_ supported and work in the alternative Arduino MBED OS RP2040 core version 2.4.1,
1179 but there are other mysterious crashes RadioHead when a radio driver reads SPI inside an interrupt.
1180 But RH_ASK also works with this core.
1181 So the result (so far) is partial support of RadioHead using either core (so far).
1182 We will revisit this when either core is updated<br>
1183 On ESP32, added support for using the non-default HSPI bus by defining RH_ESP32_USE_HSPI.<br>
1184 Improved the reading of RSSI for the last packet in RH_CC110: seems that it was being read too soon. Now
1185 read it from the end received packet with RH_CC110_APPEND_STATUS.<br>
1186 Added RH_LoRaFileOps, driver on RPi+Linux and using LoRa-file-ops Linux driver ioctls to
1187 transmit and receive RadioHead compatible messages via SX1276/77/78/79
1188 and compatible radios. Requires a modified version of LoRa-file-ops driver to be installed,
1189 and a compatible radio to be connected appropriately:
1190 https://github.com/starnight/LoRa/tree/file-ops <br>
1191
1192\version 1.121 2022-02-02
1193 Restored RH_RF95 code to clear the IRQ flags (twice).<br>
1194
1195\version 1.122 2023-05-20
1196 Added RHRouter::getNextValidRoutingTableEntry() contributed by w...<br>
1197 Various compatibility imnprovements for STM32L0 etc from Calin Radoni.<br>
1198 Added ability to overriding the value of RH_ENABLE_EXPLICIT_RETRY_DEDUP
1199 via a compiler arg. Example from PlatformIO:
1200 build_flags =
1201 -D"RH_ENABLE_EXPLICIT_RETRY_DEDUP=1"
1202 Contributed by Justin Newitter.<br>
1203 Fixed an error in the header lengths in RH_TCP, which could result in the last octet
1204 of the payload being lost. checkForEvents() now returns false instead of exit() in case of IO failure<br>
1205
1206\version 1.123 2023-08-07
1207 Added support for Arduino Uno R4 Minima.
1208
1209\version 1.124 2023-08-09
1210 Extended support for Arduino Uno R4 to Arduino Uno R4 WIFI
1211
1212\version 1.125 2023-08-14
1213 Improved support for Arduino Uno R4: ATOMIC_BLOCK_START and ATOMIC_BLOCK_END are no
1214 longer defined since they hang on R4, and are not necessary since they have SPI_HAS_TRANSACTION
1215
1216\version 1.126 2023-11-24
1217 ESP8266 support now uses IRAM_ATTR instead of ICACHE_RAM_ATTR. This should work fine with core 2.7.4 and later.<br>
1218 Changes to definitions of ATOMIC_BLOCK_START and ATOMIC_BLOCK_END for RH_PLATFORM_ESP32: Previous
1219 use of XTOS_DISABLE_ALL_INTERRUPTS not suported for ESP32C3. Now uses ATOMIC_ENTER_CRITICAL()
1220 and ATOMIC_EXIT_CRITICAL() which appear to be supported for all platforms in Arduino esp32 package.<br>
1221
1222\version 1.127 2024-01-07
1223 Added support for SX126x family radios, and also for the STM32WLE5xx and STM32WLE4xx families of ARM procedssors that
1224 have a SX126x radio built in, and as used in the LoRa-E5-HF module (which is used in WiO-E5 mini development board),
1225 the LoRa-E5-LF module and the NUCLEO_WL55JC1 development board. Tested with WiO-E5 mini development board, but no standalone
1226 SPI versions of this radio.
1227
1228\version 1.128 2024-01-12
1229 Added missing sx126x examples to distribution.
1230
1231\version 1.129 2024-03-21
1232 Rename all .pde sketches to .ino
1233 Significant changes to RH_SX126x to support other modules such as the NiceRF LoRa1262 family.
1234 https://www.nicerf.com/lora-module/915mhz-lora-module-lora1262.html
1235 Sample client and server sketches demonstrating use, compatible with Teensy and other 3.3V compatible Arduinos.
1236
1237\version 1.130 2024-04-12
1238 Adjustments to RHHardwareSPI fopr compatibility with RAKwireless RAK4360/RAK4361, contributed by gfja.
1239 Fixed a preprocessor typo in unused code in RHHardwareSPI.cpp, reported by brodymahoney.
1240
1241\version 1.131 2024-07-02
1242 Fixed problem with failed compilation in RH_ASK.cpp, when used with ESP 32 board library version 3.o or greated because
1243 the Espressif library timer API changed.<br>
1244
1245\version 1.132 2024-07-08
1246 Fixed problem with SX126x where a packet recieved with a CRC error would leave the chip in standby mode
1247 but RH_SX126x thought it was still in RX mode. Reported by kalev.<br>
1248
1249\version 1.133 2024-07-08
1250 Revisit SX126x RX CRC error handling with the assistance of kalev.
1251
1252\version 1.134 2024-07-10
1253 Improvements to SX126x contributed by kalev:<br>
1254 1. Save IRQ flags for debugging outside interrupt handler.
1255 every time the handler is invoked save IRQ flags and rise _iflag.<br>
1256 2. runtime set on/off IRQ mask. This gives possibility to
1257 investigate erroneous packets. <br>
1258 3. introduce raw mode send and receive for debugging.<br>
1259 4. add getFrequencyError() If receiver and sender
1260 main clock frequencies are off ( usually when pairing sx126x and
1261 sx127x ) it's difficult to adjust other party's ( usually sx127x ) frequency.<br>
1262
1263\version 1.135 2024-07-12
1264 Fixed a problem in RHSPIDriver: if the Slave Select pin was set to 0xff, then it would still drive the
1265 SS pin. This broke use of EEPROM on STM32wl. Reported and fixed by Craig Zych.
1266
1267\version 1.136 2024-07-25
1268 Fixed a typo in the comments for the MOSI pin number for the alternative ESP32 HSPI interface.
1269 Examples were not included in idstribution since names changed to .ino
1270
1271\author Mike McCauley. DO NOT CONTACT THE AUTHOR DIRECTLY. USE THE GOOGLE GROUP GIVEN ABOVE
1272*/
1273
1274/*! \page packingdata
1275\par Passing Sensor Data Between RadioHead nodes
1276
1277People often ask about how to send data (such as numbers, sensor
1278readings etc) from one RadioHead node to another. Although this issue
1279is not specific to RadioHead, and more properly lies in the area of
1280programming for networks, we will try to give some guidance here.
1281
1282One reason for the uncertainty and confusion in this area, especially
1283amongst beginners, is that there is no *best* way to do it. The best
1284solution for your project may depend on the range of processors and
1285data that you have to deal with. Also, it gets more difficult if you
1286need to send several numbers in one packet, and/or deal with floating
1287point numbers and/or different types of processors.
1288
1289The principal cause of difficulty is that different microprocessors of
1290the kind that run RadioHead may have different ways of representing
1291binary data such as integers. Some processors are little-endian and
1292some are big-endian in the way they represent multi-byte integers
1293(https://en.wikipedia.org/wiki/Endianness). And different processors
1294and maths libraries may represent floating point numbers in radically
1295different ways:
1296(https://en.wikipedia.org/wiki/Floating-point_arithmetic)
1297
1298All the RadioHead examples show how to send and receive simple NUL
1299terminated ASCII strings, and if thats all you want, refer to the
1300examples folder in your RadioHead distribution. But your needs may be
1301more complicated than that.
1302
1303The essence of all engineering is compromise so it will be up to you to
1304decide whats best for your particular needs. The main choices are:
1305- Raw Binary
1306- Network Order Binary
1307- ASCII
1308
1309\par Raw Binary
1310
1311With this technique you just pack the raw binary numbers into the packet:
1312
1313\code
1314// Sending a single 16 bit unsigned integer
1315// in the transmitter:
1316...
1317uint16_t data = getsomevalue();
1318if (!driver.send((uint8_t*)&data, sizeof(data)))
1319{
1320 ...
1321\endcode
1322
1323\code
1324// and in the receiver:
1325...
1326uint16_t data;
1327uint8_t datalen = sizeof(data);
1328if ( driver.recv((uint8_t*)&data, &datalen)
1329 && datalen == sizeof(data))
1330{
1331 // Have the data, so do something with it
1332 uint16_t xyz = data;
1333 ...
1334\endcode
1335
1336If you need to send more than one number at a time, its best to pack
1337them into a structure
1338
1339\code
1340// Sending several 16 bit unsigned integers in a structure
1341// in a common header for your project:
1342typedef struct
1343{
1344 uint16_t dataitem1;
1345 uint16_t dataitem2;
1346} MyDataStruct;
1347...
1348\endcode
1349
1350\code
1351// In the transmitter
1352...
1353MyDataStruct data;
1354data.dataitem1 = getsomevalue();
1355data.dataitem2 = getsomeothervalue();
1356if (!driver.send((uint8_t*)&data, sizeof(data)))
1357{
1358 ...
1359\endcode
1360
1361\code
1362// in the receiver
1363MyDataStruct data;
1364uint8_t datalen = sizeof(data);
1365if ( driver.recv((uint8_t*)&data, &datalen)
1366 && datalen == sizeof(data))
1367{
1368 // Have the data, so do something with it
1369 uint16_t pqr = data.dataitem1;
1370 uint16_t xyz = data.dataitem2;
1371 ....
1372\endcode
1373
1374
1375The disadvantage with this simple technique becomes apparent if your
1376transmitter and receiver have different endianness: the integers you
1377receive will not be the same as the ones you sent (actually they are,
1378but with the internal bytes swapped around, so they probably wont make
1379sense to you). Endianness is not a problem if *every* data item you
1380send is a just single byte (uint8_t or int8_t or char), or if the
1381transmitter and receiver have the same endianness.
1382
1383So you should only adopt this technique if:
1384- You only send data items of a single byte each, or
1385- You are absolutely sure (now and forever into the future) that you
1386will only ever use the same processor endianness in the transmitter and receiver.
1387
1388\par Network Order Binary
1389
1390One solution to the issue of endianness in your processors is to
1391always convert your data from the processor's native byte order to
1392'network byte order' before transmission and then convert it back to
1393the receiver's native byte order on reception. You do this with the
1394htons (host to network short) macro and friends. These functions may
1395be a no-op on big-endian processors.
1396
1397With this technique you convert every multi-byte number to and from
1398network byte order (note that in most Arduino processors an integer is
1399in fact a short, and is the same as int16_t. We prefer to use types
1400that explicitly specify their size so we can be sure of applying the
1401right conversions):
1402
1403\code
1404// Sending a single 16 bit unsigned integer
1405// in the transmitter:
1406...
1407uint16_t data = htons(getsomevalue());
1408if (!driver.send((uint8_t*)&data, sizeof(data)))
1409{
1410 ...
1411\endcode
1412\code
1413// and in the receiver:
1414...
1415uint16_t data;
1416uint8_t datalen = sizeof(data);
1417if ( driver.recv((uint8_t*)&data, &datalen)
1418 && datalen == sizeof(data))
1419{
1420 // Have the data, so do something with it
1421 uint16_t xyz = ntohs(data);
1422 ...
1423\endcode
1424
1425If you need to send more than one number at a time, its best to pack
1426them into a structure
1427
1428\code
1429// Sending several 16 bit unsigned integers in a structure
1430// in a common header for your project:
1431typedef struct
1432{
1433 uint16_t dataitem1;
1434 uint16_t dataitem2;
1435} MyDataStruct;
1436...
1437\endcode
1438\code
1439// In the transmitter
1440...
1441MyDataStruct data;
1442data.dataitem1 = htons(getsomevalue());
1443data.dataitem2 = htons(getsomeothervalue());
1444if (!driver.send((uint8_t*)&data, sizeof(data)))
1445{
1446 ...
1447\endcode
1448\code
1449// in the receiver
1450MyDataStruct data;
1451uint8_t datalen = sizeof(data);
1452if ( driver.recv((uint8_t*)&data, &datalen)
1453 && datalen == sizeof(data))
1454{
1455 // Have the data, so do something with it
1456 uint16_t pqr = ntohs(data.dataitem1);
1457 uint16_t xyz = ntohs(data.dataitem2);
1458 ....
1459\endcode
1460
1461This technique is quite general for integers but may not work if you
1462want to send floating point number between transmitters and receivers
1463that have different floating point number representations.
1464
1465
1466\par ASCII
1467
1468In this technique, you transmit the printable ASCII equivalent of
1469each floating point and then convert it back to a float in the receiver:
1470
1471\code
1472// In the transmitter
1473...
1474float data = getsomevalue();
1475uint8_t buf[15]; // Bigger than the biggest possible ASCII
1476snprintf(buf, sizeof(buf), "%f", data);
1477if (!driver.send(buf, strlen(buf) + 1)) // Include the trailing NUL
1478{
1479 ...
1480\endcode
1481\code
1482
1483// In the receiver
1484...
1485float data;
1486uint8_t buf[15]; // Bigger than the biggest possible ASCII
1487uint8_t buflen = sizeof(buf);
1488if (driver.recv(buf, &buflen))
1489{
1490 // Have the data, so do something with it
1491 float data = atof(buf); // String to float
1492 ...
1493\endcode
1494
1495\par Conclusion:
1496
1497- This is just a basic introduction to the issues. You may need to
1498extend your study into related C/C++ programming techniques.
1499
1500- You can extend these ideas to signed 16 bit (int16_t) and 32 bit
1501(uint32_t, int32_t) numbers.
1502
1503- Things can be simple or complicated depending on the needs of your
1504project.
1505
1506- We are not going to write your code for you: its up to you to take
1507these examples and explanations and extend them to suit your needs.
1508
1509*/
1510
1511
1512
1513#ifndef RadioHead_h
1514#define RadioHead_h
1515
1516// Official version numbers are maintained automatically by Makefile:
1517#define RH_VERSION_MAJOR 1
1518#define RH_VERSION_MINOR 136
1519
1520// Symbolic names for currently supported platform types
1521#define RH_PLATFORM_ARDUINO 1
1522#define RH_PLATFORM_MSP430 2
1523#define RH_PLATFORM_STM32 3
1524#define RH_PLATFORM_GENERIC_AVR8 4
1525#define RH_PLATFORM_UNO32 5
1526#define RH_PLATFORM_UNIX 6
1527#define RH_PLATFORM_STM32STD 7
1528#define RH_PLATFORM_STM32F4_HAL 8
1529#define RH_PLATFORM_RASPI 9
1530#define RH_PLATFORM_NRF51 10
1531#define RH_PLATFORM_ESP8266 11
1532#define RH_PLATFORM_STM32F2 12
1533#define RH_PLATFORM_CHIPKIT_CORE 13
1534#define RH_PLATFORM_ESP32 14
1535#define RH_PLATFORM_NRF52 15
1536#define RH_PLATFORM_MONGOOSE_OS 16
1537#define RH_PLATFORM_ATTINY 17
1538// Spencer Kondes megaTinyCore:
1539#define RH_PLATFORM_ATTINY_MEGA 18
1540#define RH_PLATFORM_STM32L0 19
1541#define RH_PLATFORM_RASPI_PICO 20
1542
1543////////////////////////////////////////////////////
1544// Select platform automatically, if possible
1545#ifndef RH_PLATFORM
1546 #if (defined(MPIDE) && MPIDE>=150 && defined(ARDUINO))
1547 // Using ChipKIT Core on Arduino IDE
1548 #define RH_PLATFORM RH_PLATFORM_CHIPKIT_CORE
1549 #elif defined(MPIDE)
1550 // Uno32 under old MPIDE, which has been discontinued:
1551 #define RH_PLATFORM RH_PLATFORM_UNO32
1552 #elif defined(NRF51) || defined(NRF52)
1553 #define RH_PLATFORM RH_PLATFORM_NRF51
1554 #elif defined(NRF52)
1555 #define RH_PLATFORM RH_PLATFORM_NRF52
1556 #elif defined(ESP8266)
1557 #define RH_PLATFORM RH_PLATFORM_ESP8266
1558 #elif defined(ESP32)
1559 #define RH_PLATFORM RH_PLATFORM_ESP32
1560 #elif defined(STM32L0) || defined(ARDUINO_ARCH_STM32L0)
1561 #define RH_PLATFORM RH_PLATFORM_STM32L0
1562 #elif defined(MGOS)
1563 #define RH_PLATFORM RH_PLATFORM_MONGOOSE_OS
1564#elif defined(MEGATINYCORE) || defined(ARDUINO_attinyxy2) || defined(ARDUINO_attinyxy4) || defined(ARDUINO_attinyxy6) || defined(ARDUINO_attinyxy7)
1565 #define RH_PLATFORM RH_PLATFORM_ATTINY_MEGA
1566 #elif 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__) || defined(ARDUINO_attiny)
1567 #define RH_PLATFORM RH_PLATFORM_ATTINY
1568 #elif defined(ARDUINO)
1569 #define RH_PLATFORM RH_PLATFORM_ARDUINO
1570 #elif defined(__MSP430G2452__) || defined(__MSP430G2553__)
1571 #define RH_PLATFORM RH_PLATFORM_MSP430
1572 #elif defined(MCU_STM32F103RE)
1573 #define RH_PLATFORM RH_PLATFORM_STM32
1574 #elif defined(STM32F2XX)
1575 #define RH_PLATFORM RH_PLATFORM_STM32F2
1576 #elif defined(USE_STDPERIPH_DRIVER)
1577 #define RH_PLATFORM RH_PLATFORM_STM32STD
1578 #elif defined(RASPBERRY_PI)
1579 #define RH_PLATFORM RH_PLATFORM_RASPI
1580 #elif defined(__unix__) // Linux
1581 #define RH_PLATFORM RH_PLATFORM_UNIX
1582 #elif defined(__APPLE__) // OSX
1583 #define RH_PLATFORM RH_PLATFORM_UNIX
1584
1585 #else
1586 #error Platform not defined!
1587 #endif
1588#endif
1589
1590////////////////////////////////////////////////////
1591// Platform specific headers:
1592#if (RH_PLATFORM == RH_PLATFORM_ARDUINO)
1593
1594 #if (ARDUINO >= 100)
1595 #include <Arduino.h>
1596 #else
1597 #include <wiring.h>
1598 #endif
1599 #include <SPI.h>
1600 #define RH_HAVE_HARDWARE_SPI
1601 #define RH_HAVE_SERIAL
1602 #if defined(ARDUINO_ARCH_STM32F4)
1603 // output to Serial causes hangs on STM32 F4 Discovery board
1604 // There seems to be no way to output text to the USB connection
1605 #undef Serial
1606 #define Serial Serial2
1607 #elif defined(ARDUINO_ARCH_RP2040)
1608 // Raspi Pico
1609 #define RH_ASK_PICO_ALARM_IRQ TIMER_IRQ_1
1610 #define RH_ASK_PICO_ALARM_NUM 1
1611 #elif defined(ARDUINO_LORA_E5_MINI)
1612 // WiO-E5 mini, or boards conating Seeed LoRa-E5-LF or LoRa-E5-HF, processor is STM32WLE5JC
1613 #include <SubGhz.h>
1614 #endif
1615#elif (RH_PLATFORM == RH_PLATFORM_ATTINY)
1616 #include <Arduino.h>
1617// #warning Arduino TinyCore does not support hardware SPI. Use software SPI instead.
1618#elif (RH_PLATFORM == RH_PLATFORM_ATTINY_MEGA)
1619 #include <SPI.h>
1620 #define RH_HAVE_HARDWARE_SPI
1621 #define RH_HAVE_SERIAL
1622 // On most AT_TINY_MEGA, Timer A is used for millis/micros, and B 0 or 1 for Tone by default.
1623 // But not all devices support TCB1, so we use TCB0 on some variants.
1624 // This is the same strategy for timer selection that Tone uses:
1625 #if defined(MILLIS_USE_TIMERB0) && defined(TCB1)
1626 #define RH_ATTINY_MEGA_ASK_TIMER TCB1
1627 #define RH_ATTINY_MEGA_ASK_TIMER_VECTOR TCB1_INT_vect
1628 #else
1629 #define RH_ATTINY_MEGA_ASK_TIMER TCB0
1630 #define RH_ATTINY_MEGA_ASK_TIMER_VECTOR TCB0_INT_vect
1631 #endif
1632
1633#elif (RH_PLATFORM == RH_PLATFORM_ESP8266) // ESP8266 processor on Arduino IDE
1634 #include <Arduino.h>
1635 #include <SPI.h>
1636 #define RH_HAVE_HARDWARE_SPI
1637 #define RH_HAVE_SERIAL
1638 #define RH_MISSING_SPIUSINGINTERRUPT
1639
1640#elif (RH_PLATFORM == RH_PLATFORM_ESP32) // ESP32 processor on Arduino IDE
1641 #include <Arduino.h>
1642 #include <SPI.h>
1643 #define RH_HAVE_HARDWARE_SPI
1644 #define RH_HAVE_SERIAL
1645 #define RH_MISSING_SPIUSINGINTERRUPT
1646 // ESP32 has 2 user SPI buses: VSPI and HSPI. They are essentially identical, but use different pins.
1647 // The usual, default bus VSPI (available as SPI object in Arduino) uses pins:
1648 // SCLK: 18
1649 // MISO: 19
1650 // MOSI: 23
1651 // SS: 5
1652 // The other HSPI bus uses pins
1653 // SCLK: 14
1654 // MISO: 12
1655 // MOSI: 13
1656 // SS: 15
1657 // By default RadioHead uses VSPI, but you can make it use HSPI by defining this:
1658 //#define RH_ESP32_USE_HSPI
1659
1660#elif (RH_PLATFORM == RH_PLATFORM_MONGOOSE_OS) // Mongoose OS platform
1661 #include <mgos.h>
1662 #include <mgos_adc.h>
1663 #include <mgos_pwm.h>
1664 #include <MGOSCompat/HardwareSerial.h>
1665 #include <MGOSCompat/HardwareSPI.h>
1666 #include <MGOSCompat/MGOS.h>
1667 #include <math.h> // We use the floor() math function.
1668 #define RH_HAVE_HARDWARE_SPI
1669 //If a Radio is connected via a serial port then this defines the serial
1670 //port the radio is connected to.
1671 #if defined(RH_SERIAL_PORT)
1672 #if RH_SERIAL_PORT == 0
1673 #define Serial Serial0
1674 #elif RH_SERIAL_PORT == 1
1675 #define Serial Serial1
1676 #elif RH_SERIAL_PORT == 2
1677 #define Serial Serial2
1678 #endif
1679 #else
1680 #warning "RH_SERIAL_PORT not defined. Therefore serial port 0 selected"
1681 #define Serial Serial0
1682 #endif
1683 #define RH_HAVE_SERIAL
1684
1685#elif (RH_PLATFORM == RH_PLATFORM_MSP430) // LaunchPad specific
1686 #include "legacymsp430.h"
1687 #include "Energia.h"
1688 #include <SPI.h>
1689 #define RH_HAVE_HARDWARE_SPI
1690 #define RH_HAVE_SERIAL
1691
1692#elif (RH_PLATFORM == RH_PLATFORM_UNO32 || RH_PLATFORM == RH_PLATFORM_CHIPKIT_CORE)
1693 #include <WProgram.h>
1694 #include <string.h>
1695 #include <SPI.h>
1696 #define RH_HAVE_HARDWARE_SPI
1697 #define memcpy_P memcpy
1698 #define RH_HAVE_SERIAL
1699
1700#elif (RH_PLATFORM == RH_PLATFORM_STM32) // Maple, Flymaple etc
1701 #include <STM32ArduinoCompat/wirish.h>
1702 #include <stdint.h>
1703 #include <string.h>
1704 #include <STM32ArduinoCompat/HardwareSPI.h>
1705 #define RH_HAVE_HARDWARE_SPI
1706 // Defines which timer to use on Maple
1707 #define MAPLE_TIMER 1
1708 #define PROGMEM
1709 #define memcpy_P memcpy
1710 #define Serial SerialUSB
1711 #define RH_HAVE_SERIAL
1712
1713#elif (RH_PLATFORM == RH_PLATFORM_STM32L0)
1714 #include <Arduino.h>
1715 #include <SPI.h>
1716 // Can define this in platformio.ini
1717 #ifndef RH_EXCLUDE_STM32L0_INCLUDES
1718 // https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0
1719 #include <stm32l0_gpio.h>
1720 #include <stm32l0_exti.h>
1721 #include <stm32l0_rtc.h>
1722 #endif
1723 #define RH_HAVE_HARDWARE_SPI
1724 #define RH_HAVE_SERIAL
1725
1726#elif (RH_PLATFORM == RH_PLATFORM_STM32F2) // Particle Photon with firmware-develop
1727 #include <stm32f2xx.h>
1728 #include <application.h>
1729 #include <math.h> // floor
1730 #define RH_HAVE_SERIAL
1731 #define RH_HAVE_HARDWARE_SPI
1732
1733#elif (RH_PLATFORM == RH_PLATFORM_STM32STD) // STM32 with STM32F4xx_StdPeriph_Driver
1734 #include <stm32f4xx.h>
1735 #include <wirish.h>
1736 #include <stdint.h>
1737 #include <string.h>
1738 #include <math.h>
1739 #include <HardwareSPI.h>
1740 #define RH_HAVE_HARDWARE_SPI
1741 #define Serial SerialUSB
1742 #define RH_HAVE_SERIAL
1743
1744#elif (RH_PLATFORM == RH_PLATFORM_GENERIC_AVR8)
1745 #include <avr/io.h>
1746 #include <avr/interrupt.h>
1747 #include <util/delay.h>
1748 #include <string.h>
1749 #include <stdbool.h>
1750 #define RH_HAVE_HARDWARE_SPI
1751 #include <SPI.h>
1752
1753// For Steve Childress port to ARM M4 w/CMSIS with STM's Hardware Abstraction lib.
1754// See ArduinoWorkarounds.h (not supplied)
1755#elif (RH_PLATFORM == RH_PLATFORM_STM32F4_HAL)
1756 #include <ArduinoWorkarounds.h>
1757 #include <stm32f4xx.h> // Also using ST's CubeMX to generate I/O and CPU setup source code for IAR/EWARM, not GCC ARM.
1758 #include <stdint.h>
1759 #include <string.h>
1760 #include <math.h>
1761 #define RH_HAVE_HARDWARE_SPI // using HAL (Hardware Abstraction Libraries from ST along with CMSIS, not arduino libs or pins concept.
1762
1763#elif (RH_PLATFORM == RH_PLATFORM_RASPI)
1764 #define RH_HAVE_HARDWARE_SPI
1765 #define RH_HAVE_SERIAL
1766 #define PROGMEM
1767// You can enable MUTEX to protect critical sections for multithreading
1768// #define RH_USE_MUTEX
1769 #if (__has_include (<pigpio.h>))
1770 #include <RHutil_pigpio/RasPi.h>
1771 #else
1772 #include <RHutil/RasPi.h>
1773 #endif
1774 #include <string.h>
1775 //Define SS for CS0 or pin 24
1776 #define SS 8
1777
1778#elif (RH_PLATFORM == RH_PLATFORM_NRF51)
1779 #define RH_HAVE_SERIAL
1780 #define PROGMEM
1781 #include <Arduino.h>
1782
1783#elif (RH_PLATFORM == RH_PLATFORM_NRF52)
1784 #include <SPI.h>
1785 #define RH_HAVE_HARDWARE_SPI
1786 #define RH_HAVE_SERIAL
1787 #define PROGMEM
1788 #include <Arduino.h>
1789
1790#elif (RH_PLATFORM == RH_PLATFORM_UNIX)
1791 // Simulate the sketch on Linux and OSX
1792 #include <RHutil/simulator.h>
1793 #define RH_HAVE_SERIAL
1794#include <netinet/in.h> // For htons and friends
1795
1796#else
1797 #error Platform unknown!
1798#endif
1799
1800////////////////////////////////////////////////////
1801// This is an attempt to make a portable atomic block
1802#if (RH_PLATFORM == RH_PLATFORM_ARDUINO)
1803 #if defined(__arm__)
1804 #include <RHutil/atomic.h>
1805 #else
1806 #include <util/atomic.h>
1807 #endif
1808 #if defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_UNOR4_WIFI)
1809 // Standard arduino ATOMIC block crashes on MBED version of Pico as at 2021-08-12 // and ius not available/required for UNO R4
1810 #define ATOMIC_BLOCK_START {
1811 #define ATOMIC_BLOCK_END }
1812 #else
1813 // Most Arduinos
1814 #define ATOMIC_BLOCK_START ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
1815 #define ATOMIC_BLOCK_END }
1816 #endif
1817#elif (RH_PLATFORM == RH_PLATFORM_CHIPKIT_CORE)
1818 // UsingChipKIT Core on Arduino IDE
1819 #define ATOMIC_BLOCK_START unsigned int __status = disableInterrupts(); {
1820 #define ATOMIC_BLOCK_END } restoreInterrupts(__status);
1821#elif (RH_PLATFORM == RH_PLATFORM_UNO32)
1822 // Under old MPIDE, which has been discontinued:
1823 #include <peripheral/int.h>
1824 #define ATOMIC_BLOCK_START unsigned int __status = INTDisableInterrupts(); {
1825 #define ATOMIC_BLOCK_END } INTRestoreInterrupts(__status);
1826#elif (RH_PLATFORM == RH_PLATFORM_STM32L0)
1827 #define ATOMIC_BLOCK_START uint32_t primask = __get_PRIMASK(); __disable_irq(); {
1828 #define ATOMIC_BLOCK_END } __set_PRIMASK(primask);
1829#elif (RH_PLATFORM == RH_PLATFORM_STM32F2) // Particle Photon with firmware-develop
1830 #define ATOMIC_BLOCK_START { int __prev = HAL_disable_irq();
1831 #define ATOMIC_BLOCK_END HAL_enable_irq(__prev); }
1832#elif (RH_PLATFORM == RH_PLATFORM_ESP8266)
1833// See hardware/esp8266/2.0.0/cores/esp8266/Arduino.h
1834 #define ATOMIC_BLOCK_START { uint32_t __savedPS = xt_rsil(15);
1835 #define ATOMIC_BLOCK_END xt_wsr_ps(__savedPS);}
1836#elif (RH_PLATFORM == RH_PLATFORM_ESP32)
1837// jPerotto see hardware/esp32/1.0.4/tools/sdk/include/esp32/xtensa/xruntime.h
1838// No, not supported on ESP32C3
1839// #define ATOMIC_BLOCK_START uint32_t volatile register ilevel = XTOS_DISABLE_ALL_INTERRUPTS;
1840// #define ATOMIC_BLOCK_END XTOS_RESTORE_INTLEVEL(ilevel);
1841// This compiles for all ESP32 but is it correct?
1842// #define ATOMIC_BLOCK_START int RH_ATOMIC_state = portSET_INTERRUPT_MASK_FROM_ISR();
1843// #define ATOMIC_BLOCK_END portCLEAR_INTERRUPT_MASK_FROM_ISR(RH_ATOMIC_state);
1844// These appear to be defined for all ESP32 type:
1845 #include "freertos/atomic.h"
1846 #define ATOMIC_BLOCK_START ATOMIC_ENTER_CRITICAL()
1847 #define ATOMIC_BLOCK_END ATOMIC_EXIT_CRITICAL()
1848#else
1849 // TO BE DONE:
1850 #define ATOMIC_BLOCK_START
1851 #define ATOMIC_BLOCK_END
1852#endif
1853
1854////////////////////////////////////////////////////
1855// Try to be compatible with systems that support yield() and multitasking
1856// instead of spin-loops
1857// Recent Arduino IDE or Teensy 3 has yield()
1858#if (RH_PLATFORM == RH_PLATFORM_ARDUINO && ARDUINO >= 155) || (defined(TEENSYDUINO) && defined(__MK20DX128__))
1859 #define YIELD yield();
1860#elif (RH_PLATFORM == RH_PLATFORM_ESP8266)
1861// ESP8266 also has it
1862 #define YIELD yield();
1863#elif (RH_PLATFORM == RH_PLATFORM_STM32L0)
1864 #define YIELD yield();
1865#elif (RH_PLATFORM == RH_PLATFORM_MONGOOSE_OS)
1866 //ESP32 and ESP8266 use freertos so we include calls
1867 //that we would normall exit a function and return to
1868 //the rtos in mgosYield() (E.G flush TX uart buffer
1869 extern "C" {
1870 void mgosYield(void);
1871 }
1872 #define YIELD mgosYield()
1873#elif (RH_PLATFORM == RH_PLATFORM_ESP32)
1874 // ESP32 also has it
1875 #define YIELD yield();
1876#else
1877 #define YIELD
1878#endif
1879
1880////////////////////////////////////////////////////
1881// digitalPinToInterrupt is not available prior to Arduino 1.5.6 and 1.0.6
1882// See http://arduino.cc/en/Reference/attachInterrupt
1883#ifndef NOT_AN_INTERRUPT
1884 #define NOT_AN_INTERRUPT -1
1885#endif
1886#ifndef digitalPinToInterrupt
1887 #if (RH_PLATFORM == RH_PLATFORM_ARDUINO) && !defined(__arm__)
1888
1889 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
1890 // Arduino Mega, Mega ADK, Mega Pro
1891 // 2->0, 3->1, 21->2, 20->3, 19->4, 18->5
1892 #define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : ((p) >= 18 && (p) <= 21 ? 23 - (p) : NOT_AN_INTERRUPT)))
1893
1894 #elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)
1895 // Arduino 1284 and 1284P - See Manicbug and Optiboot
1896 // 10->0, 11->1, 2->2
1897 #define digitalPinToInterrupt(p) ((p) == 10 ? 0 : ((p) == 11 ? 1 : ((p) == 2 ? 2 : NOT_AN_INTERRUPT)))
1898
1899 #elif defined(__AVR_ATmega32U4__)
1900 // Leonardo, Yun, Micro, Pro Micro, Flora, Esplora
1901 // 3->0, 2->1, 0->2, 1->3, 7->4
1902 #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
1903
1904 #else
1905 // All other arduino except Due:
1906 // Serial Arduino, Extreme, NG, BT, Uno, Diecimila, Duemilanove, Nano, Menta, Pro, Mini 04, Fio, LilyPad, Ethernet etc
1907 // 2->0, 3->1
1908 #define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))
1909
1910 #endif
1911
1912 #elif (RH_PLATFORM == RH_PLATFORM_UNO32) || (RH_PLATFORM == RH_PLATFORM_CHIPKIT_CORE)
1913 // Hmmm, this is correct for Uno32, but what about other boards on ChipKIT Core?
1914 #define digitalPinToInterrupt(p) ((p) == 38 ? 0 : ((p) == 2 ? 1 : ((p) == 7 ? 2 : ((p) == 8 ? 3 : ((p) == 735 ? 4 : NOT_AN_INTERRUPT)))))
1915
1916 #elif (RH_PLATFORM == RH_PLATFORM_ESP32)
1917 #define digitalPinToInterrupt(p) (((p) < 40) ? (p) : -1)
1918
1919 #elif (RH_PLATFORM == RH_PLATFORM_ESP8266)
1920 #define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)? (p) : NOT_AN_INTERRUPT)
1921
1922
1923 #else
1924 // Everything else (including Due and Teensy) interrupt number the same as the interrupt pin number
1925 #define digitalPinToInterrupt(p) (p)
1926 #endif
1927#endif
1928
1929// On some platforms, attachInterrupt() takes a pin number, not an interrupt number
1930#if (RH_PLATFORM == RH_PLATFORM_ARDUINO) && defined (__arm__) && (defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_SAM_DUE)) || defined(ARDUINO_ARCH_STM32L0)
1931 #define RH_ATTACHINTERRUPT_TAKES_PIN_NUMBER
1932#endif
1933
1934// Slave select pin, some platforms such as ATTiny do not define it.
1935// ESP32 pins_arduino.h uses static const uint8_t SS = <UINT>; instead
1936// of a #define to declare the SS constant.
1937#if (RH_PLATFORM != RH_PLATFORM_ESP32)
1938 #ifndef SS
1939 #define SS 10
1940 #endif
1941#endif
1942
1943// Some platforms require special attributes for interrupt routines
1944#if (RH_PLATFORM == RH_PLATFORM_ESP8266)
1945 // interrupt handler and related code must be in RAM on ESP8266,
1946 // according to issue #46.
1947 // 2023-09-19: ESP8266 is now compatible with ESP 32 and uses IRAM_ATTR
1948 #define RH_INTERRUPT_ATTR IRAM_ATTR
1949
1950#elif (RH_PLATFORM == RH_PLATFORM_ESP32)
1951 #define RH_INTERRUPT_ATTR IRAM_ATTR
1952#else
1953 #define RH_INTERRUPT_ATTR
1954#endif
1955
1956// These defs cause trouble on some versions of Arduino
1957#undef abs
1958#undef round
1959#undef double
1960
1961// Sigh: there is no widespread adoption of htons and friends in the base code, only in some WiFi headers etc
1962// that have a lot of excess baggage
1963#if RH_PLATFORM != RH_PLATFORM_UNIX && !defined(htons)
1964// #ifndef htons
1965// These predefined macros available on modern GCC compilers
1966 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
1967 // Atmel processors
1968 #define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) )
1969 #define ntohs(x) htons(x)
1970 #define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \
1971 ((x)<< 8 & 0x00FF0000UL) | \
1972 ((x)>> 8 & 0x0000FF00UL) | \
1973 ((x)>>24 & 0x000000FFUL) )
1974 #define ntohl(x) htonl(x)
1975
1976 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
1977 // Others
1978 #define htons(x) (x)
1979 #define ntohs(x) (x)
1980 #define htonl(x) (x)
1981 #define ntohl(x) (x)
1982
1983 #else
1984 #error "RadioHead.h: Dont know how to define htons and friends for this processor"
1985 #endif
1986#endif
1987
1988// Some platforms need a mutex for multihreaded case
1989#ifdef RH_USE_MUTEX
1990 #include <pthread.h>
1991 #define RH_DECLARE_MUTEX(X) pthread_mutex_t X;
1992 #define RH_MUTEX_INIT(X) pthread_mutex_init(&X, NULL)
1993 #define RH_MUTEX_LOCK(X) pthread_mutex_lock(&X)
1994 #define RH_MUTEX_UNLOCK(X) pthread_mutex_unlock(&X)
1995#else
1996 #define RH_DECLARE_MUTEX(X)
1997 #define RH_MUTEX_INIT(X)
1998 #define RH_MUTEX_LOCK(X)
1999 #define RH_MUTEX_UNLOCK(X)
2000#endif
2001
2002// This is the address that indicates a broadcast
2003#define RH_BROADCAST_ADDRESS 0xff
2004
2005// Specifies an invalid IO pin selection
2006#define RH_INVALID_PIN 0xff
2007
2008// Here we have some system wide macroses you can define to alter the baviour of RadioHead
2009// in various ways. The Ardiono IDE has no way to configure such things at compile time so
2010// on that pltform you are forced to edit these macros here.
2011// On platformio you can add them to platformio.ini like, say:
2012// -D RH_ACK_DELAY=10`
2013
2014// Uncomment this to add a delay before acknowledgement in RHReliableDatagram.
2015// In some networks with mixed processor speeds, may need this delay to prevent a
2016// fast processor sending an ack before the receiver is ready for it.
2017// The time is in milliseconds
2018// #define RH_ACK_DELAY 10
2019
2020// RH_Uncomment this to control which timer used by RH_ASK in some platforms like
2021// STM32:
2022// #define RH_HW_TIMER TIM21`
2023
2024// Uncomment this is to enable Encryption (see RHEncryptedDriver):
2025// But ensure you have installed the Crypto directory from arduinolibs first:
2026// http://rweather.github.io/arduinolibs/index.html
2027//#define RH_ENABLE_ENCRYPTION_MODULE
2028
2029// Some platforms like RocketScream need this to see debug Serial output from within RH
2030// and if it goes to Serial, get a hang after a few minutes.
2031//#define Serial SerialUSB
2032
2033#endif