[SX127x] Added option to specify interrupt direction for DIO

pull/609/head
jgromes 2022-10-23 20:39:15 +02:00
rodzic d80f87410e
commit 1316a805f3
2 zmienionych plików z 10 dodań i 6 usunięć

Wyświetl plik

@ -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() {

Wyświetl plik

@ -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.