Added support for Raspberry PI (#432)
This commit is contained in:
parent
b01413db4a
commit
4567044deb
2 changed files with 55 additions and 0 deletions
|
@ -69,6 +69,7 @@ SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x
|
|||
|
||||
* __Raspberry Pi__
|
||||
* [__RP2040__](https://github.com/arduino/ArduinoCore-mbed) - Raspberry Pi Pico and Arduino Nano RP2040 Connect
|
||||
* [__Raspberry Pi__](https://github.com/me-no-dev/RasPiArduino) - Arduino framework for RaspberryPI
|
||||
|
||||
* __Heltec__
|
||||
* [__CubeCell__](https://github.com/HelTecAutomation/CubeCell-Arduino) - ASR650X series (CubeCell-Board, CubeCell-Capsule, CubeCell-Module etc.)
|
||||
|
|
|
@ -734,6 +734,60 @@
|
|||
#undef yield
|
||||
#endif
|
||||
|
||||
#elif defined(RASPI)
|
||||
// RaspiDuino framework (https://github.com/me-no-dev/RasPiArduino)
|
||||
#define RADIOLIB_PLATFORM "RasPiArduino"
|
||||
#define RADIOLIB_PIN_TYPE uint8_t
|
||||
#define RADIOLIB_PIN_MODE uint8_t
|
||||
#define RADIOLIB_PIN_STATUS uint8_t
|
||||
#define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
|
||||
#define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
|
||||
#define RADIOLIB_NC (0xFF)
|
||||
#define RADIOLIB_DEFAULT_SPI SPI
|
||||
#define RADIOLIB_DEFAULT_SPI_SETTINGS SPISettings(2000000, MSBFIRST, SPI_MODE0)
|
||||
#define RADIOLIB_NONVOLATILE PROGMEM
|
||||
#define RADIOLIB_NONVOLATILE_READ_BYTE(addr) pgm_read_byte(addr)
|
||||
#define RADIOLIB_TYPE_ALIAS(type, alias) using alias = type;
|
||||
|
||||
// Arduino API callbacks
|
||||
#define RADIOLIB_CB_ARGS_PIN_MODE (void, pinMode, uint8_t pin, uint8_t mode)
|
||||
#define RADIOLIB_CB_ARGS_DIGITAL_WRITE (void, digitalWrite, uint8_t pin, uint8_t value)
|
||||
#define RADIOLIB_CB_ARGS_DIGITAL_READ (int, digitalRead, uint8_t pin)
|
||||
#define RADIOLIB_CB_ARGS_TONE (void, tone, uint8_t _pin, unsigned int frequency, unsigned long duration)
|
||||
#define RADIOLIB_CB_ARGS_NO_TONE (void, noTone, uint8_t _pin)
|
||||
#define RADIOLIB_CB_ARGS_ATTACH_INTERRUPT (void, attachInterrupt, uint8_t interruptNum, void (*userFunc)(void), int mode)
|
||||
#define RADIOLIB_CB_ARGS_DETACH_INTERRUPT (void, detachInterrupt, uint8_t interruptNum)
|
||||
#define RADIOLIB_CB_ARGS_YIELD (void, yield, void)
|
||||
#define RADIOLIB_CB_ARGS_DELAY (void, delay, uint32_t ms)
|
||||
#define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS (void, delayMicroseconds, unsigned int us)
|
||||
#define RADIOLIB_CB_ARGS_MILLIS (unsigned long, millis, void)
|
||||
#define RADIOLIB_CB_ARGS_MICROS (unsigned long, micros, void)
|
||||
#define RADIOLIB_CB_ARGS_SPI_BEGIN (void, SPIbegin, void)
|
||||
#define RADIOLIB_CB_ARGS_SPI_BEGIN_TRANSACTION (void, SPIbeginTransaction, void)
|
||||
#define RADIOLIB_CB_ARGS_SPI_TRANSFER (uint8_t, SPItransfer, uint8_t b)
|
||||
#define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION (void, SPIendTransaction, void)
|
||||
#define RADIOLIB_CB_ARGS_SPI_END (void, SPIend, void)
|
||||
|
||||
// let's start off easy - no tone on this platform, that can happen
|
||||
#define RADIOLIB_TONE_UNSUPPORTED
|
||||
|
||||
// hmm, no yield either - weird on something like Raspberry PI, but sure, we can handle it
|
||||
#define RADIOLIB_YIELD_UNSUPPORTED
|
||||
|
||||
// aight, getting to the juicy stuff - PGM_P seems missing, that's the first time
|
||||
#define PGM_P const char *
|
||||
|
||||
// ... and for the grand finale, we have millis() and micros() DEFINED AS MACROS!
|
||||
#if defined(millis)
|
||||
#undef millis
|
||||
inline unsigned long millis() { return((unsigned long)(STCV / 1000)); };
|
||||
#endif
|
||||
|
||||
#if defined(micros)
|
||||
#undef micros
|
||||
inline unsigned long micros() { return((unsigned long)(STCV)); };
|
||||
#endif
|
||||
|
||||
#else
|
||||
// other Arduino platforms not covered by the above list - this may or may not work
|
||||
#define RADIOLIB_PLATFORM "Unknown Arduino"
|
||||
|
|
Loading…
Add table
Reference in a new issue