WDIE must be automatically cleared only in "Interrupt and System
Reset Mode" (where it's used to transition to "System Reset Mode").
In other modes, watchdog interrupt must not clear WDIE.
Strictly speaking, the modified condition also clears it in
"System Reset Mode" as well, but the system is reset on
interrupt anyway, so it doesn't matter.
See #456
* again when cleared (after servicing), value = 0
*/
- if (!value && avr_regbit_get(avr, p->watchdog.raised)) {
+ if (!value && avr_regbit_get(avr, p->watchdog.raised) && avr_regbit_get(avr, p->wde)) {
avr_regbit_clear(avr, p->watchdog.enable);
}
}