[RF69] Added methods to clear DIO actions

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

View file

@ -263,6 +263,10 @@ void RF69::setDio0Action(void (*func)(void)) {
attachInterrupt(digitalPinToInterrupt(_mod->getIrq()), func, RISING);
}
void RF69::clearDio0Action() {
detachInterrupt(digitalPinToInterrupt(_mod->getIrq()));
}
void RF69::setDio1Action(void (*func)(void)) {
if(_mod->getGpio() != RADIOLIB_PIN_UNUSED) {
return;
@ -271,6 +275,13 @@ void RF69::setDio1Action(void (*func)(void)) {
attachInterrupt(digitalPinToInterrupt(_mod->getGpio()), func, RISING);
}
void RF69::clearDio1Action() {
if(_mod->getGpio() != RADIOLIB_PIN_UNUSED) {
return;
}
detachInterrupt(digitalPinToInterrupt(_mod->getGpio()));
}
int16_t RF69::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
// check packet length
if(len > RF69_MAX_PACKET_LENGTH) {

View file

@ -562,6 +562,11 @@ class RF69: public PhysicalLayer {
*/
void setDio0Action(void (*func)(void));
/*!
\brief Clears interrupt service routine to call when DIO0 activates.
*/
void clearDio0Action();
/*!
\brief Sets interrupt service routine to call when DIO1 activates.
@ -569,6 +574,11 @@ class RF69: 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.
Overloads for string-based transmissions are implemented in PhysicalLayer.