Skip to content

Commit 319c26f

Browse files
committed
MCU8MASS-852 Set flag for SW0 pressed to be volatile
1 parent 3b2719d commit 319c26f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/power_down/power_down.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
#define SW0 PIN_PD2
1515

16-
static bool woke_up_from_button = false;
16+
static volatile bool woke_up_from_button = false;
1717

1818
void button_pressed_callback(void) {
1919
if (PORTD.INTFLAGS & PIN2_bm) {
20-
// Reset the interupt flag so that we can process the next incoming
20+
// Reset the interrupt flag so that we can process the next incoming
2121
// interrupt
2222
PORTD.INTFLAGS = PIN2_bm;
2323

@@ -62,7 +62,7 @@ void loop() {
6262
LowPower.powerDown(60);
6363

6464
if (woke_up_from_button) {
65-
Log.info("Button was pressed");
65+
Log.info("SW0 was pressed");
6666
woke_up_from_button = false;
6767
}
6868

examples/power_save/power_save.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414

1515
#define SW0 PIN_PD2
1616

17-
static bool woke_up_from_button = false;
17+
static volatile bool woke_up_from_button = false;
1818

1919
void button_pressed_callback(void) {
2020
if (PORTD.INTFLAGS & PIN2_bm) {
21-
// Reset the interupt flag so that we can process the next incoming
21+
// Reset the interrupt flag so that we can process the next incoming
2222
// interrupt
2323
PORTD.INTFLAGS = PIN2_bm;
2424

@@ -90,7 +90,7 @@ void loop() {
9090
LowPower.powerSave();
9191

9292
if (woke_up_from_button) {
93-
Log.info("Button was pressed");
93+
Log.info("SW0 was pressed");
9494
woke_up_from_button = false;
9595
}
9696

0 commit comments

Comments
 (0)