Skip to content

Commit 71b8720

Browse files
authored
fix(example): uses volatile data type also for the pointers
1 parent 51ff9fc commit 71b8720

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libraries/ESP32/examples/GPIO/FunctionalInterruptLambda/FunctionalInterruptLambda.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ void setup() {
184184
Serial.println("Setting up Example 2: Lambda with pointer captures");
185185

186186
// Create pointers to avoid capturing static/global variables directly
187-
uint32_t* totalInterruptsPtr = &totalInterrupts;
188-
unsigned long* lastInterruptTimePtr = &lastInterruptTime;
187+
volatile uint32_t* totalInterruptsPtr = &totalInterrupts;
188+
volatile unsigned long* lastInterruptTimePtr = &lastInterruptTime;
189189
volatile bool* ledStatePtr = &ledState;
190190
volatile bool* ledStateChangedPtr = &ledStateChanged;
191191
volatile unsigned long* lastButton2TimePtr = &lastButton2InterruptTime;

0 commit comments

Comments
 (0)