From 8b0858850cef7e0771e8f8febf2673eaa1c1fa13 Mon Sep 17 00:00:00 2001 From: jgromes Date: Fri, 24 Sep 2021 08:04:35 +0200 Subject: [PATCH] Added support for RP2040 (#361) --- README.md | 3 +++ src/BuildOpt.h | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/README.md b/README.md index 1d61a503..5f15e081 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,9 @@ SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x * __MCUdude__ * [__MegaCoreX__](https://github.com/MCUdude/MegaCoreX) - megaAVR-0 series (ATmega4809, ATmega3209 etc.) +* __Raspberry Pi__ + * [__RP2040__](https://github.com/arduino/ArduinoCore-mbed) - Raspberry Pi Pico and Arduino Nano RP2040 Connect + The list above is by no means exhaustive. Most of RadioLib code is independent of the used platform, so as long as your board is running some Arduino-compatible core, RadioLib should work. Compilation of all examples is tested for all platforms prior to releasing new version. ### In development: diff --git a/src/BuildOpt.h b/src/BuildOpt.h index 00f12f09..05d8d4cb 100644 --- a/src/BuildOpt.h +++ b/src/BuildOpt.h @@ -330,6 +330,22 @@ #define RADIOLIB_PROGMEM PROGMEM #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr) + #elif defined(ARDUINO_ARCH_RP2040) + // Raspberry Pi Pico + #define RADIOLIB_PLATFORM "Raspberry Pi Pico" + #define RADIOLIB_PIN_TYPE pin_size_t + #define RADIOLIB_PIN_MODE PinMode + #define RADIOLIB_PIN_STATUS PinStatus + #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_PROGMEM PROGMEM + #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr) + #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED + #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1 + #define RADIOLIB_EXCLUDE_ESP8266 + #else // other platforms not covered by the above list - this may or may not work #define RADIOLIB_PLATFORM "Unknown"