Skip to content

Commit d58b22d

Browse files
committed
Fixed attachInterrupt() for use during sleep
1 parent 8a95c1e commit d58b22d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cores/arduino/WInterrupts.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
6666
enabled = 1;
6767
}
6868

69+
// Enable wakeup capability on pin in case being used during sleep
70+
EIC->WAKEUP.reg |= (1 << in);
71+
6972
// Assign pin to EIC
7073
pinPeripheral(pin, PIO_EXTINT);
7174

@@ -118,6 +121,9 @@ void detachInterrupt(uint32_t pin)
118121
return;
119122

120123
EIC->INTENCLR.reg = EIC_INTENCLR_EXTINT(1 << in);
124+
125+
// Disable wakeup capability on pin during sleep
126+
EIC->WAKEUP.reg &= ~(1 << in);
121127
}
122128

123129
/*

0 commit comments

Comments
 (0)