[SX127x] Added ESP8266/ESP32 IRAM attribute

This commit is contained in:
jgromes 2021-12-29 08:49:14 +01:00
parent bb2cf12c8d
commit 5cb5836ed8
3 changed files with 13 additions and 4 deletions

View file

@ -79,6 +79,9 @@ volatile bool enableInterrupt = true;
// is detected within timeout period // is detected within timeout period
// IMPORTANT: this function MUST be 'void' type // IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments! // and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlagTimeout(void) { void setFlagTimeout(void) {
// check if the interrupt is enabled // check if the interrupt is enabled
if(!enableInterrupt) { if(!enableInterrupt) {
@ -115,14 +118,14 @@ void loop() {
// LoRa preamble was detected // LoRa preamble was detected
Serial.print(F("[SX1278] Preamble detected!")); Serial.print(F("[SX1278] Preamble detected!"));
} }
// check if we need to restart channel activity detection // check if we need to restart channel activity detection
if(detectedFlag || timeoutFlag) { if(detectedFlag || timeoutFlag) {
// start scanning the channel // start scanning the channel
Serial.print(F("[SX1278] Starting scan for LoRa preamble ... ")); Serial.print(F("[SX1278] Starting scan for LoRa preamble ... "));
// start scanning current channel // start scanning current channel
int state = radio.startChannelScan(); int state = radio.startChannelScan();
if (state == RADIOLIB_ERR_NONE) { if (state == RADIOLIB_ERR_NONE) {
@ -131,6 +134,6 @@ void loop() {
Serial.print(F("failed, code ")); Serial.print(F("failed, code "));
Serial.println(state); Serial.println(state);
} }
} }
} }

View file

@ -85,6 +85,9 @@ volatile bool enableInterrupt = true;
// is received by the module // is received by the module
// IMPORTANT: this function MUST be 'void' type // IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments! // and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) { void setFlag(void) {
// check if the interrupt is enabled // check if the interrupt is enabled
if(!enableInterrupt) { if(!enableInterrupt) {

View file

@ -77,6 +77,9 @@ volatile bool enableInterrupt = true;
// is transmitted by the module // is transmitted by the module
// IMPORTANT: this function MUST be 'void' type // IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments! // and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) { void setFlag(void) {
// check if the interrupt is enabled // check if the interrupt is enabled
if(!enableInterrupt) { if(!enableInterrupt) {