Skip to content
Snippets Groups Projects
Commit d33ac3ee authored by Kevin Pulo's avatar Kevin Pulo
Browse files

keyboard-fw: use interrupt-only WDT mode, not interrupt-and-reset

parent 77defa18
No related branches found
No related tags found
No related merge requests found
......@@ -54,8 +54,14 @@ void keyboard_power_off(void)
cli();
wdt_reset();
WDTCSR = (1<<WDCE) | (1<<WDE); // Enable writes to watchdog
WDTCSR = (1<<WDIE) | (1<<WDE) | (0<<WDP3) | (1<<WDP2) | (1<<WDP1) | (0<<WDP0); // Interrupt mode, 1s timeout
// Enable writes to watchdog, then set interrupt-only mode, 1s timeout.
// (Interrupt-only mode is preferred to interrupt-and-reset mode, because
// the latter has the risk of WDT-induced bootloops if the bootloader doesn't
// correctly handle WDT resets. Whereas we have a physical reset button, if
// a hard reset is actually needed.)
WDTCSR = (1<<WDCE) | (1<<WDE);
WDTCSR = (1<<WDIE) | (0<<WDE) | (0<<WDP3) | (1<<WDP2) | (1<<WDP1) | (0<<WDP0);
// Enter Power-save mode
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment