From 9451f3633259b48ec455d3f9b8a1dcac7dc749ee Mon Sep 17 00:00:00 2001 From: jgromes Date: Sun, 21 Apr 2024 08:34:00 +0200 Subject: [PATCH] [LR11x0] Use IRQ instead of DIO1 as pin name --- ...1x0_Channel_Activity_Detection_Blocking.ino | 2 +- ...x0_Channel_Activity_Detection_Interrupt.ino | 4 ++-- .../LR11x0_GFSK_Modem/LR11x0_GFSK_Modem.ino | 2 +- .../LR11x0_Receive_Blocking.ino | 2 +- .../LR11x0_Receive_Interrupt.ino | 2 +- .../LR11x0_Transmit_Blocking.ino | 2 +- .../LR11x0_Transmit_Interrupt.ino | 2 +- src/modules/LR11x0/LR11x0.cpp | 12 ++++++------ src/modules/LR11x0/LR11x0.h | 18 +++++++++--------- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/examples/LR11x0/LR11x0_Channel_Activity_Detection_Blocking/LR11x0_Channel_Activity_Detection_Blocking.ino b/examples/LR11x0/LR11x0_Channel_Activity_Detection_Blocking/LR11x0_Channel_Activity_Detection_Blocking.ino index 096c160e..171c87de 100644 --- a/examples/LR11x0/LR11x0_Channel_Activity_Detection_Blocking/LR11x0_Channel_Activity_Detection_Blocking.ino +++ b/examples/LR11x0/LR11x0_Channel_Activity_Detection_Blocking/LR11x0_Channel_Activity_Detection_Blocking.ino @@ -25,7 +25,7 @@ // LR1110 has the following connections: // NSS pin: 10 -// DIO1 pin: 2 +// IRQ pin: 2 // NRST pin: 3 // BUSY pin: 9 LR1110 radio = new Module(10, 2, 3, 9); diff --git a/examples/LR11x0/LR11x0_Channel_Activity_Detection_Interrupt/LR11x0_Channel_Activity_Detection_Interrupt.ino b/examples/LR11x0/LR11x0_Channel_Activity_Detection_Interrupt/LR11x0_Channel_Activity_Detection_Interrupt.ino index 41b9c89a..90f0c8aa 100644 --- a/examples/LR11x0/LR11x0_Channel_Activity_Detection_Interrupt/LR11x0_Channel_Activity_Detection_Interrupt.ino +++ b/examples/LR11x0/LR11x0_Channel_Activity_Detection_Interrupt/LR11x0_Channel_Activity_Detection_Interrupt.ino @@ -20,7 +20,7 @@ // LR1110 has the following connections: // NSS pin: 10 -// DIO1 pin: 2 +// IRQ pin: 2 // NRST pin: 3 // BUSY pin: 9 LR1110 radio = new Module(10, 2, 3, 9); @@ -45,7 +45,7 @@ void setup() { // set the function that will be called // when LoRa packet or timeout is detected - radio.setDio1Action(setFlag); + radio.setIrqAction(setFlag); // start scanning the channel Serial.print(F("[LR1110] Starting scan for LoRa preamble ... ")); diff --git a/examples/LR11x0/LR11x0_GFSK_Modem/LR11x0_GFSK_Modem.ino b/examples/LR11x0/LR11x0_GFSK_Modem/LR11x0_GFSK_Modem.ino index 66e4090d..45dc0507 100644 --- a/examples/LR11x0/LR11x0_GFSK_Modem/LR11x0_GFSK_Modem.ino +++ b/examples/LR11x0/LR11x0_GFSK_Modem/LR11x0_GFSK_Modem.ino @@ -21,7 +21,7 @@ // LR1110 has the following connections: // NSS pin: 10 -// DIO1 pin: 2 +// IRQ pin: 2 // NRST pin: 3 // BUSY pin: 9 LR1110 radio = new Module(10, 2, 3, 9); diff --git a/examples/LR11x0/LR11x0_Receive_Blocking/LR11x0_Receive_Blocking.ino b/examples/LR11x0/LR11x0_Receive_Blocking/LR11x0_Receive_Blocking.ino index e29806bd..8d0efc9a 100644 --- a/examples/LR11x0/LR11x0_Receive_Blocking/LR11x0_Receive_Blocking.ino +++ b/examples/LR11x0/LR11x0_Receive_Blocking/LR11x0_Receive_Blocking.ino @@ -30,7 +30,7 @@ // LR1110 has the following connections: // NSS pin: 10 -// DIO1 pin: 2 +// IRQ pin: 2 // NRST pin: 3 // BUSY pin: 9 LR1110 radio = new Module(10, 2, 3, 9); diff --git a/examples/LR11x0/LR11x0_Receive_Interrupt/LR11x0_Receive_Interrupt.ino b/examples/LR11x0/LR11x0_Receive_Interrupt/LR11x0_Receive_Interrupt.ino index 0539104a..f20f2aaf 100644 --- a/examples/LR11x0/LR11x0_Receive_Interrupt/LR11x0_Receive_Interrupt.ino +++ b/examples/LR11x0/LR11x0_Receive_Interrupt/LR11x0_Receive_Interrupt.ino @@ -26,7 +26,7 @@ // LR1110 has the following connections: // NSS pin: 10 -// DIO1 pin: 2 +// IRQ pin: 2 // NRST pin: 3 // BUSY pin: 9 LR1110 radio = new Module(10, 2, 3, 9); diff --git a/examples/LR11x0/LR11x0_Transmit_Blocking/LR11x0_Transmit_Blocking.ino b/examples/LR11x0/LR11x0_Transmit_Blocking/LR11x0_Transmit_Blocking.ino index 93dab374..741102ac 100644 --- a/examples/LR11x0/LR11x0_Transmit_Blocking/LR11x0_Transmit_Blocking.ino +++ b/examples/LR11x0/LR11x0_Transmit_Blocking/LR11x0_Transmit_Blocking.ino @@ -21,7 +21,7 @@ // LR1110 has the following connections: // NSS pin: 10 -// DIO1 pin: 2 +// IRQ pin: 2 // NRST pin: 3 // BUSY pin: 9 LR1110 radio = new Module(10, 2, 3, 9); diff --git a/examples/LR11x0/LR11x0_Transmit_Interrupt/LR11x0_Transmit_Interrupt.ino b/examples/LR11x0/LR11x0_Transmit_Interrupt/LR11x0_Transmit_Interrupt.ino index 6de582c6..e47c68f7 100644 --- a/examples/LR11x0/LR11x0_Transmit_Interrupt/LR11x0_Transmit_Interrupt.ino +++ b/examples/LR11x0/LR11x0_Transmit_Interrupt/LR11x0_Transmit_Interrupt.ino @@ -22,7 +22,7 @@ // LR1110 has the following connections: // NSS pin: 10 -// DIO1 pin: 2 +// IRQ pin: 2 // NRST pin: 3 // BUSY pin: 9 LR1110 radio = new Module(10, 2, 3, 9); diff --git a/src/modules/LR11x0/LR11x0.cpp b/src/modules/LR11x0/LR11x0.cpp index ffae2c46..fb7fdba7 100644 --- a/src/modules/LR11x0/LR11x0.cpp +++ b/src/modules/LR11x0/LR11x0.cpp @@ -373,28 +373,28 @@ int16_t LR11x0::sleep(bool retainConfig, uint32_t sleepTime) { return(state); } -void LR11x0::setDio1Action(void (*func)(void)) { +void LR11x0::setIrqAction(void (*func)(void)) { this->mod->hal->attachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getIrq()), func, this->mod->hal->GpioInterruptRising); } -void LR11x0::clearDio1Action() { +void LR11x0::clearIrqAction() { this->mod->hal->detachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getIrq())); } void LR11x0::setPacketReceivedAction(void (*func)(void)) { - this->setDio1Action(func); + this->setIrqAction(func); } void LR11x0::clearPacketReceivedAction() { - this->clearDio1Action(); + this->clearIrqAction(); } void LR11x0::setPacketSentAction(void (*func)(void)) { - this->setDio1Action(func); + this->setIrqAction(func); } void LR11x0::clearPacketSentAction() { - this->clearDio1Action(); + this->clearIrqAction(); } int16_t LR11x0::startTransmit(uint8_t* data, size_t len, uint8_t addr) { diff --git a/src/modules/LR11x0/LR11x0.h b/src/modules/LR11x0/LR11x0.h index 6955fa79..5b040233 100644 --- a/src/modules/LR11x0/LR11x0.h +++ b/src/modules/LR11x0/LR11x0.h @@ -663,15 +663,15 @@ class LR11x0: public PhysicalLayer { // interrupt methods /*! - \brief Sets interrupt service routine to call when DIO1 activates. + \brief Sets interrupt service routine to call when IRQ1 activates. \param func ISR to call. */ - void setDio1Action(void (*func)(void)); + void setIrqAction(void (*func)(void)); /*! - \brief Clears interrupt service routine to call when DIO1 activates. + \brief Clears interrupt service routine to call when IRQ1 activates. */ - void clearDio1Action(); + void clearIrqAction(); /*! \brief Sets interrupt service routine to call when a packet is received. @@ -720,13 +720,13 @@ class LR11x0: public PhysicalLayer { int16_t startReceive(); /*! - \brief Interrupt-driven receive method. DIO1 will be activated when full packet is received. + \brief Interrupt-driven receive method. IRQ1 will be activated when full packet is received. \param timeout Raw timeout value, expressed as multiples of 1/32.768 kHz (approximately 30.52 us). Defaults to RADIOLIB_LR11X0_RX_TIMEOUT_INF for infinite timeout (Rx continuous mode), set to RADIOLIB_LR11X0_RX_TIMEOUT_NONE for no timeout (Rx single mode). - If timeout other than infinite is set, signal will be generated on DIO1. + If timeout other than infinite is set, signal will be generated on IRQ1. - \param irqFlags Sets the IRQ flags that will trigger DIO1, defaults to RADIOLIB_LR11X0_IRQ_RX_DONE. + \param irqFlags Sets the IRQ flags that will trigger IRQ1, defaults to RADIOLIB_LR11X0_IRQ_RX_DONE. \param len Only for PhysicalLayer compatibility, not used. \returns \ref status_codes */ @@ -749,14 +749,14 @@ class LR11x0: public PhysicalLayer { int16_t readData(uint8_t* data, size_t len) override; /*! - \brief Interrupt-driven channel activity detection method. DIO1 will be activated + \brief Interrupt-driven channel activity detection method. IRQ1 will be activated when LoRa preamble is detected, or upon timeout. Defaults to CAD parameter values recommended by AN1200.48. \returns \ref status_codes */ int16_t startChannelScan() override; /*! - \brief Interrupt-driven channel activity detection method. DIO1 will be activated + \brief Interrupt-driven channel activity detection method. IRQ1 will be activated when LoRa preamble is detected, or upon timeout. \param symbolNum Number of symbols for CAD detection. \param detPeak Peak value for CAD detection.