Skip to content

Commit ca748fe

Browse files
authored
Use IRAM_ATTR in place of ICACHE_RAM_ATTR (with backward compatibility) (#46)
1 parent ca8eda9 commit ca748fe

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

examples/OpenThermGatewayMonitor_Demo/OpenThermGatewayMonitor_Demo.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ const int sOutPin = 5; //for Arduino, 13 for ESP8266 (D7), 23 for ESP32
1818
OpenTherm mOT(mInPin, mOutPin);
1919
OpenTherm sOT(sInPin, sOutPin, true);
2020

21-
void ICACHE_RAM_ATTR mHandleInterrupt() {
21+
void IRAM_ATTR mHandleInterrupt() {
2222
mOT.handleInterrupt();
2323
}
2424

25-
void ICACHE_RAM_ATTR sHandleInterrupt() {
25+
void IRAM_ATTR sHandleInterrupt() {
2626
sOT.handleInterrupt();
2727
}
2828

examples/OpenThermMaster_Demo/OpenThermMaster_Demo.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const int inPin = 2; //for Arduino, 4 for ESP8266 (D2), 21 for ESP32
2727
const int outPin = 3; //for Arduino, 5 for ESP8266 (D1), 22 for ESP32
2828
OpenTherm ot(inPin, outPin);
2929

30-
void ICACHE_RAM_ATTR handleInterrupt() {
30+
void IRAM_ATTR handleInterrupt() {
3131
ot.handleInterrupt();
3232
}
3333

@@ -78,4 +78,4 @@ void loop()
7878

7979
Serial.println();
8080
delay(1000);
81-
}
81+
}

examples/OpenThermSlave_Demo/OpenThermSlave_Demo.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const int inPin = 2; //for Arduino, 12 for ESP8266 (D6), 19 for ESP32
1212
const int outPin = 3; //for Arduino, 13 for ESP8266 (D7), 23 for ESP32
1313
OpenTherm ot(inPin, outPin, true);
1414

15-
void ICACHE_RAM_ATTR handleInterrupt() {
15+
void IRAM_ATTR handleInterrupt() {
1616
ot.handleInterrupt();
1717
}
1818

src/OpenTherm.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ void OpenTherm::begin(void(*handleInterruptCallback)(void))
3636
begin(handleInterruptCallback, NULL);
3737
}
3838

39-
bool ICACHE_RAM_ATTR OpenTherm::isReady()
39+
bool IRAM_ATTR OpenTherm::isReady()
4040
{
4141
return status == OpenThermStatus::READY;
4242
}
4343

44-
int ICACHE_RAM_ATTR OpenTherm::readState() {
44+
int IRAM_ATTR OpenTherm::readState() {
4545
return digitalRead(inPin);
4646
}
4747

@@ -127,7 +127,7 @@ OpenThermResponseStatus OpenTherm::getLastResponseStatus()
127127
return responseStatus;
128128
}
129129

130-
void ICACHE_RAM_ATTR OpenTherm::handleInterrupt()
130+
void IRAM_ATTR OpenTherm::handleInterrupt()
131131
{
132132
if (isReady())
133133
{

src/OpenTherm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,8 @@ class OpenTherm
188188
#define ICACHE_RAM_ATTR
189189
#endif
190190

191+
#ifndef IRAM_ATTR
192+
#define IRAM_ATTR ICACHE_RAM_ATTR
193+
#endif
194+
191195
#endif // OpenTherm_h

0 commit comments

Comments
 (0)