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  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
245 
246  #elif defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY)
247  // Arduino megaAVR boards - Uno Wifi Rev.2, Nano Every
248  #define RADIOLIB_PLATFORM "Arduino megaAVR"
249  #define RADIOLIB_PIN_TYPE uint8_t
250  #define RADIOLIB_PIN_MODE PinMode
251  #define RADIOLIB_PIN_STATUS PinStatus
252  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
253  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
254  #define RADIOLIB_NC (0xFF)
255  #define RADIOLIB_DEFAULT_SPI SPI
256  #define RADIOLIB_PROGMEM PROGMEM
257  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
258  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
259 
260  #elif defined(ARDUINO_ARCH_APOLLO3)
261  // Sparkfun Apollo3 boards
262  #define RADIOLIB_PLATFORM "Sparkfun Apollo3"
263  #define RADIOLIB_PIN_TYPE pin_size_t
264  #define RADIOLIB_PIN_MODE Arduino_PinMode
265  #define RADIOLIB_PIN_STATUS PinStatus
266  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
267  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
268  #define RADIOLIB_NC (0xFF)
269  #define RADIOLIB_DEFAULT_SPI SPI
270  #define RADIOLIB_PROGMEM PROGMEM
271  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
272  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
273  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
274  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
275 
276  // Apollo3 uses mbed libraries, which already contain ESP8266 driver
277  #define RADIOLIB_EXCLUDE_ESP8266
278 
279  // slow down SX126x/8x SPI on this platform
280  #define RADIOLIB_SPI_SLOWDOWN
281 
282  #elif defined(ARDUINO_ARDUINO_NANO33BLE)
283  // Arduino Nano 33 BLE
284  #define RADIOLIB_PLATFORM "Arduino Nano 33 BLE"
285  #define RADIOLIB_PIN_TYPE pin_size_t
286  #define RADIOLIB_PIN_MODE PinMode
287  #define RADIOLIB_PIN_STATUS PinStatus
288  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
289  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
290  #define RADIOLIB_NC (0xFF)
291  #define RADIOLIB_DEFAULT_SPI SPI
292  #define RADIOLIB_PROGMEM PROGMEM
293  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
294  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
295  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
296  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
297 
298  // Nano 33 BLE uses mbed libraries, which already contain ESP8266 driver
299  #define RADIOLIB_EXCLUDE_ESP8266
300 
301  #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
302  // Arduino Portenta H7
303  #define RADIOLIB_PLATFORM "Portenta H7"
304  #define RADIOLIB_PIN_TYPE pin_size_t
305  #define RADIOLIB_PIN_MODE PinMode
306  #define RADIOLIB_PIN_STATUS PinStatus
307  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
308  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
309  #define RADIOLIB_NC (0xFF)
310  #define RADIOLIB_DEFAULT_SPI SPI
311  #define RADIOLIB_PROGMEM PROGMEM
312  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
313  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
314  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
315  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
316 
317  // Arduino Portenta H7 uses mbed libraries, which already contain ESP8266 driver
318  #define RADIOLIB_EXCLUDE_ESP8266
319 
320  #elif defined(__STM32F4__) || defined(__STM32F1__)
321  // Arduino STM32 core by Roger Clark (https://github.com/rogerclarkmelbourne/Arduino_STM32)
322  #define RADIOLIB_PLATFORM "STM32duino (unofficial)"
323  #define RADIOLIB_PIN_TYPE uint8_t
324  #define RADIOLIB_PIN_MODE WiringPinMode
325  #define RADIOLIB_PIN_STATUS uint8_t
326  #define RADIOLIB_INTERRUPT_STATUS ExtIntTriggerMode
327  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
328  #define RADIOLIB_NC (0xFF)
329  #define RADIOLIB_DEFAULT_SPI SPI
330  #define RADIOLIB_PROGMEM PROGMEM
331  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
332  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
333  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
334  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
335 
336  #elif defined(ARDUINO_ARCH_MEGAAVR)
337  // MegaCoreX by MCUdude (https://github.com/MCUdude/MegaCoreX)
338  #define RADIOLIB_PLATFORM "MegaCoreX"
339  #define RADIOLIB_PIN_TYPE uint8_t
340  #define RADIOLIB_PIN_MODE uint8_t
341  #define RADIOLIB_PIN_STATUS uint8_t
342  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
343  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
344  #define RADIOLIB_NC (0xFF)
345  #define RADIOLIB_DEFAULT_SPI SPI
346  #define RADIOLIB_PROGMEM PROGMEM
347  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
348  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
349 
350  #elif defined(ARDUINO_ARCH_RP2040)
351  // Raspberry Pi Pico
352  #define RADIOLIB_PLATFORM "Raspberry Pi Pico"
353  #define RADIOLIB_PIN_TYPE pin_size_t
354  #define RADIOLIB_PIN_MODE PinMode
355  #define RADIOLIB_PIN_STATUS PinStatus
356  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
357  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
358  #define RADIOLIB_NC (0xFF)
359  #define RADIOLIB_DEFAULT_SPI SPI
360  #define RADIOLIB_PROGMEM PROGMEM
361  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
362  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
363  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
364  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
365  #define RADIOLIB_EXCLUDE_ESP8266
366 
367  #elif defined(__ASR6501__) || defined(ARDUINO_ARCH_ASR650X) || defined(DARDUINO_ARCH_ASR6601)
368  // CubeCell
369  #define RADIOLIB_PLATFORM "CubeCell"
370  #define RADIOLIB_PIN_TYPE uint8_t
371  #define RADIOLIB_PIN_MODE PINMODE
372  #define RADIOLIB_PIN_STATUS uint8_t
373  #define RADIOLIB_INTERRUPT_STATUS IrqModes
374  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
375  #define RADIOLIB_NC (0xFF)
376  #define RADIOLIB_DEFAULT_SPI SPI
377  #define RADIOLIB_PROGMEM PROGMEM
378  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
379  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
380  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
381 
382  // CubeCell doesn't seem to define nullptr, let's do something like that now
383  #define nullptr NULL
384 
385  // ... and also defines pinMode() as a macro, which is by far the stupidest thing I have seen on Arduino
386  #undef pinMode
387 
388  // ... and uses an outdated GCC which does not support type aliases
389  #define RADIOLIB_TYPE_ALIAS(type, alias) typedef class type alias;
390 
391  // ... and it also has no tone(). This platform was designed by an idiot.
392  #define RADIOLIB_TONE_UNSUPPORTED
393 
394  // ... AND as the (hopefully) final nail in the coffin, IT F*CKING DEFINES YIELD() AS A MACRO THAT DOES NOTHING!!!
395  #define RADIOLIB_YIELD_UNSUPPORTED
396  #if defined(yield)
397  #undef yield
398  #endif
399 
400  #else
401  // other platforms not covered by the above list - this may or may not work
402  #define RADIOLIB_PLATFORM "Unknown"
403  #define RADIOLIB_UNKNOWN_PLATFORM
404  #define RADIOLIB_PIN_TYPE uint8_t
405  #define RADIOLIB_PIN_MODE uint8_t
406  #define RADIOLIB_PIN_STATUS uint8_t
407  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
408  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
409  #define RADIOLIB_NC (0xFF)
410  #define RADIOLIB_DEFAULT_SPI SPI
411  #define RADIOLIB_PROGMEM PROGMEM
412  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
413  #define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
414 
415  #endif
416 #endif
417 
418 /*
419  * Uncomment to enable debug output.
420  * Warning: Debug output will slow down the whole system significantly.
421  * Also, it will result in larger compiled binary.
422  * Levels: debug - only main info
423  * verbose - full transcript of all SPI/UART communication
424  */
425 
426 //#define RADIOLIB_DEBUG
427 //#define RADIOLIB_VERBOSE
428 
429 // set which Serial port should be used for debug output
430 #define RADIOLIB_DEBUG_PORT Serial
431 
432 #if defined(RADIOLIB_DEBUG)
433  #define RADIOLIB_DEBUG_PRINT(...) { RADIOLIB_DEBUG_PORT.print(__VA_ARGS__); }
434  #define RADIOLIB_DEBUG_PRINTLN(...) { RADIOLIB_DEBUG_PORT.println(__VA_ARGS__); }
435 #else
436  #define RADIOLIB_DEBUG_PRINT(...) {}
437  #define RADIOLIB_DEBUG_PRINTLN(...) {}
438 #endif
439 
440 #if defined(RADIOLIB_VERBOSE)
441  #define RADIOLIB_VERBOSE_PRINT(...) { RADIOLIB_DEBUG_PORT.print(__VA_ARGS__); }
442  #define RADIOLIB_VERBOSE_PRINTLN(...) { RADIOLIB_DEBUG_PORT.println(__VA_ARGS__); }
443 #else
444  #define RADIOLIB_VERBOSE_PRINT(...) {}
445  #define RADIOLIB_VERBOSE_PRINTLN(...) {}
446 #endif
447 
448 /*
449  * Uncomment to enable "paranoid" SPI mode
450  * Every write to an SPI register using SPI set function will be verified by a subsequent read operation.
451  * This improves reliablility, but slightly slows down communication.
452  * Note: Enabled by default.
453  */
454 #define RADIOLIB_SPI_PARANOID
455 
456 /*
457  * Uncomment to enable parameter range checking
458  * RadioLib will check provided parameters (such as frequency) against limits determined by the device manufacturer.
459  * It is highly advised to keep this macro defined, removing it will allow invalid values to be set,
460  * possibly leading to bricked module and/or program crashing.
461  * Note: Enabled by default.
462  */
463 #define RADIOLIB_CHECK_PARAMS
464 
465 /*
466  * Uncomment to enable SX127x errata fix
467  * Warning: SX127x errata fix has been reported to cause issues with LoRa bandwidths lower than 62.5 kHz.
468  * It should only be enabled if you really are observing some errata-related issue.
469  * Note: Disabled by default.
470  */
471 //#define RADIOLIB_FIX_ERRATA_SX127X
472 
473 #if defined(RADIOLIB_FIX_ERRATA_SX127X)
474  #define RADIOLIB_ERRATA_SX127X(...) { errataFix(__VA_ARGS__); }
475 #else
476  #define RADIOLIB_ERRATA_SX127X(...) {}
477 #endif
478 
479 /*
480  * Uncomment to enable god mode - all methods and member variables in all classes will be made public, thus making them accessible from Arduino code.
481  * Warning: Come on, it's called GOD mode - obviously only use this if you know what you're doing.
482  * Failure to heed the above warning may result in bricked module.
483  */
484 //#define RADIOLIB_GODMODE
485 
486 /*
487  * Uncomment to enable low-level hardware access
488  * This will make some hardware methods like SPI get/set accessible from the user sketch - think of it as "god mode lite"
489  * Warning: RadioLib won't stop you from writing invalid stuff into your device, so it's quite easy to brick your module with this.
490  */
491 //#define RADIOLIB_LOW_LEVEL
492 
493 /*
494  * Uncomment to enable pre-defined modules when using RadioShield.
495  */
496 //#define RADIOLIB_RADIOSHIELD
497 
498 /*
499  * Uncomment to enable static-only memory management: no dynamic allocation will be performed.
500  * Warning: Large static arrays will be created in some methods. It is not advised to send large packets in this mode.
501  */
502 //#define RADIOLIB_STATIC_ONLY
503 
504 // set the size of static arrays to use
505 #if !defined(RADIOLIB_STATIC_ARRAY_SIZE)
506 #define RADIOLIB_STATIC_ARRAY_SIZE 256
507 #endif
508 
512 #define RADIOLIB_ASSERT(STATEVAR) { if((STATEVAR) != ERR_NONE) { return(STATEVAR); } }
513 
517 #if defined(RADIOLIB_CHECK_PARAMS)
518 #define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) { if(!(((VAR) >= (MIN)) && ((VAR) <= (MAX)))) { return(ERR); } }
519 #else
520 #define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) {}
521 #endif
522 
523 // version definitions
524 #define RADIOLIB_VERSION_MAJOR (0x04)
525 #define RADIOLIB_VERSION_MINOR (0x06)
526 #define RADIOLIB_VERSION_PATCH (0x00)
527 #define RADIOLIB_VERSION_EXTRA (0x00)
528 
529 #define RADIOLIB_VERSION ((RADIOLIB_VERSION_MAJOR << 24) | (RADIOLIB_VERSION_MINOR << 16) | (RADIOLIB_VERSION_PATCH << 8) | (RADIOLIB_VERSION_EXTRA))
530 
531 #endif