[SX127x] Added methods to clear DIO actions

This commit is contained in:
jgromes 2019-12-29 10:36:52 +01:00
parent 95e9de6759
commit d00d07fe9c
2 changed files with 21 additions and 0 deletions

View file

@ -432,10 +432,21 @@ void SX127x::setDio0Action(void (*func)(void)) {
attachInterrupt(digitalPinToInterrupt(_mod->getIrq()), func, RISING); attachInterrupt(digitalPinToInterrupt(_mod->getIrq()), func, RISING);
} }
void SX127x::clearDio0Action() {
detachInterrupt(digitalPinToInterrupt(_mod->getIrq()));
}
void SX127x::setDio1Action(void (*func)(void)) { void SX127x::setDio1Action(void (*func)(void)) {
attachInterrupt(digitalPinToInterrupt(_mod->getGpio()), func, RISING); 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) { int16_t SX127x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
// set mode to standby // set mode to standby
int16_t state = setMode(SX127X_STANDBY); int16_t state = setMode(SX127X_STANDBY);

View file

@ -672,6 +672,11 @@ class SX127x: public PhysicalLayer {
*/ */
void setDio0Action(void (*func)(void)); 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. \brief Set interrupt service routine function to call when DIO1 activates.
@ -679,6 +684,11 @@ class SX127x: public PhysicalLayer {
*/ */
void setDio1Action(void (*func)(void)); 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. \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.