Added support for Nano 33 BLE
This commit is contained in:
parent
fd6ef55a06
commit
39c259848c
7 changed files with 184 additions and 65 deletions
|
@ -1,9 +1,9 @@
|
|||
#include "Module.h"
|
||||
|
||||
Module::Module(int16_t cs, int16_t irq, int16_t rst) {
|
||||
Module::Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst) {
|
||||
_cs = cs;
|
||||
_rx = NC;
|
||||
_tx = NC;
|
||||
_rx = RADIOLIB_NC;
|
||||
_tx = RADIOLIB_NC;
|
||||
_irq = irq;
|
||||
_rst = rst;
|
||||
_spi = &SPI;
|
||||
|
@ -11,10 +11,10 @@ Module::Module(int16_t cs, int16_t irq, int16_t rst) {
|
|||
_initInterface = true;
|
||||
}
|
||||
|
||||
Module::Module(int16_t cs, int16_t irq, int16_t rst, int16_t gpio) {
|
||||
Module::Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio) {
|
||||
_cs = cs;
|
||||
_rx = gpio;
|
||||
_tx = NC;
|
||||
_tx = RADIOLIB_NC;
|
||||
_irq = irq;
|
||||
_rst = rst;
|
||||
_spi = &SPI;
|
||||
|
@ -22,11 +22,11 @@ Module::Module(int16_t cs, int16_t irq, int16_t rst, int16_t gpio) {
|
|||
_initInterface = true;
|
||||
}
|
||||
|
||||
Module::Module(int16_t rx, int16_t tx, HardwareSerial* useSer, int16_t rst) {
|
||||
_cs = NC;
|
||||
Module::Module(RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, HardwareSerial* useSer, RADIOLIB_PIN_TYPE rst) {
|
||||
_cs = RADIOLIB_NC;
|
||||
_rx = rx;
|
||||
_tx = tx;
|
||||
_irq = NC;
|
||||
_irq = RADIOLIB_NC;
|
||||
_rst = rst;
|
||||
_initInterface = true;
|
||||
|
||||
|
@ -38,10 +38,10 @@ Module::Module(int16_t rx, int16_t tx, HardwareSerial* useSer, int16_t rst) {
|
|||
#endif
|
||||
}
|
||||
|
||||
Module::Module(int16_t cs, int16_t irq, int16_t rst, SPIClass& spi, SPISettings spiSettings) {
|
||||
Module::Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass& spi, SPISettings spiSettings) {
|
||||
_cs = cs;
|
||||
_rx = NC;
|
||||
_tx = NC;
|
||||
_rx = RADIOLIB_NC;
|
||||
_tx = RADIOLIB_NC;
|
||||
_irq = irq;
|
||||
_rst = rst;
|
||||
_spi = &spi;
|
||||
|
@ -49,10 +49,10 @@ Module::Module(int16_t cs, int16_t irq, int16_t rst, SPIClass& spi, SPISettings
|
|||
_initInterface = false;
|
||||
}
|
||||
|
||||
Module::Module(int16_t cs, int16_t irq, int16_t rst, int16_t gpio, SPIClass& spi, SPISettings spiSettings) {
|
||||
Module::Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio, SPIClass& spi, SPISettings spiSettings) {
|
||||
_cs = cs;
|
||||
_rx = gpio;
|
||||
_tx = NC;
|
||||
_tx = RADIOLIB_NC;
|
||||
_irq = irq;
|
||||
_rst = rst;
|
||||
_spi = &spi;
|
||||
|
@ -60,7 +60,7 @@ Module::Module(int16_t cs, int16_t irq, int16_t rst, int16_t gpio, SPIClass& spi
|
|||
_initInterface = false;
|
||||
}
|
||||
|
||||
Module::Module(int16_t cs, int16_t irq, int16_t rst, int16_t rx, int16_t tx, SPIClass& spi, SPISettings spiSettings, HardwareSerial* useSer) {
|
||||
Module::Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, SPIClass& spi, SPISettings spiSettings, HardwareSerial* useSer) {
|
||||
_cs = cs;
|
||||
_rx = rx;
|
||||
_tx = tx;
|
||||
|
@ -276,14 +276,21 @@ void Module::SPItransfer(uint8_t cmd, uint8_t reg, uint8_t* dataOut, uint8_t* da
|
|||
_spi->endTransaction();
|
||||
}
|
||||
|
||||
void Module::pinMode(int16_t pin, uint8_t mode) {
|
||||
if(pin != NC) {
|
||||
void Module::pinMode(RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_MODE mode) {
|
||||
if(pin != RADIOLIB_NC) {
|
||||
::pinMode(pin, mode);
|
||||
}
|
||||
}
|
||||
|
||||
void Module::digitalWrite(int16_t pin, uint8_t value) {
|
||||
if(pin != NC) {
|
||||
void Module::digitalWrite(RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_STATUS value) {
|
||||
if(pin != RADIOLIB_NC) {
|
||||
::digitalWrite(pin, value);
|
||||
}
|
||||
}
|
||||
|
||||
RADIOLIB_PIN_STATUS Module::digitalRead(RADIOLIB_PIN_TYPE pin) {
|
||||
if(pin != RADIOLIB_NC) {
|
||||
return(::digitalRead(pin));
|
||||
}
|
||||
return(LOW);
|
||||
}
|
||||
|
|
55
src/Module.h
55
src/Module.h
|
@ -30,9 +30,9 @@ class Module {
|
|||
\param rst Arduino pin to be used as hardware reset for the module. Defaults to NC (unused).
|
||||
*/
|
||||
#ifdef RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
|
||||
Module(int16_t tx, int16_t rx, HardwareSerial* serial = &Serial1, int16_t rst = NC);
|
||||
Module(RADIOLIB_PIN_TYPE tx, RADIOLIB_PIN_TYPE rx, HardwareSerial* serial = &RADIOLIB_HARDWARE_SERIAL_PORT, RADIOLIB_PIN_TYPE rst = RADIOLIB_NC);
|
||||
#else
|
||||
Module(int16_t tx, int16_t rx, HardwareSerial* serial = nullptr, int16_t rst = NC);
|
||||
Module(RADIOLIB_PIN_TYPE tx, RADIOLIB_PIN_TYPE rx, HardwareSerial* serial = nullptr, RADIOLIB_PIN_TYPE rst = RADIOLIB_NC);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
|
@ -44,7 +44,7 @@ class Module {
|
|||
|
||||
\param rst Arduino pin to be used as hardware reset for the module.
|
||||
*/
|
||||
Module(int16_t cs, int16_t irq, int16_t rst);
|
||||
Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst);
|
||||
|
||||
/*!
|
||||
\brief Extended SPI-based module constructor. Will use the default SPI interface automatically initialize it.
|
||||
|
@ -57,7 +57,7 @@ class Module {
|
|||
|
||||
\param gpio Arduino pin to be used as additional interrupt/GPIO.
|
||||
*/
|
||||
Module(int16_t cs, int16_t irq, int16_t rst, int16_t gpio);
|
||||
Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio);
|
||||
|
||||
/*!
|
||||
\brief SPI-based module constructor.
|
||||
|
@ -72,7 +72,7 @@ class Module {
|
|||
|
||||
\param spiSettings SPI interface settings.
|
||||
*/
|
||||
Module(int16_t cs, int16_t irq, int16_t rst, SPIClass& spi, SPISettings spiSettings);
|
||||
Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass& spi, SPISettings spiSettings);
|
||||
|
||||
/*!
|
||||
\brief Extended SPI-based module constructor.
|
||||
|
@ -89,7 +89,7 @@ class Module {
|
|||
|
||||
\param spiSettings SPI interface settings.
|
||||
*/
|
||||
Module(int16_t cs, int16_t irq, int16_t rst, int16_t gpio, SPIClass& spi, SPISettings spiSettings);
|
||||
Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio, SPIClass& spi, SPISettings spiSettings);
|
||||
|
||||
/*!
|
||||
\brief Generic module constructor.
|
||||
|
@ -111,9 +111,9 @@ class Module {
|
|||
\param serial HardwareSerial to be used on ESP32 and SAMD. Defaults to 1
|
||||
*/
|
||||
#ifdef RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
|
||||
Module(int16_t cs, int16_t irq, int16_t rst, int16_t rx, int16_t tx, SPIClass& spi = SPI, SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0), HardwareSerial* serial = &Serial1);
|
||||
Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, SPIClass& spi = SPI, SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0), HardwareSerial* serial = &RADIOLIB_HARDWARE_SERIAL_PORT);
|
||||
#else
|
||||
Module(int16_t cs, int16_t irq, int16_t rst, int16_t rx, int16_t tx, SPIClass& spi = SPI, SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0), HardwareSerial* serial = nullptr);
|
||||
Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, SPIClass& spi = SPI, SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0), HardwareSerial* serial = nullptr);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -290,42 +290,42 @@ class Module {
|
|||
|
||||
\returns Pin number of SPI chip select configured in the constructor.
|
||||
*/
|
||||
int16_t getCs() const { return(_cs); }
|
||||
RADIOLIB_PIN_TYPE getCs() const { return(_cs); }
|
||||
|
||||
/*!
|
||||
\brief Access method to get the pin number of interrupt/GPIO.
|
||||
|
||||
\returns Pin number of interrupt/GPIO configured in the constructor.
|
||||
*/
|
||||
int16_t getIrq() const { return(_irq); }
|
||||
RADIOLIB_PIN_TYPE getIrq() const { return(_irq); }
|
||||
|
||||
/*!
|
||||
\brief Access method to get the pin number of hardware reset pin.
|
||||
|
||||
\returns Pin number of hardware reset pin configured in the constructor.
|
||||
*/
|
||||
int16_t getRst() const { return(_rst); }
|
||||
RADIOLIB_PIN_TYPE getRst() const { return(_rst); }
|
||||
|
||||
/*!
|
||||
\brief Access method to get the pin number of second interrupt/GPIO.
|
||||
|
||||
\returns Pin number of second interrupt/GPIO configured in the constructor.
|
||||
*/
|
||||
int16_t getGpio() const { return(_rx); }
|
||||
RADIOLIB_PIN_TYPE getGpio() const { return(_rx); }
|
||||
|
||||
/*!
|
||||
\brief Access method to get the pin number of UART Rx.
|
||||
|
||||
\returns Pin number of UART Rx configured in the constructor.
|
||||
*/
|
||||
int16_t getRx() const { return(_rx); }
|
||||
RADIOLIB_PIN_TYPE getRx() const { return(_rx); }
|
||||
|
||||
/*!
|
||||
\brief Access method to get the pin number of UART Rx.
|
||||
|
||||
\returns Pin number of UART Rx configured in the constructor.
|
||||
*/
|
||||
int16_t getTx() const { return(_tx); }
|
||||
RADIOLIB_PIN_TYPE getTx() const { return(_tx); }
|
||||
|
||||
/*!
|
||||
\brief Access method to get the SPI interface.
|
||||
|
@ -342,31 +342,40 @@ class Module {
|
|||
SPISettings getSpiSettings() const { return(_spiSettings); }
|
||||
|
||||
/*!
|
||||
\brief Arduino core pinMode override that checks -1 as alias for unused pin.
|
||||
\brief Arduino core pinMode override that checks RADIOLIB_NC as alias for unused pin.
|
||||
|
||||
\param pin Pin to change the mode of.
|
||||
|
||||
\param mode Which mode to set.
|
||||
*/
|
||||
static void pinMode(int16_t pin, uint8_t mode);
|
||||
static void pinMode(RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_MODE mode);
|
||||
|
||||
/*!
|
||||
\brief Arduino core digitalWrite override that checks -1 as alias for unused pin.
|
||||
\brief Arduino core digitalWrite override that checks RADIOLIB_NC as alias for unused pin.
|
||||
|
||||
\param pin Pin to write to.
|
||||
|
||||
\param value Whether to set the pin high or low.
|
||||
*/
|
||||
static void digitalWrite(int16_t pin, uint8_t value);
|
||||
static void digitalWrite(RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_STATUS value);
|
||||
|
||||
/*!
|
||||
\brief Arduino core digitalWrite override that checks RADIOLIB_NC as alias for unused pin.
|
||||
|
||||
\param pin Pin to read from.
|
||||
|
||||
\returns Pin value.
|
||||
*/
|
||||
static RADIOLIB_PIN_STATUS digitalRead(RADIOLIB_PIN_TYPE pin);
|
||||
|
||||
#ifndef RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
int16_t _cs;
|
||||
int16_t _tx;
|
||||
int16_t _rx;
|
||||
int16_t _irq;
|
||||
int16_t _rst;
|
||||
RADIOLIB_PIN_TYPE _cs;
|
||||
RADIOLIB_PIN_TYPE _tx;
|
||||
RADIOLIB_PIN_TYPE _rx;
|
||||
RADIOLIB_PIN_TYPE _irq;
|
||||
RADIOLIB_PIN_TYPE _rst;
|
||||
|
||||
bool _initInterface;
|
||||
SPIClass* _spi;
|
||||
|
|
131
src/TypeDef.h
131
src/TypeDef.h
|
@ -7,6 +7,123 @@
|
|||
#error "Unsupported Arduino version (< 1.0.0)"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Platform-specific configuration.
|
||||
*
|
||||
* RADIOLIB_PIN_TYPE - which type should be used for pin numbers in functions like digitalRead().
|
||||
* RADIOLIB_PIN_MODE - which type should be used for pin modes in functions like pinMode().
|
||||
* RADIOLIB_PIN_STATUS - which type should be used for pin values in functions like digitalWrite().
|
||||
* RADIOLIB_NC - alias for unused pin, usually the largest possible value of RADIOLIB_PIN_TYPE.
|
||||
* RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED - defined if the specific platfrom does not support SoftwareSerial.
|
||||
* RADIOLIB_HARDWARE_SERIAL_PORT - which hardware serial port should be used on platfroms taht do not have SoftwareSerial support.
|
||||
*
|
||||
* In addition, some platforms amy require RadioLib to disable spceific drivers (such as ESP8266).
|
||||
*/
|
||||
#if defined(__AVR__) && !(defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY))
|
||||
// Arduino AVR boards (except for megaAVR) - Uno, Mega etc.
|
||||
#define RADIOLIB_PIN_TYPE uint8_t
|
||||
#define RADIOLIB_PIN_MODE uint8_t
|
||||
#define RADIOLIB_PIN_STATUS uint8_t
|
||||
#define RADIOLIB_NC (0xFF)
|
||||
|
||||
#elif defined(ESP8266)
|
||||
// ESP8266 boards
|
||||
#define RADIOLIB_PIN_TYPE uint8_t
|
||||
#define RADIOLIB_PIN_MODE uint8_t
|
||||
#define RADIOLIB_PIN_STATUS uint8_t
|
||||
#define RADIOLIB_NC (0xFF)
|
||||
|
||||
// RadioLib has ESPS8266 driver, this must be disabled to use ESP8266 as platform
|
||||
#define _RADIOLIB_ESP8266_H
|
||||
|
||||
#elif defined(ESP32)
|
||||
// ESP32 boards
|
||||
#define RADIOLIB_PIN_TYPE uint8_t
|
||||
#define RADIOLIB_PIN_MODE uint8_t
|
||||
#define RADIOLIB_PIN_STATUS uint8_t
|
||||
#define RADIOLIB_NC (0xFF)
|
||||
#define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
|
||||
#define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
|
||||
|
||||
#elif defined(ARDUINO_ARCH_STM32)
|
||||
// STM32duino boards
|
||||
#define RADIOLIB_PIN_TYPE uint32_t
|
||||
#define RADIOLIB_PIN_MODE uint32_t
|
||||
#define RADIOLIB_PIN_STATUS uint32_t
|
||||
#define RADIOLIB_NC (0xFFFFFFFF)
|
||||
#define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
|
||||
#define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
|
||||
|
||||
#elif defined(SAMD_SERIES)
|
||||
// Arduino SAMD boards - Zero, MKR, etc.
|
||||
#define RADIOLIB_PIN_TYPE uint32_t
|
||||
#define RADIOLIB_PIN_MODE uint32_t
|
||||
#define RADIOLIB_PIN_STATUS uint32_t
|
||||
#define RADIOLIB_NC (0xFFFFFFFF)
|
||||
#define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
|
||||
#define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
|
||||
|
||||
#elif defined(__SAM3X8E__)
|
||||
// Arduino Due
|
||||
#define RADIOLIB_PIN_TYPE uint32_t
|
||||
#define RADIOLIB_PIN_MODE uint32_t
|
||||
#define RADIOLIB_PIN_STATUS uint32_t
|
||||
#define RADIOLIB_NC (0xFFFFFFFF)
|
||||
#define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
|
||||
#define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
|
||||
|
||||
#elif (defined(NRF52832_XXAA) || defined(NRF52840_XXAA)) && !defined(ARDUINO_ARDUINO_NANO33BLE)
|
||||
// Adafruit nRF52 boards
|
||||
#define RADIOLIB_PIN_TYPE uint32_t
|
||||
#define RADIOLIB_PIN_MODE uint32_t
|
||||
#define RADIOLIB_PIN_STATUS uint32_t
|
||||
#define RADIOLIB_NC (0xFFFFFFFF)
|
||||
|
||||
#elif defined(ARDUINO_ARC32_TOOLS)
|
||||
// Intel Curie
|
||||
#define RADIOLIB_PIN_TYPE uint8_t
|
||||
#define RADIOLIB_PIN_MODE uint8_t
|
||||
#define RADIOLIB_PIN_STATUS uint8_t
|
||||
#define RADIOLIB_NC (0xFF)
|
||||
|
||||
#elif defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY)
|
||||
// Arduino megaAVR boards - Uno Wifi Rev.2, Nano Every
|
||||
#define RADIOLIB_PIN_TYPE uint8_t
|
||||
#define RADIOLIB_PIN_MODE PinMode
|
||||
#define RADIOLIB_PIN_STATUS PinStatus
|
||||
#define RADIOLIB_NC (0xFF)
|
||||
|
||||
#elif defined(AM_PART_APOLLO3)
|
||||
// Sparkfun Artemis boards
|
||||
#define RADIOLIB_PIN_TYPE uint8_t
|
||||
#define RADIOLIB_PIN_MODE uint8_t
|
||||
#define RADIOLIB_PIN_STATUS uint8_t
|
||||
#define RADIOLIB_NC (0xFF)
|
||||
#define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
|
||||
#define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
|
||||
|
||||
#elif defined(ARDUINO_ARDUINO_NANO33BLE)
|
||||
// Arduino Nano 33 BLE
|
||||
#define RADIOLIB_PIN_TYPE pin_size_t
|
||||
#define RADIOLIB_PIN_MODE PinMode
|
||||
#define RADIOLIB_PIN_STATUS PinStatus
|
||||
#define RADIOLIB_NC (0xFF)
|
||||
#define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
|
||||
#define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
|
||||
|
||||
// Nano 33 BLE uses mbed libraries, which already contain ESP8266 driver
|
||||
#define _RADIOLIB_ESP8266_H
|
||||
|
||||
#else
|
||||
// other platforms not covered by the above list - this may or may not work
|
||||
#warning "RadioLib might not be compatible with this Arduino board - check supported platforms at https://github.com/jgromes/RadioLib!"
|
||||
#define RADIOLIB_PIN_TYPE uint8_t
|
||||
#define RADIOLIB_PIN_MODE uint8_t
|
||||
#define RADIOLIB_PIN_STATUS uint8_t
|
||||
#define RADIOLIB_NC (0xFF)
|
||||
|
||||
#endif
|
||||
|
||||
// version definitions
|
||||
#define RADIOLIB_VERSION_MAJOR (0x03)
|
||||
#define RADIOLIB_VERSION_MINOR (0x04)
|
||||
|
@ -67,20 +184,6 @@
|
|||
*/
|
||||
//#define RADIOLIB_RADIOSHIELD
|
||||
|
||||
/*
|
||||
* The following platforms do not support SoftwareSerial library.
|
||||
*/
|
||||
#if defined(ESP32) || defined(SAMD_SERIES) || defined(ARDUINO_ARCH_STM32) || defined(__SAM3X8E__) || defined(AM_PART_APOLLO3)
|
||||
#define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\brief Alias for unused pin, if not supplied by the Arduino core.
|
||||
*/
|
||||
#if !(defined(NC) || defined(ARDUINO_ARCH_STM32))
|
||||
#define NC (-1)
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\brief A simple assert macro, will return on error.
|
||||
*/
|
||||
|
|
|
@ -179,7 +179,7 @@ int16_t CC1101::packetMode() {
|
|||
return(state);
|
||||
}
|
||||
|
||||
void CC1101::setGdo0Action(void (*func)(void), uint8_t dir) {
|
||||
void CC1101::setGdo0Action(void (*func)(void), RADIOLIB_PIN_STATUS dir) {
|
||||
attachInterrupt(digitalPinToInterrupt(_mod->getIrq()), func, dir);
|
||||
}
|
||||
|
||||
|
@ -187,8 +187,8 @@ void CC1101::clearGdo0Action() {
|
|||
detachInterrupt(digitalPinToInterrupt(_mod->getIrq()));
|
||||
}
|
||||
|
||||
void CC1101::setGdo2Action(void (*func)(void), uint8_t dir) {
|
||||
if(_mod->getGpio() != NC) {
|
||||
void CC1101::setGdo2Action(void (*func)(void), RADIOLIB_PIN_STATUS dir) {
|
||||
if(_mod->getGpio() != RADIOLIB_NC) {
|
||||
return;
|
||||
}
|
||||
Module::pinMode(_mod->getGpio(), INPUT);
|
||||
|
@ -196,7 +196,7 @@ void CC1101::setGdo2Action(void (*func)(void), uint8_t dir) {
|
|||
}
|
||||
|
||||
void CC1101::clearGdo2Action() {
|
||||
if(_mod->getGpio() != NC) {
|
||||
if(_mod->getGpio() != RADIOLIB_NC) {
|
||||
return;
|
||||
}
|
||||
detachInterrupt(digitalPinToInterrupt(_mod->getGpio()));
|
||||
|
|
|
@ -600,7 +600,7 @@ class CC1101: public PhysicalLayer {
|
|||
|
||||
\param dir Signal change direction. Defaults to FALLING.
|
||||
*/
|
||||
void setGdo0Action(void (*func)(void), uint8_t dir = FALLING);
|
||||
void setGdo0Action(void (*func)(void), RADIOLIB_PIN_STATUS dir = FALLING);
|
||||
|
||||
/*!
|
||||
\brief Clears interrupt service routine to call when GDO0 activates.
|
||||
|
@ -614,7 +614,7 @@ class CC1101: public PhysicalLayer {
|
|||
|
||||
\param dir Signal change direction. Defaults to FALLING.
|
||||
*/
|
||||
void setGdo2Action(void (*func)(void), uint8_t dir = FALLING);
|
||||
void setGdo2Action(void (*func)(void), RADIOLIB_PIN_STATUS dir = FALLING);
|
||||
|
||||
/*!
|
||||
\brief Clears interrupt service routine to call when GDO0 activates.
|
||||
|
|
|
@ -251,7 +251,7 @@ void RF69::clearDio0Action() {
|
|||
}
|
||||
|
||||
void RF69::setDio1Action(void (*func)(void)) {
|
||||
if(_mod->getGpio() != NC) {
|
||||
if(_mod->getGpio() != RADIOLIB_NC) {
|
||||
return;
|
||||
}
|
||||
Module::pinMode(_mod->getGpio(), INPUT);
|
||||
|
@ -259,7 +259,7 @@ void RF69::setDio1Action(void (*func)(void)) {
|
|||
}
|
||||
|
||||
void RF69::clearDio1Action() {
|
||||
if(_mod->getGpio() != NC) {
|
||||
if(_mod->getGpio() != RADIOLIB_NC) {
|
||||
return;
|
||||
}
|
||||
detachInterrupt(digitalPinToInterrupt(_mod->getGpio()));
|
||||
|
|
|
@ -376,14 +376,14 @@ void SX127x::clearDio0Action() {
|
|||
}
|
||||
|
||||
void SX127x::setDio1Action(void (*func)(void)) {
|
||||
if(_mod->getGpio() != NC) {
|
||||
if(_mod->getGpio() != RADIOLIB_NC) {
|
||||
return;
|
||||
}
|
||||
attachInterrupt(digitalPinToInterrupt(_mod->getGpio()), func, RISING);
|
||||
}
|
||||
|
||||
void SX127x::clearDio1Action() {
|
||||
if(_mod->getGpio() != NC) {
|
||||
if(_mod->getGpio() != RADIOLIB_NC) {
|
||||
return;
|
||||
}
|
||||
detachInterrupt(digitalPinToInterrupt(_mod->getGpio()));
|
||||
|
|
Loading…
Add table
Reference in a new issue