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

keyboard-fw: interrupts must be disabled while WDT parameters are set

parent d98a7cc4
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,10 @@ void keyboard_power_off(void)
// We can use the Watchdog timer to do this.
do {
// Setting WDT parameters must be done within 4 cycles of setting WDCE, so interrupts
// must be disabled.
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
......
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