diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index 23bd0785..3098f63e 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -432,10 +432,21 @@ void SX127x::setDio0Action(void (*func)(void)) { attachInterrupt(digitalPinToInterrupt(_mod->getIrq()), func, RISING); } +void SX127x::clearDio0Action() { + detachInterrupt(digitalPinToInterrupt(_mod->getIrq())); +} + void SX127x::setDio1Action(void (*func)(void)) { attachInterrupt(digitalPinToInterrupt(_mod->getGpio()), func, RISING); } +void SX127x::clearDio1Action() { + if(_mod->getGpio() != RADIOLIB_PIN_UNUSED) { + return; + } + detachInterrupt(digitalPinToInterrupt(_mod->getGpio())); +} + int16_t SX127x::startTransmit(uint8_t* data, size_t len, uint8_t addr) { // set mode to standby int16_t state = setMode(SX127X_STANDBY); diff --git a/src/modules/SX127x/SX127x.h b/src/modules/SX127x/SX127x.h index 2d1f0328..26ea958c 100644 --- a/src/modules/SX127x/SX127x.h +++ b/src/modules/SX127x/SX127x.h @@ -672,6 +672,11 @@ class SX127x: public PhysicalLayer { */ void setDio0Action(void (*func)(void)); + /*! + \brief Clears interrupt service routine to call when DIO0 activates. + */ + void clearDio0Action(); + /*! \brief Set interrupt service routine function to call when DIO1 activates. @@ -679,6 +684,11 @@ class SX127x: public PhysicalLayer { */ void setDio1Action(void (*func)(void)); + /*! + \brief Clears interrupt service routine to call when DIO1 activates. + */ + void clearDio1Action(); + /*! \brief Interrupt-driven binary transmit method. Will start transmitting arbitrary binary data up to 255 bytes long using %LoRa or up to 63 bytes using FSK modem.