committed by
Olivier
parent
aac4562ab0
commit
bffc87fe93
+7
-2
@@ -66,6 +66,11 @@ inline bool interruptWakeUp()
|
|||||||
return _wokeUpByInterrupt != INVALID_INTERRUPT_NUM;
|
return _wokeUpByInterrupt != INVALID_INTERRUPT_NUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearPendingInterrupt(const uint8_t interrupt)
|
||||||
|
{
|
||||||
|
EIFR = _BV(interrupt);
|
||||||
|
}
|
||||||
|
|
||||||
// Watchdog Timer interrupt service routine. This routine is required
|
// Watchdog Timer interrupt service routine. This routine is required
|
||||||
// to allow automatic WDIF and WDIE bit clearance in hardware.
|
// to allow automatic WDIF and WDIE bit clearance in hardware.
|
||||||
ISR (WDT_vect)
|
ISR (WDT_vect)
|
||||||
@@ -163,11 +168,11 @@ int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mo
|
|||||||
// to prevent waking immediately again.
|
// to prevent waking immediately again.
|
||||||
// Ref: https://forum.arduino.cc/index.php?topic=59217.0
|
// Ref: https://forum.arduino.cc/index.php?topic=59217.0
|
||||||
if (interrupt1 != INVALID_INTERRUPT_NUM) {
|
if (interrupt1 != INVALID_INTERRUPT_NUM) {
|
||||||
EIFR = _BV(interrupt1 == 0 ? INTF0 : INTF1);
|
clearPendingInterrupt(interrupt1);
|
||||||
attachInterrupt(interrupt1, wakeUp1, mode1);
|
attachInterrupt(interrupt1, wakeUp1, mode1);
|
||||||
}
|
}
|
||||||
if (interrupt2 != INVALID_INTERRUPT_NUM) {
|
if (interrupt2 != INVALID_INTERRUPT_NUM) {
|
||||||
EIFR = _BV(interrupt2 == 0 ? INTF0 : INTF1);
|
clearPendingInterrupt(interrupt2);
|
||||||
attachInterrupt(interrupt2, wakeUp2, mode2);
|
attachInterrupt(interrupt2, wakeUp2, mode2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user