acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

BuildOpt.h (70210B)

      1 #if !defined(_RADIOLIB_BUILD_OPTIONS_H)
      2 #define _RADIOLIB_BUILD_OPTIONS_H
      3 
      4 #if ARDUINO >= 100
      5   // Arduino build
      6   #include "Arduino.h"
      7   #define RADIOLIB_BUILD_ARDUINO
      8 #else
      9   // generic build
     10   #define RADIOLIB_BUILD_GENERIC
     11 #endif
     12 
     13 #if defined(RADIOLIB_BUILD_ARDUINO)
     14 
     15 /*
     16  * Platform-specific configuration.
     17  *
     18  * RADIOLIB_PLATFORM - platform name, used in debugging to quickly check the correct platform is detected.
     19  * RADIOLIB_PIN_TYPE - which type should be used for pin numbers in functions like digitalRead().
     20  * RADIOLIB_PIN_MODE - which type should be used for pin modes in functions like pinMode().
     21  * RADIOLIB_PIN_STATUS - which type should be used for pin values in functions like digitalWrite().
     22  * RADIOLIB_INTERRUPT_STATUS - which type should be used for pin changes in functions like attachInterrupt().
     23  * RADIOLIB_DIGITAL_PIN_TO_INTERRUPT - function/macro to be used to convert digital pin number to interrupt pin number.
     24  * RADIOLIB_NC - alias for unused pin, usually the largest possible value of RADIOLIB_PIN_TYPE.
     25  * RADIOLIB_DEFAULT_SPI - default SPIClass instance to use.
     26  * RADIOLIB_NONVOLATILE - macro to place variable into program storage (usually Flash).
     27  * RADIOLIB_NONVOLATILE_READ_BYTE - function/macro to read variables saved in program storage (usually Flash).
     28  * RADIOLIB_TYPE_ALIAS - construct to create an alias for a type, usually vai the `using` keyword.
     29  * RADIOLIB_TONE_UNSUPPORTED - some platforms do not have tone()/noTone(), which is required for AFSK.
     30  * RADIOLIB_BUILTIN_MODULE - some platforms have a builtin radio module on fixed pins, this macro is used to specify that pinout.
     31  *
     32  * In addition, some platforms may require RadioLib to disable specific drivers (such as ESP8266).
     33  *
     34  * Users may also specify their own configuration by uncommenting the RADIOLIB_CUSTOM_ARDUINO,
     35  * and then specifying all platform parameters in the section below. This will override automatic
     36  * platform detection.
     37  */
     38 
     39 // uncomment to enable custom platform definition
     40 //#define RADIOLIB_CUSTOM_ARDUINO
     41 
     42 #if defined(RADIOLIB_CUSTOM_ARDUINO)
     43   // name for your platform
     44   #define RADIOLIB_PLATFORM                           "Custom"
     45 
     46   // the following parameters must always be defined
     47   #define RADIOLIB_PIN_TYPE                           uint8_t
     48   #define RADIOLIB_PIN_MODE                           uint8_t
     49   #define RADIOLIB_PIN_STATUS                         uint8_t
     50   #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
     51   #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
     52   #define RADIOLIB_NC                                 (0xFF)
     53   #define RADIOLIB_DEFAULT_SPI                        SPI
     54   #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
     55   #define RADIOLIB_NONVOLATILE                        PROGMEM
     56   #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
     57   #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
     58 
     59   // Arduino API callbacks
     60   // the following are signatures of Arduino API functions of the custom platform
     61   // for example, pinMode on Arduino Uno is defined as void pinMode(uint8_t pin, uint8_t mode)
     62   // all of the callbacks below are taken from Arduino Uno
     63   #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint8_t pin, uint8_t mode)
     64   #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint8_t pin, uint8_t value)
     65   #define RADIOLIB_CB_ARGS_DIGITAL_READ               (int, digitalRead, uint8_t pin)
     66   #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t _pin, unsigned int frequency, unsigned long duration)
     67   #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t _pin)
     68   #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint8_t interruptNum, void (*userFunc)(void), int mode)
     69   #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint8_t interruptNum)
     70   #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
     71   #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long ms)
     72   #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int us)
     73   #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
     74   #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
     75   #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, uint8_t pin, uint8_t state, unsigned long timeout)
     76   #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
     77   #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
     78   #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
     79   #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
     80   #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
     81 
     82   // the following must be defined if the Arduino core does not support tone function
     83   //#define RADIOLIB_TONE_UNSUPPORTED
     84 
     85   // some platforms seem to have issues with SPI modules that use a command interface
     86   // this can be mitigated by adding delays into SPI communication
     87   // (see https://github.com/jgromes/RadioLib/issues/158 for details)
     88   //#define RADIOLIB_SPI_SLOWDOWN
     89 
     90   // some of RadioLib drivers may be excluded, to prevent collisions with platforms (or to speed up build process)
     91   // the following is a complete list of all possible exclusion macros, uncomment any of them to disable that driver
     92   // NOTE: Some of the exclusion macros are dependent on each other. For example, it is not possible to exclude RF69
     93   //       while keeping SX1231 (because RF69 is the base class for SX1231). The dependency is always uni-directional,
     94   //       so excluding SX1231 and keeping RF69 is valid.
     95   //#define RADIOLIB_EXCLUDE_CC1101
     96   //#define RADIOLIB_EXCLUDE_NRF24
     97   //#define RADIOLIB_EXCLUDE_RF69
     98   //#define RADIOLIB_EXCLUDE_SX1231     // dependent on RADIOLIB_EXCLUDE_RF69
     99   //#define RADIOLIB_EXCLUDE_SI443X
    100   //#define RADIOLIB_EXCLUDE_RFM2X      // dependent on RADIOLIB_EXCLUDE_SI443X
    101   //#define RADIOLIB_EXCLUDE_SX127X
    102   //#define RADIOLIB_EXCLUDE_RFM9X      // dependent on RADIOLIB_EXCLUDE_SX127X
    103   //#define RADIOLIB_EXCLUDE_SX126X
    104   //#define RADIOLIB_EXCLUDE_SX128X
    105   //#define RADIOLIB_EXCLUDE_AFSK
    106   //#define RADIOLIB_EXCLUDE_AX25
    107   //#define RADIOLIB_EXCLUDE_HELLSCHREIBER
    108   //#define RADIOLIB_EXCLUDE_MORSE
    109   //#define RADIOLIB_EXCLUDE_RTTY
    110   //#define RADIOLIB_EXCLUDE_SSTV
    111   //#define RADIOLIB_EXCLUDE_DIRECT_RECEIVE
    112 
    113 #else
    114   #if defined(__AVR__) && !(defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY) || defined(ARDUINO_ARCH_MEGAAVR))
    115     // Arduino AVR boards (except for megaAVR) - Uno, Mega etc.
    116     #define RADIOLIB_PLATFORM                           "Arduino AVR"
    117     #define RADIOLIB_PIN_TYPE                           uint8_t
    118     #define RADIOLIB_PIN_MODE                           uint8_t
    119     #define RADIOLIB_PIN_STATUS                         uint8_t
    120     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    121     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    122     #define RADIOLIB_NC                                 (0xFF)
    123     #define RADIOLIB_DEFAULT_SPI                        SPI
    124     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    125     #define RADIOLIB_NONVOLATILE                        PROGMEM
    126     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    127     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    128 
    129     // Arduino API callbacks
    130     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint8_t pin, uint8_t mode)
    131     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint8_t pin, uint8_t value)
    132     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (int, digitalRead, uint8_t pin)
    133     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t _pin, unsigned int frequency, unsigned long duration)
    134     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t _pin)
    135     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint8_t interruptNum, void (*userFunc)(void), int mode)
    136     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint8_t interruptNum)
    137     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    138     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long ms)
    139     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int us)
    140     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    141     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    142     #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, uint8_t pin, uint8_t state, unsigned long timeout)
    143     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    144     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    145     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    146     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    147     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    148 
    149   #elif defined(ESP8266)
    150     // ESP8266 boards
    151     #define RADIOLIB_PLATFORM                           "ESP8266"
    152     #define RADIOLIB_PIN_TYPE                           uint8_t
    153     #define RADIOLIB_PIN_MODE                           uint8_t
    154     #define RADIOLIB_PIN_STATUS                         uint8_t
    155     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    156     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    157     #define RADIOLIB_NC                                 (0xFF)
    158     #define RADIOLIB_DEFAULT_SPI                        SPI
    159     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    160     #define RADIOLIB_NONVOLATILE                        PROGMEM
    161     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    162     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    163 
    164     // Arduino API callbacks
    165     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint8_t pin, uint8_t mode)
    166     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint8_t pin, uint8_t value)
    167     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (int, digitalRead, uint8_t pin)
    168     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t _pin, unsigned int frequency, unsigned long duration)
    169     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t _pin)
    170     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint8_t pin, void (*)(void), int mode)
    171     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint8_t interruptNum)
    172     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    173     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long)
    174     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int us)
    175     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    176     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    177     #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, uint8_t pin, uint8_t state, unsigned long timeout)
    178     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    179     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    180     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    181     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    182     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    183 
    184   #elif defined(ESP32)
    185     // ESP32 boards
    186     #define RADIOLIB_PLATFORM                           "ESP32"
    187     #define RADIOLIB_PIN_TYPE                           uint8_t
    188     #define RADIOLIB_PIN_MODE                           uint8_t
    189     #define RADIOLIB_PIN_STATUS                         uint8_t
    190     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    191     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    192     #define RADIOLIB_NC                                 (0xFF)
    193     #define RADIOLIB_DEFAULT_SPI                        SPI
    194     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    195     #define RADIOLIB_NONVOLATILE                        PROGMEM
    196     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    197     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    198 
    199     // ESP32 doesn't support tone(), but it can be emulated via LED control peripheral
    200     #define RADIOLIB_TONE_UNSUPPORTED
    201     #define RADIOLIB_TONE_ESP32_CHANNEL                 (1)
    202 
    203     // Arduino API callbacks
    204     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint8_t pin, uint8_t mode)
    205     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint8_t pin, uint8_t value)
    206     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (int, digitalRead, uint8_t pin)
    207     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, void)
    208     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, void)
    209     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint8_t pin, void (*)(void), int mode)
    210     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint8_t pin)
    211     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    212     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, uint32_t)
    213     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, uint32_t us)
    214     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    215     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    216     #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, uint8_t pin, uint8_t state, unsigned long timeout)
    217     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    218     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    219     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    220     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    221     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    222 
    223   #elif defined(ARDUINO_ARCH_STM32)
    224     // official STM32 Arduino core (https://github.com/stm32duino/Arduino_Core_STM32)
    225     #define RADIOLIB_PLATFORM                           "Arduino STM32 (official)"
    226     #define RADIOLIB_PIN_TYPE                           uint32_t
    227     #define RADIOLIB_PIN_MODE                           uint32_t
    228     #define RADIOLIB_PIN_STATUS                         uint32_t
    229     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    230     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt((PinName)p)
    231     #define RADIOLIB_NC                                 (0xFFFFFFFF)
    232     #define RADIOLIB_DEFAULT_SPI                        SPI
    233     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    234     #define RADIOLIB_NONVOLATILE                        PROGMEM
    235     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    236     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    237 
    238     // slow down SX126x/8x SPI on this platform
    239     #define RADIOLIB_SPI_SLOWDOWN
    240 
    241     // Arduino API callbacks
    242     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint32_t dwPin, uint32_t dwMode)
    243     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint32_t dwPin, uint32_t dwVal)
    244     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (int, digitalRead, uint32_t ulPin)
    245     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t _pin, unsigned int frequency, unsigned long duration)
    246     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t _pin, bool destruct)
    247     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint32_t pin, callback_function_t callback, uint32_t mode)
    248     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint32_t pin)
    249     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    250     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, uint32_t ms)
    251     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, uint32_t us)
    252     #define RADIOLIB_CB_ARGS_MILLIS                     (uint32_t, millis, void)
    253     #define RADIOLIB_CB_ARGS_MICROS                     (uint32_t, micros, void)
    254     #define RADIOLIB_CB_ARGS_PULSE_IN                   (uint32_t, pulseIn, uint32_t pin, uint32_t state, uint32_t timeout)
    255     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    256     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    257     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    258     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    259     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    260 
    261   #elif defined(SAMD_SERIES)
    262     // Adafruit SAMD boards (M0 and M4)
    263     #define RADIOLIB_PLATFORM                           "Adafruit SAMD"
    264     #define RADIOLIB_PIN_TYPE                           uint32_t
    265     #define RADIOLIB_PIN_MODE                           uint32_t
    266     #define RADIOLIB_PIN_STATUS                         uint32_t
    267     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    268     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    269     #define RADIOLIB_NC                                 (0xFFFFFFFF)
    270     #define RADIOLIB_DEFAULT_SPI                        SPI
    271     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    272     #define RADIOLIB_NONVOLATILE                        PROGMEM
    273     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    274     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    275 
    276     // slow down SX126x/8x SPI on this platform
    277     #define RADIOLIB_SPI_SLOWDOWN
    278 
    279     // Arduino API callbacks
    280     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint32_t dwPin, uint32_t dwMode)
    281     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint32_t dwPin, uint32_t dwVal)
    282     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (int, digitalRead, uint32_t ulPin)
    283     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint32_t _pin, uint32_t frequency, uint32_t duration)
    284     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint32_t _pin)
    285     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint32_t pin, voidFuncPtr callback, uint32_t mode)
    286     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint32_t pin)
    287     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    288     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long dwMs)
    289     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int)
    290     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    291     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    292     #define RADIOLIB_CB_ARGS_PULSE_IN                   (uint32_t, pulseIn, uint32_t pin, uint32_t state, uint32_t timeout)
    293     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    294     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    295     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    296     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    297     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    298 
    299   #elif defined(ARDUINO_ARCH_SAMD)
    300     // Arduino SAMD (Zero, MKR, etc.)
    301     #define RADIOLIB_PLATFORM                           "Arduino SAMD"
    302     #define RADIOLIB_PIN_TYPE                           pin_size_t
    303     #define RADIOLIB_PIN_MODE                           PinMode
    304     #define RADIOLIB_PIN_STATUS                         PinStatus
    305     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    306     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    307     #define RADIOLIB_NC                                 (0xFF)
    308     #define RADIOLIB_DEFAULT_SPI                        SPI
    309     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    310     #define RADIOLIB_NONVOLATILE                        PROGMEM
    311     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    312     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    313 
    314     // Arduino API callbacks
    315     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, pin_size_t pinNumber, PinMode pinMode)
    316     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, pin_size_t pinNumber, PinStatus status)
    317     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (PinStatus, digitalRead, pin_size_t pinNumber)
    318     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, unsigned char outputPin, unsigned int frequency, unsigned long duration)
    319     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t outputPin)
    320     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, pin_size_t pin, voidFuncPtr callback, PinStatus mode)
    321     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, pin_size_t pin)
    322     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    323     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long)
    324     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int us)
    325     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    326     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    327     #define RADIOLIB_CB_ARGS_PULSE_IN                   (uint32_t, pulseIn, pin_size_t pin, uint8_t state, uint32_t timeout)
    328     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    329     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    330     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    331     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    332     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    333 
    334   #elif defined(__SAM3X8E__)
    335     // Arduino Due
    336     #define RADIOLIB_PLATFORM                           "Arduino Due"
    337     #define RADIOLIB_PIN_TYPE                           uint32_t
    338     #define RADIOLIB_PIN_MODE                           uint32_t
    339     #define RADIOLIB_PIN_STATUS                         uint32_t
    340     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    341     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    342     #define RADIOLIB_NC                                 (0xFFFFFFFF)
    343     #define RADIOLIB_DEFAULT_SPI                        SPI
    344     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    345     #define RADIOLIB_NONVOLATILE                        PROGMEM
    346     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    347     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    348     #define RADIOLIB_TONE_UNSUPPORTED
    349 
    350     // Arduino API callbacks
    351     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint32_t dwPin, uint32_t dwMode)
    352     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint32_t dwPin, uint32_t dwVal)
    353     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (int, digitalRead, uint32_t ulPin)
    354     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, void)
    355     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, void)
    356     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint32_t pin, void (*callback)(void), uint32_t mode)
    357     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint32_t pin)
    358     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    359     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, uint32_t dwMs)
    360     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, uint32_t usec)
    361     #define RADIOLIB_CB_ARGS_MILLIS                     (uint32_t, millis, void)
    362     #define RADIOLIB_CB_ARGS_MICROS                     (uint32_t, micros, void)
    363     #define RADIOLIB_CB_ARGS_PULSE_IN                   (uint32_t, pulseIn, uint32_t pin, uint32_t state, uint32_t timeout)
    364     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    365     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    366     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    367     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    368     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    369 
    370   #elif (defined(NRF52832_XXAA) || defined(NRF52840_XXAA)) && !defined(ARDUINO_ARDUINO_NANO33BLE)
    371     // Adafruit nRF52 boards
    372     #define RADIOLIB_PLATFORM                           "Adafruit nRF52"
    373     #define RADIOLIB_PIN_TYPE                           uint32_t
    374     #define RADIOLIB_PIN_MODE                           uint32_t
    375     #define RADIOLIB_PIN_STATUS                         uint32_t
    376     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    377     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    378     #define RADIOLIB_NC                                 (0xFFFFFFFF)
    379     #define RADIOLIB_DEFAULT_SPI                        SPI
    380     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    381     #define RADIOLIB_NONVOLATILE                        PROGMEM
    382     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    383     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    384 
    385     // Arduino API callbacks
    386     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint32_t dwPin, uint32_t dwMode)
    387     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint32_t dwPin, uint32_t dwVal)
    388     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (int, digitalRead, uint32_t ulPin)
    389     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t pin, unsigned int frequency, unsigned long duration)
    390     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t pin)
    391     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (int, attachInterrupt, uint32_t pin, voidFuncPtr callback, uint32_t mode)
    392     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint32_t pin)
    393     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    394     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, uint32_t dwMs)
    395     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, uint32_t usec)
    396     #define RADIOLIB_CB_ARGS_MILLIS                     (uint32_t, millis, void)
    397     #define RADIOLIB_CB_ARGS_MICROS                     (uint32_t, micros, void)
    398     #define RADIOLIB_CB_ARGS_PULSE_IN                   (uint32_t, pulseIn, uint32_t pin, uint32_t state, uint32_t timeout)
    399     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    400     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    401     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    402     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    403     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    404 
    405   #elif defined(ARDUINO_ARC32_TOOLS)
    406     // Intel Curie
    407     #define RADIOLIB_PLATFORM                           "Intel Curie"
    408     #define RADIOLIB_PIN_TYPE                           uint8_t
    409     #define RADIOLIB_PIN_MODE                           uint8_t
    410     #define RADIOLIB_PIN_STATUS                         uint8_t
    411     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    412     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    413     #define RADIOLIB_NC                                 (0xFF)
    414     #define RADIOLIB_DEFAULT_SPI                        SPI
    415     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    416     #define RADIOLIB_NONVOLATILE                        PROGMEM
    417     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    418     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    419 
    420     // Arduino API callbacks
    421     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint8_t pin, uint8_t mode)
    422     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint8_t pin, uint8_t val)
    423     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (int, digitalRead, uint8_t pin)
    424     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint32_t _pin, unsigned int frequency, unsigned long duration)
    425     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint32_t _pin)
    426     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint32_t pin, void (*callback)(void), uint32_t mode)
    427     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint32_t pin)
    428     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    429     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, uint32_t dwMs)
    430     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, uint32_t dwUs)
    431     #define RADIOLIB_CB_ARGS_MILLIS                     (uint64_t, millis, void)
    432     #define RADIOLIB_CB_ARGS_MICROS                     (uint64_t, micros, void)
    433     #define RADIOLIB_CB_ARGS_PULSE_IN                   (uint32_t, pulseIn, uint32_t pin, uint32_t state, uint32_t timeout)
    434     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    435     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    436     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    437     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    438     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    439 
    440   #elif defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY)
    441     // Arduino megaAVR boards - Uno Wifi Rev.2, Nano Every
    442     #define RADIOLIB_PLATFORM                           "Arduino megaAVR"
    443     #define RADIOLIB_PIN_TYPE                           uint8_t
    444     #define RADIOLIB_PIN_MODE                           PinMode
    445     #define RADIOLIB_PIN_STATUS                         PinStatus
    446     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    447     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    448     #define RADIOLIB_NC                                 (0xFF)
    449     #define RADIOLIB_DEFAULT_SPI                        SPI
    450     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    451     #define RADIOLIB_NONVOLATILE                        PROGMEM
    452     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    453     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    454 
    455     // Arduino API callbacks
    456     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint8_t pin, PinMode mode)
    457     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint8_t pin, PinStatus val)
    458     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (PinStatus, digitalRead, uint8_t pin)
    459     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t pin, unsigned int frequency, unsigned long duration)
    460     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t pin)
    461     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint8_t pin, void (*userFunc)(void), PinStatus mode)
    462     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint8_t pin)
    463     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    464     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long ms)
    465     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int us)
    466     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    467     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    468     #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, uint8_t pin, uint8_t state, unsigned long timeout)
    469     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    470     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    471     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    472     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    473     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    474 
    475   #elif defined(ARDUINO_ARCH_APOLLO3)
    476     // Sparkfun Apollo3 boards
    477     #define RADIOLIB_PLATFORM                           "Sparkfun Apollo3"
    478     #define RADIOLIB_PIN_TYPE                           pin_size_t
    479     #define RADIOLIB_PIN_MODE                           Arduino_PinMode
    480     #define RADIOLIB_PIN_STATUS                         PinStatus
    481     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    482     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    483     #define RADIOLIB_NC                                 (0xFF)
    484     #define RADIOLIB_DEFAULT_SPI                        SPI
    485     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    486     #define RADIOLIB_NONVOLATILE                        PROGMEM
    487     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    488     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    489 
    490     // slow down SX126x/8x SPI on this platform
    491     #define RADIOLIB_SPI_SLOWDOWN
    492 
    493     // Arduino API callbacks
    494     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, pin_size_t pinName, Arduino_PinMode pinMode)
    495     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, pin_size_t pinName, PinStatus val)
    496     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (PinStatus, digitalRead, pin_size_t pinName)
    497     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t _pin, unsigned int frequency, unsigned long duration)
    498     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t _pin)
    499     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, pin_size_t interruptNumber, voidFuncPtr callback, PinStatus mode)
    500     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, pin_size_t interruptNumber)
    501     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    502     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long ms)
    503     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int us)
    504     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    505     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    506     #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, pin_size_t pin, uint8_t state, unsigned long timeout)
    507     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    508     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    509     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    510     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    511     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    512 
    513   #elif defined(ARDUINO_ARDUINO_NANO33BLE)
    514     // Arduino Nano 33 BLE
    515     #define RADIOLIB_PLATFORM                           "Arduino Nano 33 BLE"
    516     #define RADIOLIB_PIN_TYPE                           pin_size_t
    517     #define RADIOLIB_PIN_MODE                           PinMode
    518     #define RADIOLIB_PIN_STATUS                         PinStatus
    519     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    520     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    521     #define RADIOLIB_NC                                 (0xFF)
    522     #define RADIOLIB_DEFAULT_SPI                        SPI
    523     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    524     #define RADIOLIB_NONVOLATILE                        PROGMEM
    525     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    526     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    527 
    528     // Arduino mbed OS boards have a really bad tone implementation which will crash after a couple seconds
    529     #define RADIOLIB_TONE_UNSUPPORTED
    530     #define RADIOLIB_MBED_TONE_OVERRIDE
    531 
    532     // Arduino API callbacks
    533     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, pin_size_t pin, PinMode mode)
    534     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, pin_size_t pin, PinStatus val)
    535     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (PinStatus, digitalRead, pin_size_t pin)
    536     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t pin, unsigned int frequency, unsigned long duration)
    537     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t pin)
    538     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, pin_size_t interruptNum, voidFuncPtr func, PinStatus mode)
    539     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, pin_size_t interruptNum)
    540     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    541     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long ms)
    542     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int us)
    543     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    544     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    545     #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, pin_size_t pin, PinStatus state, unsigned long timeout)
    546     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    547     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    548     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    549     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    550     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    551 
    552   #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
    553     // Arduino Portenta H7
    554     #define RADIOLIB_PLATFORM                           "Portenta H7"
    555     #define RADIOLIB_PIN_TYPE                           pin_size_t
    556     #define RADIOLIB_PIN_MODE                           PinMode
    557     #define RADIOLIB_PIN_STATUS                         PinStatus
    558     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    559     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    560     #define RADIOLIB_NC                                 (0xFF)
    561     #define RADIOLIB_DEFAULT_SPI                        SPI
    562     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    563     #define RADIOLIB_NONVOLATILE                        PROGMEM
    564     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    565     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    566 
    567     // Arduino mbed OS boards have a really bad tone implementation which will crash after a couple seconds
    568     #define RADIOLIB_TONE_UNSUPPORTED
    569     #define RADIOLIB_MBED_TONE_OVERRIDE
    570 
    571     // Arduino API callbacks
    572     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, pin_size_t pin, PinMode mode)
    573     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, pin_size_t pin, PinStatus val)
    574     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (PinStatus, digitalRead, pin_size_t pin)
    575     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t pin, unsigned int frequency, unsigned long duration)
    576     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t pin)
    577     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, pin_size_t interruptNum, voidFuncPtr func, PinStatus mode)
    578     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, pin_size_t interruptNum)
    579     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    580     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long ms)
    581     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int us)
    582     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    583     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    584     #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, pin_size_t pin, PinStatus state, unsigned long timeout)
    585     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    586     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    587     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    588     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    589     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    590 
    591   #elif defined(__STM32F4__) || defined(__STM32F1__)
    592     // Arduino STM32 core by Roger Clark (https://github.com/rogerclarkmelbourne/Arduino_STM32)
    593     #define RADIOLIB_PLATFORM                           "STM32duino (unofficial)"
    594     #define RADIOLIB_PIN_TYPE                           uint8_t
    595     #define RADIOLIB_PIN_MODE                           WiringPinMode
    596     #define RADIOLIB_PIN_STATUS                         uint8_t
    597     #define RADIOLIB_INTERRUPT_STATUS                   ExtIntTriggerMode
    598     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    599     #define RADIOLIB_NC                                 (0xFF)
    600     #define RADIOLIB_DEFAULT_SPI                        SPI
    601     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    602     #define RADIOLIB_NONVOLATILE                        PROGMEM
    603     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    604     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    605 
    606     // Arduino API callbacks
    607     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint8 pin, WiringPinMode mode)
    608     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint8 pin, uint8 val)
    609     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (uint32_t, digitalRead, uint8 pin)
    610     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint32_t _pin, uint32_t frequency, uint32_t duration)
    611     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint32_t _pin)
    612     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint8 pin, voidFuncPtr handler, ExtIntTriggerMode mode)
    613     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint8 pin)
    614     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    615     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long ms)
    616     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, uint32 us)
    617     #define RADIOLIB_CB_ARGS_MILLIS                     (uint32_t, millis, void)
    618     #define RADIOLIB_CB_ARGS_MICROS                     (uint32_t, micros, void)
    619     #define RADIOLIB_CB_ARGS_PULSE_IN                   (uint32_t, pulseIn, uint32_t ulPin, uint32_t ulState, uint32_t ulTimeout)
    620     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    621     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    622     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    623     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    624     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    625 
    626   #elif defined(ARDUINO_ARCH_MEGAAVR)
    627     // MegaCoreX by MCUdude (https://github.com/MCUdude/MegaCoreX)
    628     #define RADIOLIB_PLATFORM                           "MegaCoreX"
    629     #define RADIOLIB_PIN_TYPE                           uint8_t
    630     #define RADIOLIB_PIN_MODE                           uint8_t
    631     #define RADIOLIB_PIN_STATUS                         uint8_t
    632     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    633     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    634     #define RADIOLIB_NC                                 (0xFF)
    635     #define RADIOLIB_DEFAULT_SPI                        SPI
    636     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    637     #define RADIOLIB_NONVOLATILE                        PROGMEM
    638     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    639     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    640 
    641     // Arduino API callbacks
    642     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint8_t pin, uint8_t mode)
    643     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint8_t pin, uint8_t value)
    644     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (uint8_t, digitalRead, uint8_t pin)
    645     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t _pin, unsigned int frequency, unsigned long duration)
    646     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t _pin)
    647     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint8_t pin, void (*userFunc)(void), uint8_t mode)
    648     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint8_t interruptNum)
    649     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    650     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long ms)
    651     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int us)
    652     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    653     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    654     #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, uint8_t pin, uint8_t state, unsigned long timeout)
    655     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    656     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    657     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    658     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    659     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    660 
    661   #elif defined(ARDUINO_ARCH_RP2040)
    662     // Raspberry Pi Pico
    663     #define RADIOLIB_PLATFORM                           "Raspberry Pi Pico"
    664     #define RADIOLIB_PIN_TYPE                           pin_size_t
    665     #define RADIOLIB_PIN_MODE                           PinMode
    666     #define RADIOLIB_PIN_STATUS                         PinStatus
    667     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    668     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    669     #define RADIOLIB_NC                                 (0xFF)
    670     #define RADIOLIB_DEFAULT_SPI                        SPI
    671     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    672     #define RADIOLIB_NONVOLATILE                        PROGMEM
    673     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    674     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    675 
    676     // Arduino mbed OS boards have a really bad tone implementation which will crash after a couple seconds
    677     #define RADIOLIB_TONE_UNSUPPORTED
    678     #define RADIOLIB_MBED_TONE_OVERRIDE
    679 
    680     // Arduino API callbacks
    681     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, pin_size_t pin, PinMode mode)
    682     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, pin_size_t pin, PinStatus val)
    683     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (PinStatus, digitalRead, pin_size_t pin)
    684     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t pin, unsigned int frequency, unsigned long duration)
    685     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t pin)
    686     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, pin_size_t interruptNum, voidFuncPtr func, PinStatus mode)
    687     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, pin_size_t interruptNum)
    688     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    689     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long ms)
    690     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int us)
    691     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    692     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    693     #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, pin_size_t pin, PinStatus state, unsigned long timeout)
    694     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    695     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    696     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    697     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    698     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    699 
    700   #elif defined(__ASR6501__) || defined(ARDUINO_ARCH_ASR650X) || defined(DARDUINO_ARCH_ASR6601)
    701     // CubeCell
    702     #define RADIOLIB_PLATFORM                           "CubeCell"
    703     #define RADIOLIB_PIN_TYPE                           uint8_t
    704     #define RADIOLIB_PIN_MODE                           PINMODE
    705     #define RADIOLIB_PIN_STATUS                         uint8_t
    706     #define RADIOLIB_INTERRUPT_STATUS                   IrqModes
    707     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    708     #define RADIOLIB_NC                                 (0xFF)
    709     #define RADIOLIB_DEFAULT_SPI                        SPI
    710     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    711     #define RADIOLIB_NONVOLATILE                        PROGMEM
    712     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    713 
    714     // Arduino API callbacks
    715     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint8_t pin, PINMODE mode)
    716     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint8_t pin_name, uint8_t level)
    717     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (uint8_t, digitalRead, uint8_t pin_name)
    718     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, void)
    719     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, void)
    720     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint8_t pin_name, GpioIrqHandler GpioIrqHandlerCallback, IrqModes interrupt_mode)
    721     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint8_t pin_name)
    722     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    723     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, uint32_t milliseconds)
    724     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, uint16 microseconds)
    725     #define RADIOLIB_CB_ARGS_MILLIS                     (uint32_t, millis, void)
    726     #define RADIOLIB_CB_ARGS_MICROS                     (uint32_t, micros, void)
    727     #define RADIOLIB_CB_ARGS_PULSE_IN                   (uint32_t, pulseIn, uint8_t pin_name, uint8_t mode, uint32_t timeout)
    728     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    729     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    730     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    731     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    732     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    733 
    734     // provide an easy access to the on-board module
    735     #include "board-config.h"
    736     #define RADIOLIB_BUILTIN_MODULE                      RADIO_NSS, RADIO_DIO_1, RADIO_RESET, RADIO_BUSY
    737 
    738     // CubeCell doesn't seem to define nullptr, let's do something like that now
    739     #define nullptr                                     NULL
    740 
    741     // ... and also defines pinMode() as a macro, which is by far the stupidest thing I have seen on Arduino
    742     #undef pinMode
    743 
    744     // ... and uses an outdated GCC which does not support type aliases
    745     #define RADIOLIB_TYPE_ALIAS(type, alias)            typedef class type alias;
    746 
    747     // ... and it also has no tone(). This platform was designed by an idiot.
    748     #define RADIOLIB_TONE_UNSUPPORTED
    749 
    750     // ... AND as the (hopefully) final nail in the coffin, IT F*CKING DEFINES YIELD() AS A MACRO THAT DOES NOTHING!!!
    751     #define RADIOLIB_YIELD_UNSUPPORTED
    752     #if defined(yield)
    753     #undef yield
    754     #endif
    755 
    756   #elif defined(RASPI)
    757     // RaspiDuino framework (https://github.com/me-no-dev/RasPiArduino)
    758     #define RADIOLIB_PLATFORM                           "RasPiArduino"
    759     #define RADIOLIB_PIN_TYPE                           uint8_t
    760     #define RADIOLIB_PIN_MODE                           uint8_t
    761     #define RADIOLIB_PIN_STATUS                         uint8_t
    762     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    763     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    764     #define RADIOLIB_NC                                 (0xFF)
    765     #define RADIOLIB_DEFAULT_SPI                        SPI
    766     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    767     #define RADIOLIB_NONVOLATILE                        PROGMEM
    768     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    769     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    770 
    771     // Arduino API callbacks
    772     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint8_t pin, uint8_t mode)
    773     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint8_t pin, uint8_t value)
    774     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (int, digitalRead, uint8_t pin)
    775     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t _pin, unsigned int frequency, unsigned long duration)
    776     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t _pin)
    777     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint8_t interruptNum, void (*userFunc)(void), int mode)
    778     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint8_t interruptNum)
    779     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    780     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, uint32_t ms)
    781     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int us)
    782     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    783     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    784     #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, uint8_t pin, uint8_t state, unsigned long timeout)
    785     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    786     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    787     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    788     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    789     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    790 
    791     // let's start off easy - no tone on this platform, that can happen
    792     #define RADIOLIB_TONE_UNSUPPORTED
    793 
    794     // hmm, no yield either - weird on something like Raspberry PI, but sure, we can handle it
    795     #define RADIOLIB_YIELD_UNSUPPORTED
    796 
    797     // aight, getting to the juicy stuff - PGM_P seems missing, that's the first time
    798     #define PGM_P                                       const char *
    799 
    800     // ... and for the grand finale, we have millis() and micros() DEFINED AS MACROS!
    801     #if defined(millis)
    802     #undef millis
    803     inline unsigned long millis() { return((unsigned long)(STCV / 1000)); };
    804     #endif
    805 
    806     #if defined(micros)
    807     #undef micros
    808     inline unsigned long micros() { return((unsigned long)(STCV)); };
    809     #endif
    810 
    811   #elif defined(TEENSYDUINO)
    812     // Teensy
    813     #define RADIOLIB_PLATFORM                           "Teensy"
    814     #define RADIOLIB_PIN_TYPE                           uint8_t
    815     #define RADIOLIB_PIN_MODE                           uint8_t
    816     #define RADIOLIB_PIN_STATUS                         uint8_t
    817     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    818     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    819     #define RADIOLIB_NC                                 (0xFF)
    820     #define RADIOLIB_DEFAULT_SPI                        SPI
    821     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    822     #define RADIOLIB_NONVOLATILE                        PROGMEM
    823     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    824     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    825 
    826     // Arduino API callbacks
    827     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint8_t pin, uint8_t mode)
    828     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint8_t pin, uint8_t value)
    829     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (uint8_t, digitalRead, uint8_t pin)
    830     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t _pin, short unsigned int frequency, long unsigned int duration)
    831     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t _pin)
    832     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint8_t interruptNum, void (*userFunc)(void), int mode)
    833     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint8_t interruptNum)
    834     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    835     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long ms)
    836     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, long unsigned int us)
    837     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    838     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    839     #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, uint8_t pin, uint8_t state, unsigned long timeout)
    840     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    841     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    842     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    843     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    844     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    845 
    846   #else
    847     // other Arduino platforms not covered by the above list - this may or may not work
    848     #define RADIOLIB_PLATFORM                           "Unknown Arduino"
    849     #define RADIOLIB_UNKNOWN_PLATFORM
    850     #define RADIOLIB_PIN_TYPE                           uint8_t
    851     #define RADIOLIB_PIN_MODE                           uint8_t
    852     #define RADIOLIB_PIN_STATUS                         uint8_t
    853     #define RADIOLIB_INTERRUPT_STATUS                   RADIOLIB_PIN_STATUS
    854     #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p)        digitalPinToInterrupt(p)
    855     #define RADIOLIB_NC                                 (0xFF)
    856     #define RADIOLIB_DEFAULT_SPI                        SPI
    857     #define RADIOLIB_DEFAULT_SPI_SETTINGS               SPISettings(2000000, MSBFIRST, SPI_MODE0)
    858     #define RADIOLIB_NONVOLATILE                        PROGMEM
    859     #define RADIOLIB_NONVOLATILE_READ_BYTE(addr)        pgm_read_byte(addr)
    860     #define RADIOLIB_TYPE_ALIAS(type, alias)            using alias = type;
    861 
    862     // Arduino API callbacks
    863     #define RADIOLIB_CB_ARGS_PIN_MODE                   (void, pinMode, uint8_t pin, uint8_t mode)
    864     #define RADIOLIB_CB_ARGS_DIGITAL_WRITE              (void, digitalWrite, uint8_t pin, uint8_t value)
    865     #define RADIOLIB_CB_ARGS_DIGITAL_READ               (int, digitalRead, uint8_t pin)
    866     #define RADIOLIB_CB_ARGS_TONE                       (void, tone, uint8_t _pin, unsigned int frequency, unsigned long duration)
    867     #define RADIOLIB_CB_ARGS_NO_TONE                    (void, noTone, uint8_t _pin)
    868     #define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT           (void, attachInterrupt, uint8_t interruptNum, void (*userFunc)(void), int mode)
    869     #define RADIOLIB_CB_ARGS_DETACH_INTERRUPT           (void, detachInterrupt, uint8_t interruptNum)
    870     #define RADIOLIB_CB_ARGS_YIELD                      (void, yield, void)
    871     #define RADIOLIB_CB_ARGS_DELAY                      (void, delay, unsigned long ms)
    872     #define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS         (void, delayMicroseconds, unsigned int us)
    873     #define RADIOLIB_CB_ARGS_MILLIS                     (unsigned long, millis, void)
    874     #define RADIOLIB_CB_ARGS_MICROS                     (unsigned long, micros, void)
    875     #define RADIOLIB_CB_ARGS_PULSE_IN                   (unsigned long, pulseIn, uint8_t pin, uint8_t state, unsigned long timeout)
    876     #define RADIOLIB_CB_ARGS_SPI_BEGIN                  (void, SPIbegin, void)
    877     #define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION      (void, SPIbeginTransaction, void)
    878     #define RADIOLIB_CB_ARGS_SPI_TRANSFER               (uint8_t, SPItransfer, uint8_t b)
    879     #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
    880     #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
    881 
    882   #endif
    883 #endif
    884 
    885 #else
    886   // generic non-Arduino platform
    887   #define RADIOLIB_PLATFORM                           "Generic"
    888 
    889   // platform properties may be defined here, or somewhere else in the build system
    890   #include "noarduino.h"
    891 
    892 #endif
    893 
    894 /*
    895  * Uncomment to enable debug output.
    896  * Warning: Debug output will slow down the whole system significantly.
    897  *          Also, it will result in larger compiled binary.
    898  * Levels: debug - only main info
    899  *         verbose - full transcript of all SPI communication
    900  */
    901 #if !defined(RADIOLIB_DEBUG)
    902   //#define RADIOLIB_DEBUG
    903 #endif
    904 #if !defined(RADIOLIB_VERBOSE)
    905   //#define RADIOLIB_VERBOSE
    906 #endif
    907 
    908 // set which output port should be used for debug output
    909 // may be Serial port (on Arduino) or file like stdout or stderr (on generic platforms)
    910 #if !defined(RADIOLIB_DEBUG_PORT)
    911   #define RADIOLIB_DEBUG_PORT   Serial
    912 #endif
    913 
    914 /*
    915  * Uncomment to enable "paranoid" SPI mode
    916  * Every write to an SPI register using SPI set function will be verified by a subsequent read operation.
    917  * This improves reliablility, but slightly slows down communication.
    918  * Note: Enabled by default.
    919  */
    920 #if !defined(RADIOLIB_SPI_PARANOID)
    921   #define RADIOLIB_SPI_PARANOID
    922 #endif
    923 
    924 /*
    925  * Uncomment to enable parameter range checking
    926  * RadioLib will check provided parameters (such as frequency) against limits determined by the device manufacturer.
    927  * It is highly advised to keep this macro defined, removing it will allow invalid values to be set,
    928  * possibly leading to bricked module and/or program crashing.
    929  * Note: Enabled by default.
    930  */
    931 #if !defined(RADIOLIB_CHECK_PARAMS)
    932   #define RADIOLIB_CHECK_PARAMS
    933 #endif
    934 
    935 /*
    936  * Uncomment to enable SX127x errata fix
    937  * Warning: SX127x errata fix has been reported to cause issues with LoRa bandwidths lower than 62.5 kHz.
    938  *          It should only be enabled if you really are observing some errata-related issue.
    939  * Note: Disabled by default.
    940  */
    941 #if !defined(RADIOLIB_FIX_ERRATA_SX127X)
    942   //#define RADIOLIB_FIX_ERRATA_SX127X
    943 #endif
    944 
    945 /*
    946  * Uncomment to enable god mode - all methods and member variables in all classes will be made public, thus making them accessible from Arduino code.
    947  * Warning: Come on, it's called GOD mode - obviously only use this if you know what you're doing.
    948  *          Failure to heed the above warning may result in bricked module.
    949  */
    950 #if !defined(RADIOLIB_GODMODE)
    951   //#define RADIOLIB_GODMODE
    952 #endif
    953 
    954 /*
    955  * Uncomment to enable low-level hardware access
    956  * This will make some hardware methods like SPI get/set accessible from the user sketch - think of it as "god mode lite"
    957  * Warning: RadioLib won't stop you from writing invalid stuff into your device, so it's quite easy to brick your module with this.
    958  */
    959 #if !defined(RADIOLIB_LOW_LEVEL)
    960   //#define RADIOLIB_LOW_LEVEL
    961 #endif
    962 
    963 /*
    964  * Uncomment to enable pre-defined modules when using RadioShield.
    965  */
    966 #if !defined(RADIOLIB_RADIOSHIELD)
    967   //#define RADIOLIB_RADIOSHIELD
    968 #endif
    969 
    970 /*
    971  * Uncomment to enable static-only memory management: no dynamic allocation will be performed.
    972  * Warning: Large static arrays will be created in some methods. It is not advised to send large packets in this mode.
    973  */
    974 #if !defined(RADIOLIB_STATIC_ONLY)
    975   //#define RADIOLIB_STATIC_ONLY
    976 #endif
    977 
    978 // set the size of static arrays to use
    979 #if !defined(RADIOLIB_STATIC_ARRAY_SIZE)
    980   #define RADIOLIB_STATIC_ARRAY_SIZE   (256)
    981 #endif
    982 
    983 #if defined(RADIOLIB_DEBUG)
    984   #if defined(RADIOLIB_BUILD_ARDUINO)
    985     #define RADIOLIB_DEBUG_PRINT(...) { RADIOLIB_DEBUG_PORT.print(__VA_ARGS__); }
    986     #define RADIOLIB_DEBUG_PRINTLN(...) { RADIOLIB_DEBUG_PORT.println(__VA_ARGS__); }
    987   #else
    988     #if !defined(RADIOLIB_DEBUG_PRINT)
    989       #define RADIOLIB_DEBUG_PRINT(...) { frintf(RADIOLIB_DEBUG_PORT, __VA_ARGS__); }
    990     #endif
    991     #if !defined(RADIOLIB_DEBUG_PRINTLN)
    992       #define RADIOLIB_DEBUG_PRINTLN(...)  { printf(RADIOLIB_DEBUG_PORT, __VA_ARGS__ "\n"); }
    993     #endif
    994   #endif
    995 #else
    996   #define RADIOLIB_DEBUG_PRINT(...) {}
    997   #define RADIOLIB_DEBUG_PRINTLN(...) {}
    998 #endif
    999 
   1000 #if defined(RADIOLIB_VERBOSE)
   1001   #define RADIOLIB_VERBOSE_PRINT(...) RADIOLIB_DEBUG_PRINT(__VA_ARGS__)
   1002   #define RADIOLIB_VERBOSE_PRINTLN(...) RADIOLIB_DEBUG_PRINTLN(__VA_ARGS__)
   1003 #else
   1004   #define RADIOLIB_VERBOSE_PRINT(...) {}
   1005   #define RADIOLIB_VERBOSE_PRINTLN(...) {}
   1006 #endif
   1007 
   1008 /*!
   1009   \brief A simple assert macro, will return on error.
   1010 */
   1011 #define RADIOLIB_ASSERT(STATEVAR) { if((STATEVAR) != RADIOLIB_ERR_NONE) { return(STATEVAR); } }
   1012 
   1013 /*
   1014  * Macros that create callback for the hardware abstraction layer.
   1015  *
   1016  * This is the most evil thing I have ever created. I am deeply sorry to anyone currently reading this text.
   1017  * Come one, come all and witness the horror:
   1018  * Variadics, forced expansions, inlined function, string concatenation, and it even messes up access specifiers.
   1019  */
   1020 #define RADIOLIB_FIRST(arg, ...) arg
   1021 #define RADIOLIB_REST(arg, ...) __VA_ARGS__
   1022 #define RADIOLIB_EXP(...) __VA_ARGS__
   1023 
   1024 #define RADIOLIB_GENERATE_CALLBACK_RET_FUNC(RET, FUNC, ...) public: typedef RET (*FUNC##_cb_t)(__VA_ARGS__); void setCb_##FUNC(FUNC##_cb_t cb) { cb_##FUNC = cb; }; private: FUNC##_cb_t cb_##FUNC = nullptr;
   1025 #define RADIOLIB_GENERATE_CALLBACK_RET(RET, ...) RADIOLIB_GENERATE_CALLBACK_RET_FUNC(RET, __VA_ARGS__)
   1026 #define RADIOLIB_GENERATE_CALLBACK(CB) RADIOLIB_GENERATE_CALLBACK_RET(RADIOLIB_EXP(RADIOLIB_FIRST CB), RADIOLIB_EXP(RADIOLIB_REST CB))
   1027 
   1028 #define RADIOLIB_GENERATE_CALLBACK_SPI_RET_FUNC(RET, FUNC, ...) public: typedef RET (Module::*FUNC##_cb_t)(__VA_ARGS__); void setCb_##FUNC(FUNC##_cb_t cb) { cb_##FUNC = cb; }; private: FUNC##_cb_t cb_##FUNC = nullptr;
   1029 #define RADIOLIB_GENERATE_CALLBACK_SPI_RET(RET, ...) RADIOLIB_GENERATE_CALLBACK_SPI_RET_FUNC(RET, __VA_ARGS__)
   1030 #define RADIOLIB_GENERATE_CALLBACK_SPI(CB) RADIOLIB_GENERATE_CALLBACK_SPI_RET(RADIOLIB_EXP(RADIOLIB_FIRST CB), RADIOLIB_EXP(RADIOLIB_REST CB))
   1031 
   1032 /*!
   1033   \brief Macro to check variable is within constraints - this is commonly used to check parameter ranges. Requires RADIOLIB_CHECK_RANGE to be enabled
   1034 */
   1035 #if defined(RADIOLIB_CHECK_PARAMS)
   1036   #define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) { if(!(((VAR) >= (MIN)) && ((VAR) <= (MAX)))) { return(ERR); } }
   1037 #else
   1038   #define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) {}
   1039 #endif
   1040 
   1041 #if defined(RADIOLIB_FIX_ERRATA_SX127X)
   1042   #define RADIOLIB_ERRATA_SX127X(...) { errataFix(__VA_ARGS__); }
   1043 #else
   1044   #define RADIOLIB_ERRATA_SX127X(...) {}
   1045 #endif
   1046 
   1047 // version definitions
   1048 #define RADIOLIB_VERSION_MAJOR  (0x05)
   1049 #define RADIOLIB_VERSION_MINOR  (0x03)
   1050 #define RADIOLIB_VERSION_PATCH  (0x00)
   1051 #define RADIOLIB_VERSION_EXTRA  (0x00)
   1052 
   1053 #define RADIOLIB_VERSION ((RADIOLIB_VERSION_MAJOR << 24) | (RADIOLIB_VERSION_MINOR << 16) | (RADIOLIB_VERSION_PATCH << 8) | (RADIOLIB_VERSION_EXTRA))
   1054 
   1055 #endif