RadioLib
Universal wireless communication library for Arduino
BuildOpt.h
1 #if !defined(_RADIOLIB_BUILD_OPTIONS_H)
2 #define _RADIOLIB_BUILD_OPTIONS_H
3 
4 #if ARDUINO >= 100
5  #include "Arduino.h"
6 #else
7  #error "Unsupported Arduino version (< 1.0.0)"
8 #endif
9 
10 /*
11  * Platform-specific configuration.
12  *
13  * RADIOLIB_PLATFORM - platform name, used in debugging to quickly check the correct platform is detected.
14  * RADIOLIB_PIN_TYPE - which type should be used for pin numbers in functions like digitalRead().
15  * RADIOLIB_PIN_MODE - which type should be used for pin modes in functions like pinMode().
16  * RADIOLIB_PIN_STATUS - which type should be used for pin values in functions like digitalWrite().
17  * RADIOLIB_INTERRUPT_STATUS - which type should be used for pin changes in functions like attachInterrupt().
18  * RADIOLIB_DIGITAL_PIN_TO_INTERRUPT - function/macro to be used to convert digital pin number to interrupt pin number.
19  * RADIOLIB_NC - alias for unused pin, usually the largest possible value of RADIOLIB_PIN_TYPE.
20  * RADIOLIB_DEFAULT_SPI - default SPIClass instance to use.
21  * RADIOLIB_PROGMEM - macro to place variable into program storage (usually Flash).
22  * RADIOLIB_PROGMEM_READ_BYTE - function/macro to read variables saved in program storage (usually Flash).
23  * RADIOLIB_TYPE_ALIAS - construct to create an alias for a type, usually vai the `using` keyword.
24  * RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED - defined if the specific platform does not support SoftwareSerial.
25  * RADIOLIB_HARDWARE_SERIAL_PORT - which hardware serial port should be used on platform that do not have SoftwareSerial support.
26  * RADIOLIB_TONE_UNSUPPORTED - some platforms do not have tone()/noTone(), which is required for AFSK.
27  *
28  * In addition, some platforms may require RadioLib to disable specific drivers (such as ESP8266).
29  *
30  * Users may also specify their own configuration by uncommenting the RADIOLIB_CUSTOM_PLATFORM,
31  * and then specifying all platform parameters in the section below. This will override automatic
32  * platform detection.
33  */
34 
35 // uncomment to enable custom platform definition
36 //#define RADIOLIB_CUSTOM_PLATFORM
37 
38 #if defined(RADIOLIB_CUSTOM_PLATFORM)
39  // name for your platform
40  #define RADIOLIB_PLATFORM "Custom"
41 
42  // the following parameters must always be defined
43  #define RADIOLIB_PIN_TYPE uint8_t
44  #define RADIOLIB_PIN_MODE uint8_t
45  #define RADIOLIB_PIN_STATUS uint8_t
46  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
47  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
48  #define RADIOLIB_NC (0xFF)
49  #define RADIOLIB_DEFAULT_SPI SPI
50  #define RADIOLIB_PROGMEM PROGMEM
51  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
52  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
53 
54  // the following must be defined if the Arduino core does not support SoftwareSerial library
55  //#define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
56  //#define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
57 
58  // the following must be defined if the Arduino core does not support tone function
59  //#define RADIOLIB_TONE_UNSUPPORTED
60 
61  // some platforms seem to have issues with SPI modules that use a command interface
62  // this can be mitigated by adding delays into SPI communication
63  // (see https://github.com/jgromes/RadioLib/issues/158 for details)
64  //#define RADIOLIB_SPI_SLOWDOWN
65 
66  // some of RadioLib drivers may be excluded, to prevent collisions with platforms (or to speed up build process)
67  // the following is a complete list of all possible exclusion macros, uncomment any of them to disable that driver
68  // NOTE: Some of the exclusion macros are dependent on each other. For example, it is not possible to exclude RF69
69  // while keeping SX1231 (because RF69 is the base class for SX1231). The dependency is always uni-directional,
70  // so excluding SX1231 and keeping RF69 is valid.
71  //#define RADIOLIB_EXCLUDE_CC1101
72  //#define RADIOLIB_EXCLUDE_ESP8266
73  //#define RADIOLIB_EXCLUDE_HC05
74  //#define RADIOLIB_EXCLUDE_JDY08
75  //#define RADIOLIB_EXCLUDE_NRF24
76  //#define RADIOLIB_EXCLUDE_RF69
77  //#define RADIOLIB_EXCLUDE_SX1231 // dependent on RADIOLIB_EXCLUDE_RF69
78  //#define RADIOLIB_EXCLUDE_SI443X
79  //#define RADIOLIB_EXCLUDE_RFM2X // dependent on RADIOLIB_EXCLUDE_SI443X
80  //#define RADIOLIB_EXCLUDE_SX127X
81  //#define RADIOLIB_EXCLUDE_RFM9X // dependent on RADIOLIB_EXCLUDE_SX127X
82  //#define RADIOLIB_EXCLUDE_SX126X
83  //#define RADIOLIB_EXCLUDE_SX128X
84  //#define RADIOLIB_EXCLUDE_XBEE
85  //#define RADIOLIB_EXCLUDE_AFSK
86  //#define RADIOLIB_EXCLUDE_AX25
87  //#define RADIOLIB_EXCLUDE_HELLSCHREIBER
88  //#define RADIOLIB_EXCLUDE_HTTP
89  //#define RADIOLIB_EXCLUDE_MORSE
90  //#define RADIOLIB_EXCLUDE_MQTT
91  //#define RADIOLIB_EXCLUDE_RTTY
92  //#define RADIOLIB_EXCLUDE_SSTV
93 
94 #else
95  #if defined(__AVR__) && !(defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY) || defined(ARDUINO_ARCH_MEGAAVR))
96  // Arduino AVR boards (except for megaAVR) - Uno, Mega etc.
97  #define RADIOLIB_PLATFORM "Arduino AVR"
98  #define RADIOLIB_PIN_TYPE uint8_t
99  #define RADIOLIB_PIN_MODE uint8_t
100  #define RADIOLIB_PIN_STATUS uint8_t
101  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
102  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
103  #define RADIOLIB_NC (0xFF)
104  #define RADIOLIB_DEFAULT_SPI SPI
105  #define RADIOLIB_PROGMEM PROGMEM
106  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
107  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
108 
109  #elif defined(ESP8266)
110  // ESP8266 boards
111  #define RADIOLIB_PLATFORM "ESP8266"
112  #define RADIOLIB_PIN_TYPE uint8_t
113  #define RADIOLIB_PIN_MODE uint8_t
114  #define RADIOLIB_PIN_STATUS uint8_t
115  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
116  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
117  #define RADIOLIB_NC (0xFF)
118  #define RADIOLIB_DEFAULT_SPI SPI
119  #define RADIOLIB_PROGMEM PROGMEM
120  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
121  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
122 
123  // RadioLib has ESP8266 driver, this must be disabled to use ESP8266 as platform
124  #define RADIOLIB_EXCLUDE_ESP8266
125  #define RADIOLIB_EXCLUDE_HTTP
126 
127  #elif defined(ESP32)
128  // ESP32 boards
129  #define RADIOLIB_PLATFORM "ESP32"
130  #define RADIOLIB_PIN_TYPE uint8_t
131  #define RADIOLIB_PIN_MODE uint8_t
132  #define RADIOLIB_PIN_STATUS uint8_t
133  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
134  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
135  #define RADIOLIB_NC (0xFF)
136  #define RADIOLIB_DEFAULT_SPI SPI
137  #define RADIOLIB_PROGMEM PROGMEM
138  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
139  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
140  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
141  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
142 
143  // ESP32 doesn't support tone(), but it can be emulated via LED control peripheral
144  #define RADIOLIB_TONE_UNSUPPORTED
145  #define RADIOLIB_TONE_ESP32_CHANNEL (1)
146 
147  #elif defined(ARDUINO_ARCH_STM32)
148  // official STM32 Arduino core (https://github.com/stm32duino/Arduino_Core_STM32)
149  #define RADIOLIB_PLATFORM "Arduino STM32 (official)"
150  #define RADIOLIB_PIN_TYPE uint32_t
151  #define RADIOLIB_PIN_MODE uint32_t
152  #define RADIOLIB_PIN_STATUS uint32_t
153  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
154  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
155  #define RADIOLIB_NC (0xFFFFFFFF)
156  #define RADIOLIB_DEFAULT_SPI SPI
157  #define RADIOLIB_PROGMEM PROGMEM
158  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
159  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
160  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
161  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
162 
163  // slow down SX126x/8x SPI on this platform
164  #define RADIOLIB_SPI_SLOWDOWN
165 
166  #elif defined(SAMD_SERIES)
167  // Adafruit SAMD boards (M0 and M4)
168  #define RADIOLIB_PLATFORM "Adafruit SAMD"
169  #define RADIOLIB_PIN_TYPE uint32_t
170  #define RADIOLIB_PIN_MODE uint32_t
171  #define RADIOLIB_PIN_STATUS uint32_t
172  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
173  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
174  #define RADIOLIB_NC (0xFFFFFFFF)
175  #define RADIOLIB_DEFAULT_SPI SPI
176  #define RADIOLIB_PROGMEM PROGMEM
177  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
178  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
179  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
180  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
181 
182  // slow down SX126x/8x SPI on this platform
183  #define RADIOLIB_SPI_SLOWDOWN
184 
185  #elif defined(ARDUINO_ARCH_SAMD)
186  // Arduino SAMD (Zero, MKR, etc.)
187  #define RADIOLIB_PLATFORM "Arduino SAMD"
188  #define RADIOLIB_PIN_TYPE pin_size_t
189  #define RADIOLIB_PIN_MODE PinMode
190  #define RADIOLIB_PIN_STATUS PinStatus
191  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
192  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
193  #define RADIOLIB_NC (0xFF)
194  #define RADIOLIB_DEFAULT_SPI SPI
195  #define RADIOLIB_PROGMEM PROGMEM
196  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
197  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
198  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
199  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
200 
201  #elif defined(__SAM3X8E__)
202  // Arduino Due
203  #define RADIOLIB_PLATFORM "Arduino Due"
204  #define RADIOLIB_PIN_TYPE uint32_t
205  #define RADIOLIB_PIN_MODE uint32_t
206  #define RADIOLIB_PIN_STATUS uint32_t
207  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
208  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
209  #define RADIOLIB_NC (0xFFFFFFFF)
210  #define RADIOLIB_DEFAULT_SPI SPI
211  #define RADIOLIB_PROGMEM PROGMEM
212  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
213  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
214  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
215  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
216  #define RADIOLIB_TONE_UNSUPPORTED
217 
218  #elif (defined(NRF52832_XXAA) || defined(NRF52840_XXAA)) && !defined(ARDUINO_ARDUINO_NANO33BLE)
219  // Adafruit nRF52 boards
220  #define RADIOLIB_PLATFORM "Adafruit nRF52"
221  #define RADIOLIB_PIN_TYPE uint32_t
222  #define RADIOLIB_PIN_MODE uint32_t
223  #define RADIOLIB_PIN_STATUS uint32_t
224  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
225  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
226  #define RADIOLIB_NC (0xFFFFFFFF)
227  #define RADIOLIB_DEFAULT_SPI SPI
228  #define RADIOLIB_PROGMEM PROGMEM
229  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
230  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
231 
232  #elif defined(ARDUINO_ARC32_TOOLS)
233  // Intel Curie
234  #define RADIOLIB_PLATFORM "Intel Curie"
235  #define RADIOLIB_PIN_TYPE uint8_t
236  #define RADIOLIB_PIN_MODE uint8_t
237  #define RADIOLIB_PIN_STATUS uint8_t
238  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
239  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
240  #define RADIOLIB_NC (0xFF)
241  #define RADIOLIB_DEFAULT_SPI SPI
242  #define RADIOLIB_PROGMEM PROGMEM
243  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
244 
245  #elif defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY)
246  // Arduino megaAVR boards - Uno Wifi Rev.2, Nano Every
247  #define RADIOLIB_PLATFORM "Arduino megaAVR"
248  #define RADIOLIB_PIN_TYPE uint8_t
249  #define RADIOLIB_PIN_MODE PinMode
250  #define RADIOLIB_PIN_STATUS PinStatus
251  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
252  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
253  #define RADIOLIB_NC (0xFF)
254  #define RADIOLIB_DEFAULT_SPI SPI
255  #define RADIOLIB_PROGMEM PROGMEM
256  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
257  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
258 
259  #elif defined(ARDUINO_ARCH_APOLLO3)
260  // Sparkfun Apollo3 boards
261  #define RADIOLIB_PLATFORM "Sparkfun Apollo3"
262  #define RADIOLIB_PIN_TYPE pin_size_t
263  #define RADIOLIB_PIN_MODE Arduino_PinMode
264  #define RADIOLIB_PIN_STATUS PinStatus
265  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
266  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
267  #define RADIOLIB_NC (0xFF)
268  #define RADIOLIB_DEFAULT_SPI SPI
269  #define RADIOLIB_PROGMEM PROGMEM
270  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
271  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
272  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
273  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
274 
275  // Apollo3 uses mbed libraries, which already contain ESP8266 driver
276  #define RADIOLIB_EXCLUDE_ESP8266
277 
278  // slow down SX126x/8x SPI on this platform
279  #define RADIOLIB_SPI_SLOWDOWN
280 
281  #elif defined(ARDUINO_ARDUINO_NANO33BLE)
282  // Arduino Nano 33 BLE
283  #define RADIOLIB_PLATFORM "Arduino Nano 33 BLE"
284  #define RADIOLIB_PIN_TYPE pin_size_t
285  #define RADIOLIB_PIN_MODE PinMode
286  #define RADIOLIB_PIN_STATUS PinStatus
287  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
288  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
289  #define RADIOLIB_NC (0xFF)
290  #define RADIOLIB_DEFAULT_SPI SPI
291  #define RADIOLIB_PROGMEM PROGMEM
292  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
293  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
294  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
295  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
296 
297  // Nano 33 BLE uses mbed libraries, which already contain ESP8266 driver
298  #define RADIOLIB_EXCLUDE_ESP8266
299 
300  #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
301  // Arduino Portenta H7
302  #define RADIOLIB_PLATFORM "Portenta H7"
303  #define RADIOLIB_PIN_TYPE pin_size_t
304  #define RADIOLIB_PIN_MODE PinMode
305  #define RADIOLIB_PIN_STATUS PinStatus
306  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
307  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
308  #define RADIOLIB_NC (0xFF)
309  #define RADIOLIB_DEFAULT_SPI SPI
310  #define RADIOLIB_PROGMEM PROGMEM
311  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
312  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
313  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
314  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
315 
316  // Arduino Portenta H7 uses mbed libraries, which already contain ESP8266 driver
317  #define RADIOLIB_EXCLUDE_ESP8266
318 
319  #elif defined(__STM32F4__) || defined(__STM32F1__)
320  // Arduino STM32 core by Roger Clark (https://github.com/rogerclarkmelbourne/Arduino_STM32)
321  #define RADIOLIB_PLATFORM "STM32duino (unofficial)"
322  #define RADIOLIB_PIN_TYPE uint8_t
323  #define RADIOLIB_PIN_MODE WiringPinMode
324  #define RADIOLIB_PIN_STATUS uint8_t
325  #define RADIOLIB_INTERRUPT_STATUS ExtIntTriggerMode
326  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
327  #define RADIOLIB_NC (0xFF)
328  #define RADIOLIB_DEFAULT_SPI SPI
329  #define RADIOLIB_PROGMEM PROGMEM
330  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
331  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
332  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
333  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
334 
335  #elif defined(ARDUINO_ARCH_MEGAAVR)
336  // MegaCoreX by MCUdude (https://github.com/MCUdude/MegaCoreX)
337  #define RADIOLIB_PLATFORM "MegaCoreX"
338  #define RADIOLIB_PIN_TYPE uint8_t
339  #define RADIOLIB_PIN_MODE uint8_t
340  #define RADIOLIB_PIN_STATUS uint8_t
341  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
342  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
343  #define RADIOLIB_NC (0xFF)
344  #define RADIOLIB_DEFAULT_SPI SPI
345  #define RADIOLIB_PROGMEM PROGMEM
346  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
347  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
348 
349  #elif defined(ARDUINO_ARCH_RP2040)
350  // Raspberry Pi Pico
351  #define RADIOLIB_PLATFORM "Raspberry Pi Pico"
352  #define RADIOLIB_PIN_TYPE pin_size_t
353  #define RADIOLIB_PIN_MODE PinMode
354  #define RADIOLIB_PIN_STATUS PinStatus
355  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
356  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
357  #define RADIOLIB_NC (0xFF)
358  #define RADIOLIB_DEFAULT_SPI SPI
359  #define RADIOLIB_PROGMEM PROGMEM
360  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
361  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
362  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
363  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
364  #define RADIOLIB_EXCLUDE_ESP8266
365 
366  #elif defined(__ASR6501__)
367  // CubeCell
368  #define RADIOLIB_PLATFORM "CubeCell"
369  #define RADIOLIB_PIN_TYPE uint8_t
370  #define RADIOLIB_PIN_MODE PINMODE
371  #define RADIOLIB_PIN_STATUS uint8_t
372  #define RADIOLIB_INTERRUPT_STATUS IrqModes
373  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
374  #define RADIOLIB_NC (0xFF)
375  #define RADIOLIB_DEFAULT_SPI SPI
376  #define RADIOLIB_PROGMEM PROGMEM
377  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
378 
379  // CubeCell doesn't seem to define nullptr, let's do something like that now
380  #define nullptr NULL
381 
382  // ... and also defines pinMode() as a macro, which is by far the stupidest thing I have seen on Arduino
383  #undef pinMode
384 
385  // ... and uses an outdated GCC which does not support type aliases
386  #define RADIOLIB_TYPE_ALIAS(type, alias) typedef class type alias;
387 
388  // ... and it also has no tone(). This platform was designed by an idiot.
389  #define RADIOLIB_TONE_UNSUPPORTED
390 
391  #else
392  // other platforms not covered by the above list - this may or may not work
393  #define RADIOLIB_PLATFORM "Unknown"
394  #define RADIOLIB_UNKNOWN_PLATFORM
395  #define RADIOLIB_PIN_TYPE uint8_t
396  #define RADIOLIB_PIN_MODE uint8_t
397  #define RADIOLIB_PIN_STATUS uint8_t
398  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
399  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
400  #define RADIOLIB_NC (0xFF)
401  #define RADIOLIB_DEFAULT_SPI SPI
402  #define RADIOLIB_PROGMEM PROGMEM
403  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
404  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
405 
406  #endif
407 #endif
408 
409 /*
410  * Uncomment to enable debug output.
411  * Warning: Debug output will slow down the whole system significantly.
412  * Also, it will result in larger compiled binary.
413  * Levels: debug - only main info
414  * verbose - full transcript of all SPI/UART communication
415  */
416 
417 //#define RADIOLIB_DEBUG
418 //#define RADIOLIB_VERBOSE
419 
420 // set which Serial port should be used for debug output
421 #define RADIOLIB_DEBUG_PORT Serial
422 
423 #if defined(RADIOLIB_DEBUG)
424  #define RADIOLIB_DEBUG_PRINT(...) { RADIOLIB_DEBUG_PORT.print(__VA_ARGS__); }
425  #define RADIOLIB_DEBUG_PRINTLN(...) { RADIOLIB_DEBUG_PORT.println(__VA_ARGS__); }
426 #else
427  #define RADIOLIB_DEBUG_PRINT(...) {}
428  #define RADIOLIB_DEBUG_PRINTLN(...) {}
429 #endif
430 
431 #if defined(RADIOLIB_VERBOSE)
432  #define RADIOLIB_VERBOSE_PRINT(...) { RADIOLIB_DEBUG_PORT.print(__VA_ARGS__); }
433  #define RADIOLIB_VERBOSE_PRINTLN(...) { RADIOLIB_DEBUG_PORT.println(__VA_ARGS__); }
434 #else
435  #define RADIOLIB_VERBOSE_PRINT(...) {}
436  #define RADIOLIB_VERBOSE_PRINTLN(...) {}
437 #endif
438 
439 /*
440  * Uncomment to enable "paranoid" SPI mode
441  * Every write to an SPI register using SPI set function will be verified by a subsequent read operation.
442  * This improves reliablility, but slightly slows down communication.
443  * Note: Enabled by default.
444  */
445 #define RADIOLIB_SPI_PARANOID
446 
447 /*
448  * Uncomment to enable parameter range checking
449  * RadioLib will check provided parameters (such as frequency) against limits determined by the device manufacturer.
450  * It is highly advised to keep this macro defined, removing it will allow invalid values to be set,
451  * possibly leading to bricked module and/or program crashing.
452  * Note: Enabled by default.
453  */
454 #define RADIOLIB_CHECK_PARAMS
455 
456 /*
457  * Uncomment to enable SX127x errata fix
458  * Warning: SX127x errata fix has been reported to cause issues with LoRa bandwidths lower than 62.5 kHz.
459  * It should only be enabled if you really are observing some errata-related issue.
460  * Note: Disabled by default.
461  */
462 //#define RADIOLIB_FIX_ERRATA_SX127X
463 
464 #if defined(RADIOLIB_FIX_ERRATA_SX127X)
465  #define RADIOLIB_ERRATA_SX127X(...) { errataFix(__VA_ARGS__); }
466 #else
467  #define RADIOLIB_ERRATA_SX127X(...) {}
468 #endif
469 
470 /*
471  * Uncomment to enable god mode - all methods and member variables in all classes will be made public, thus making them accessible from Arduino code.
472  * Warning: Come on, it's called GOD mode - obviously only use this if you know what you're doing.
473  * Failure to heed the above warning may result in bricked module.
474  */
475 //#define RADIOLIB_GODMODE
476 
477 /*
478  * Uncomment to enable low-level hardware access
479  * This will make some hardware methods like SPI get/set accessible from the user sketch - think of it as "god mode lite"
480  * Warning: RadioLib won't stop you from writing invalid stuff into your device, so it's quite easy to brick your module with this.
481  */
482 //#define RADIOLIB_LOW_LEVEL
483 
484 /*
485  * Uncomment to enable pre-defined modules when using RadioShield.
486  */
487 //#define RADIOLIB_RADIOSHIELD
488 
489 /*
490  * Uncomment to enable static-only memory management: no dynamic allocation will be performed.
491  * Warning: Large static arrays will be created in some methods. It is not advised to send large packets in this mode.
492  */
493 //#define RADIOLIB_STATIC_ONLY
494 
495 // set the size of static arrays to use
496 #if !defined(RADIOLIB_STATIC_ARRAY_SIZE)
497 #define RADIOLIB_STATIC_ARRAY_SIZE 256
498 #endif
499 
503 #define RADIOLIB_ASSERT(STATEVAR) { if((STATEVAR) != ERR_NONE) { return(STATEVAR); } }
504 
508 #if defined(RADIOLIB_CHECK_PARAMS)
509 #define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) { if(!(((VAR) >= (MIN)) && ((VAR) <= (MAX)))) { return(ERR); } }
510 #else
511 #define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) {}
512 #endif
513 
514 // version definitions
515 #define RADIOLIB_VERSION_MAJOR (0x04)
516 #define RADIOLIB_VERSION_MINOR (0x05)
517 #define RADIOLIB_VERSION_PATCH (0x00)
518 #define RADIOLIB_VERSION_EXTRA (0x00)
519 
520 #define RADIOLIB_VERSION ((RADIOLIB_VERSION_MAJOR << 24) | (RADIOLIB_VERSION_MINOR << 16) | (RADIOLIB_VERSION_PATCH << 8) | (RADIOLIB_VERSION_EXTRA))
521 
522 #endif