diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index 44c29c64..3072d925 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -417,19 +417,19 @@ int16_t SX127x::startReceive(uint8_t len, uint8_t mode) { return(setMode(mode)); } -void SX127x::setDio0Action(void (*func)(void)) { - _mod->attachInterrupt(RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(_mod->getIrq()), func, RISING); +void SX127x::setDio0Action(void (*func)(void), RADIOLIB_INTERRUPT_STATUS dir) { + _mod->attachInterrupt(RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(_mod->getIrq()), func, dir); } void SX127x::clearDio0Action() { _mod->detachInterrupt(RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(_mod->getIrq())); } -void SX127x::setDio1Action(void (*func)(void)) { +void SX127x::setDio1Action(void (*func)(void), RADIOLIB_INTERRUPT_STATUS dir) { if(_mod->getGpio() == RADIOLIB_NC) { return; } - _mod->attachInterrupt(RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(_mod->getGpio()), func, RISING); + _mod->attachInterrupt(RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(_mod->getGpio()), func, dir); } void SX127x::clearDio1Action() { diff --git a/src/modules/SX127x/SX127x.h b/src/modules/SX127x/SX127x.h index c960f2d2..ba33b78a 100644 --- a/src/modules/SX127x/SX127x.h +++ b/src/modules/SX127x/SX127x.h @@ -717,8 +717,10 @@ class SX127x: public PhysicalLayer { \brief Set interrupt service routine function to call when DIO0 activates. \param func Pointer to interrupt service routine. + + \param dir Signal change direction. Defaults to RISING. */ - void setDio0Action(void (*func)(void)); + void setDio0Action(void (*func)(void), RADIOLIB_INTERRUPT_STATUS dir = RISING); /*! \brief Clears interrupt service routine to call when DIO0 activates. @@ -729,8 +731,10 @@ class SX127x: public PhysicalLayer { \brief Set interrupt service routine function to call when DIO1 activates. \param func Pointer to interrupt service routine. + + \param dir Signal change direction. Defaults to RISING. */ - void setDio1Action(void (*func)(void)); + void setDio1Action(void (*func)(void), RADIOLIB_INTERRUPT_STATUS dir = RISING); /*! \brief Clears interrupt service routine to call when DIO1 activates.