This commit is contained in:
2026-08-31 23:12:28 -04:00
parent 2152b8f727
commit 089be9564b
13 changed files with 147 additions and 39 deletions
+5 -3
View File
@@ -56,9 +56,11 @@ void wdt_isr_enable(void)
MCUSR &= ~(1 << WDRF);
WDTCSR = (1 << WDCE) | (1 << WDE);
// WDP[3:0] = 0b011 -> 0.125 s. Interrupt mode only (WDE clear), so an
// expiry wakes us to clear the debounce instead of resetting the part.
WDTCSR = (1 << WDIE) | (1 << WDP1) | (1 << WDP0);
// WDP[3:0] = 0b010 -> 64 ms debounce, capping the count at ~15 rev/s;
// a reed contact settles in a few ms, so this is generous. Interrupt mode
// only (WDE clear): an expiry wakes us to clear the debounce instead of
// resetting the part.
WDTCSR = (1 << WDIE) | (1 << WDP1);
SREG = sreg; // Restore, never blanket-sei(): these run inside an ISR
}