From ea4018d3102db7ed994ce0aa0abd76d284bf45d9 Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 12 Aug 2023 18:43:26 +0200 Subject: [PATCH] [SX127x] Added common CAD methods --- src/modules/SX127x/SX127x.cpp | 8 ++++++++ src/modules/SX127x/SX127x.h | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index 6009b177..bd0b0d46 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -472,6 +472,14 @@ void SX127x::clearPacketSentAction() { this->clearDio0Action(); } +void SX127x::setChannelScanAction(void (*func)(void)) { + this->setDio0Action(func, this->mod->hal->GpioInterruptRising); +} + +void SX127x::clearChannelScanAction() { + this->clearDio0Action(); +} + void SX127x::setFifoEmptyAction(void (*func)(void)) { // set DIO1 to the FIFO empty event (the register setting is done in startTransmit) setDio1Action(func, this->mod->hal->GpioInterruptRising); diff --git a/src/modules/SX127x/SX127x.h b/src/modules/SX127x/SX127x.h index 6544016d..9ef2890f 100644 --- a/src/modules/SX127x/SX127x.h +++ b/src/modules/SX127x/SX127x.h @@ -738,6 +738,17 @@ class SX127x: public PhysicalLayer { */ void clearPacketSentAction(); + /*! + \brief Sets interrupt service routine to call when a channel scan is finished. + \param func ISR to call. + */ + void setChannelScanAction(void (*func)(void)); + + /*! + \brief Clears interrupt service routine to call when a channel scan is finished. + */ + void clearChannelScanAction(); + /*! \brief Set interrupt service routine function to call when FIFO is empty. \param func Pointer to interrupt service routine.