@@ -18,7 +18,9 @@ class Button {
18
18
Button (uint8_t reqPin) : PIN(reqPin) {
19
19
pinMode (PIN, INPUT_PULLUP);
20
20
// Arduino C API:
21
- attachInterruptArg (PIN, [](void * self) { static_cast <Button *>(self)->isr (); }, this , FALLING); // works on ESP32; fails on ESP8266: "ISR not in IRAM"
21
+ attachInterruptArg (PIN, [](void * self) {
22
+ static_cast <Button *>(self)->isr ();
23
+ }, this , FALLING); // works on ESP32; fails on ESP8266: "ISR not in IRAM"
22
24
// attachInterruptArg(PIN, reinterpret_cast<void(*)(void*)>(&isr_static), this, FALLING); // works on ESP32; works on ESP8266
23
25
// FunctionalInterrupts API:
24
26
// attachInterrupt(PIN, [this]() { isr(); }, FALLING); // works on ESP32; works on ESP8266
@@ -44,7 +46,7 @@ class Button {
44
46
static void IRAM_ATTR isr_static (Button* const self)
45
47
#endif
46
48
{
47
- self->isr ();
49
+ self->isr ();
48
50
}
49
51
50
52
void checkPressed () {
@@ -66,7 +68,9 @@ Button* button2;
66
68
67
69
void setup () {
68
70
Serial.begin (115200 );
69
- schedule_function ([]() { Serial.println (" Scheduled function" ); });
71
+ schedule_function ([]() {
72
+ Serial.println (" Scheduled function" );
73
+ });
70
74
Serial.println (" FunctionalInterrupt test/example" );
71
75
72
76
button1 = new Button (BUTTON1);
0 commit comments