From 5cb5836ed82f98caf2203a18536fd9b8edb7ecb7 Mon Sep 17 00:00:00 2001 From: jgromes Date: Wed, 29 Dec 2021 08:49:14 +0100 Subject: [PATCH] [SX127x] Added ESP8266/ESP32 IRAM attribute --- .../SX127x_Channel_Activity_Detection_Interrupt.ino | 11 +++++++---- .../SX127x_Receive_Interrupt.ino | 3 +++ .../SX127x_Transmit_Interrupt.ino | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/examples/SX127x/SX127x_Channel_Activity_Detection_Interrupt/SX127x_Channel_Activity_Detection_Interrupt.ino b/examples/SX127x/SX127x_Channel_Activity_Detection_Interrupt/SX127x_Channel_Activity_Detection_Interrupt.ino index 30f945e4..55372452 100644 --- a/examples/SX127x/SX127x_Channel_Activity_Detection_Interrupt/SX127x_Channel_Activity_Detection_Interrupt.ino +++ b/examples/SX127x/SX127x_Channel_Activity_Detection_Interrupt/SX127x_Channel_Activity_Detection_Interrupt.ino @@ -79,6 +79,9 @@ volatile bool enableInterrupt = true; // is detected within timeout period // IMPORTANT: this function MUST be 'void' type // and MUST NOT have any arguments! +#if defined(ESP8266) || defined(ESP32) + ICACHE_RAM_ATTR +#endif void setFlagTimeout(void) { // check if the interrupt is enabled if(!enableInterrupt) { @@ -115,14 +118,14 @@ void loop() { // LoRa preamble was detected Serial.print(F("[SX1278] Preamble detected!")); - + } - + // check if we need to restart channel activity detection if(detectedFlag || timeoutFlag) { // start scanning the channel Serial.print(F("[SX1278] Starting scan for LoRa preamble ... ")); - + // start scanning current channel int state = radio.startChannelScan(); if (state == RADIOLIB_ERR_NONE) { @@ -131,6 +134,6 @@ void loop() { Serial.print(F("failed, code ")); Serial.println(state); } - + } } diff --git a/examples/SX127x/SX127x_Receive_Interrupt/SX127x_Receive_Interrupt.ino b/examples/SX127x/SX127x_Receive_Interrupt/SX127x_Receive_Interrupt.ino index 9db3eaf3..e3228970 100644 --- a/examples/SX127x/SX127x_Receive_Interrupt/SX127x_Receive_Interrupt.ino +++ b/examples/SX127x/SX127x_Receive_Interrupt/SX127x_Receive_Interrupt.ino @@ -85,6 +85,9 @@ volatile bool enableInterrupt = true; // 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) { // check if the interrupt is enabled if(!enableInterrupt) { diff --git a/examples/SX127x/SX127x_Transmit_Interrupt/SX127x_Transmit_Interrupt.ino b/examples/SX127x/SX127x_Transmit_Interrupt/SX127x_Transmit_Interrupt.ino index b218a0a7..f0fe3e8b 100644 --- a/examples/SX127x/SX127x_Transmit_Interrupt/SX127x_Transmit_Interrupt.ino +++ b/examples/SX127x/SX127x_Transmit_Interrupt/SX127x_Transmit_Interrupt.ino @@ -77,6 +77,9 @@ volatile bool enableInterrupt = true; // 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) { // check if the interrupt is enabled if(!enableInterrupt) {