Added support for Teensy (#175)

This commit is contained in:
jgromes 2022-06-12 19:31:15 +02:00
parent 34a0d77998
commit 6b83e08cfa
3 changed files with 43 additions and 1 deletions

View file

@ -33,6 +33,7 @@ jobs:
- arduino:mbed_rp2040:pico - arduino:mbed_rp2040:pico
- CubeCell:CubeCell:CubeCell-Board - CubeCell:CubeCell:CubeCell-Board
- MegaCore:avr:1281 - MegaCore:avr:1281
- teensy:avr:teensy41
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: ${{ matrix.board }} name: ${{ matrix.board }}
@ -137,6 +138,10 @@ jobs:
# MegaCore # MegaCore
echo "::set-output name=index-url::--additional-urls https://mcudude.github.io/MegaCore/package_MCUdude_MegaCore_index.json" echo "::set-output name=index-url::--additional-urls https://mcudude.github.io/MegaCore/package_MCUdude_MegaCore_index.json"
elif [[ "${{ contains(matrix.board, 'teensy:avr') }}" == "true" ]]; then
# Teensy
echo "::set-output name=index-url::--additional-urls https://www.pjrc.com/teensy/td_156/package_teensy_index.json"
fi fi
- name: Install platform - name: Install platform

View file

@ -75,6 +75,9 @@ SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x
* __Heltec__ * __Heltec__
* [__CubeCell__](https://github.com/HelTecAutomation/CubeCell-Arduino) - ASR650X series (CubeCell-Board, CubeCell-Capsule, CubeCell-Module etc.) * [__CubeCell__](https://github.com/HelTecAutomation/CubeCell-Arduino) - ASR650X series (CubeCell-Board, CubeCell-Capsule, CubeCell-Module etc.)
* __PJRC__
* [__Teensy__](https://github.com/PaulStoffregen/cores) - Teensy 2.x, 3.x and 4.x boards
The list above is by no means exhaustive - RadioLib code is independent of the used platform! Compilation of all examples is tested for all platforms officially supported prior to releasing new version. The list above is by no means exhaustive - RadioLib code is independent of the used platform! Compilation of all examples is tested for all platforms officially supported prior to releasing new version.
### In development: ### In development:

View file

@ -788,6 +788,40 @@
inline unsigned long micros() { return((unsigned long)(STCV)); }; inline unsigned long micros() { return((unsigned long)(STCV)); };
#endif #endif
#elif defined(TEENSYDUINO)
// Teensy
#define RADIOLIB_PLATFORM "Teensy"
#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 (uint8_t, digitalRead, uint8_t pin)
#define RADIOLIB_CB_ARGS_TONE (void, tone, uint8_t _pin, short unsigned int frequency, long unsigned int 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, unsigned long ms)
#define RADIOLIB_CB_ARGS_DELAY_MICROSECONDS (void, delayMicroseconds, long 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)
#else #else
// other Arduino platforms not covered by the above list - this may or may not work // other Arduino platforms not covered by the above list - this may or may not work
#define RADIOLIB_PLATFORM "Unknown Arduino" #define RADIOLIB_PLATFORM "Unknown Arduino"