A volatile flag is set in the WDT ISR to show that the WDT interrupt
happened. The flag is cleared in functions when not SLEEP_FOREVER
before the interrupt is enabled. When an interrupt awakens the CPU,
the flag is checked and the CPU put back to sleep if the WDT interrupt
was not the cause of the awakening. For the case of SLEEP_FOREVER,
the flag is set to "true" before the CPU is slept, and the functions
return when awakened by any interrupt.
A volatile flag is set in the WDT ISR to show that the WDT interrupt happened. The flag is cleared in functions when not SLEEP_FOREVER before the interrupt is enabled. When an interrupt awakens the CPU, the flag is checked and the CPU put back to sleep if the WDT interrupt was not the cause of the awakening. For the case of SLEEP_FOREVER, the flag is set to "true" before the CPU is slept, and the functions return when awakened by any interrupt.