From 2dd69398e37a321b90dbf621bfdaef06327fcddd Mon Sep 17 00:00:00 2001 From: jgromes Date: Tue, 19 Nov 2024 18:51:42 +0100 Subject: [PATCH] [LR11x0] Fixed order of ISR functions in examples --- ...0_Channel_Activity_Detection_Interrupt.ino | 30 +++++++++---------- .../LR11x0_Receive_Interrupt.ino | 30 +++++++++---------- .../LR11x0_Transmit_Interrupt.ino | 30 +++++++++---------- .../LR11x0_WiFi_Scan_Interrupt.ino | 28 ++++++++--------- 4 files changed, 59 insertions(+), 59 deletions(-) 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 e7e295cb..7de03b21 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 @@ -57,6 +57,21 @@ static const Module::RfSwitchMode_t rfswitch_table[] = { END_OF_MODE_TABLE, }; +// flag to indicate that a packet was detected or CAD timed out +volatile bool scanFlag = false; + +// this function is called when a complete packet +// is received by the module +// IMPORTANT: this function MUST be 'void' type +// and MUST NOT have any arguments! +#if defined(ESP8266) || defined(ESP32) + ICACHE_RAM_ATTR +#endif +void setFlag(void) { + // something happened, set the flag + scanFlag = true; +} + void setup() { Serial.begin(9600); @@ -89,21 +104,6 @@ void setup() { } } -// flag to indicate that a packet was detected or CAD timed out -volatile bool scanFlag = false; - -// this function is called when a complete packet -// is received by the module -// IMPORTANT: this function MUST be 'void' type -// and MUST NOT have any arguments! -#if defined(ESP8266) || defined(ESP32) - ICACHE_RAM_ATTR -#endif -void setFlag(void) { - // something happened, set the flag - scanFlag = true; -} - void loop() { // check if the flag is set if(scanFlag) { diff --git a/examples/LR11x0/LR11x0_Receive_Interrupt/LR11x0_Receive_Interrupt.ino b/examples/LR11x0/LR11x0_Receive_Interrupt/LR11x0_Receive_Interrupt.ino index 372c208f..3b1d6074 100644 --- a/examples/LR11x0/LR11x0_Receive_Interrupt/LR11x0_Receive_Interrupt.ino +++ b/examples/LR11x0/LR11x0_Receive_Interrupt/LR11x0_Receive_Interrupt.ino @@ -63,6 +63,21 @@ static const Module::RfSwitchMode_t rfswitch_table[] = { END_OF_MODE_TABLE, }; +// flag to indicate that a packet was received +volatile bool receivedFlag = false; + +// this function is called when a complete packet +// is received by the module +// IMPORTANT: this function MUST be 'void' type +// and MUST NOT have any arguments! +#if defined(ESP8266) || defined(ESP32) + ICACHE_RAM_ATTR +#endif +void setFlag(void) { + // we got a packet, set the flag + receivedFlag = true; +} + void setup() { Serial.begin(9600); @@ -105,21 +120,6 @@ void setup() { // radio.scanChannel(); } -// flag to indicate that a packet was received -volatile bool receivedFlag = false; - -// this function is called when a complete packet -// is received by the module -// IMPORTANT: this function MUST be 'void' type -// and MUST NOT have any arguments! -#if defined(ESP8266) || defined(ESP32) - ICACHE_RAM_ATTR -#endif -void setFlag(void) { - // we got a packet, set the flag - receivedFlag = true; -} - void loop() { // check if the flag is set if(receivedFlag) { diff --git a/examples/LR11x0/LR11x0_Transmit_Interrupt/LR11x0_Transmit_Interrupt.ino b/examples/LR11x0/LR11x0_Transmit_Interrupt/LR11x0_Transmit_Interrupt.ino index 8e40eff2..3086a9a6 100644 --- a/examples/LR11x0/LR11x0_Transmit_Interrupt/LR11x0_Transmit_Interrupt.ino +++ b/examples/LR11x0/LR11x0_Transmit_Interrupt/LR11x0_Transmit_Interrupt.ino @@ -62,6 +62,21 @@ static const Module::RfSwitchMode_t rfswitch_table[] = { // save transmission state between loops int transmissionState = RADIOLIB_ERR_NONE; +// flag to indicate that a packet was sent +volatile bool transmittedFlag = false; + +// this function is called when a complete packet +// is transmitted by the module +// IMPORTANT: this function MUST be 'void' type +// and MUST NOT have any arguments! +#if defined(ESP8266) || defined(ESP32) + ICACHE_RAM_ATTR +#endif +void setFlag(void) { + // we sent a packet, set the flag + transmittedFlag = true; +} + void setup() { Serial.begin(9600); @@ -98,21 +113,6 @@ void setup() { */ } -// flag to indicate that a packet was sent -volatile bool transmittedFlag = false; - -// this function is called when a complete packet -// is transmitted by the module -// IMPORTANT: this function MUST be 'void' type -// and MUST NOT have any arguments! -#if defined(ESP8266) || defined(ESP32) - ICACHE_RAM_ATTR -#endif -void setFlag(void) { - // we sent a packet, set the flag - transmittedFlag = true; -} - // counter to keep track of transmitted packets int count = 0; diff --git a/examples/LR11x0/LR11x0_WiFi_Scan_Interrupt/LR11x0_WiFi_Scan_Interrupt.ino b/examples/LR11x0/LR11x0_WiFi_Scan_Interrupt/LR11x0_WiFi_Scan_Interrupt.ino index 38872f2e..21d90f2c 100644 --- a/examples/LR11x0/LR11x0_WiFi_Scan_Interrupt/LR11x0_WiFi_Scan_Interrupt.ino +++ b/examples/LR11x0/LR11x0_WiFi_Scan_Interrupt/LR11x0_WiFi_Scan_Interrupt.ino @@ -60,6 +60,20 @@ static const Module::RfSwitchMode_t rfswitch_table[] = { END_OF_MODE_TABLE, }; +// flag to indicate that a scan was completed +volatile bool scanFlag = false; + +// this function is called when a scan is completed +// IMPORTANT: this function MUST be 'void' type +// and MUST NOT have any arguments! +#if defined(ESP8266) || defined(ESP32) + ICACHE_RAM_ATTR +#endif +void setFlag(void) { + // scan is complete, set the flag + scanFlag = true; +} + void setup() { Serial.begin(9600); @@ -92,20 +106,6 @@ void setup() { } } -// flag to indicate that a scan was completed -volatile bool scanFlag = false; - -// this function is called when a scan is completed -// IMPORTANT: this function MUST be 'void' type -// and MUST NOT have any arguments! -#if defined(ESP8266) || defined(ESP32) - ICACHE_RAM_ATTR -#endif -void setFlag(void) { - // scan is complete, set the flag - scanFlag = true; -} - void loop() { // check if the flag is set if(scanFlag) {