[SX127x] Added option to specify interrupt direction for DIO
This commit is contained in:
parent
d80f87410e
commit
1316a805f3
2 changed files with 10 additions and 6 deletions
|
@ -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() {
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue