27 bool Watchdog::s_initiated =
false;
30 uint32_t Watchdog::s_millis = 0L;
31 uint16_t Watchdog::s_ms_per_tick = 16;
40 Watchdog::as_prescale(uint16_t ms)
43 uint8_t prescale = log2<uint16_t>((ms + 8) >> 5);
44 if (
UNLIKELY(prescale > 9)) prescale = 9;
52 uint8_t prescale = as_prescale(ms);
55 uint8_t config = _BV(WDIE) | (prescale & 0x07);
56 if (prescale > 0x07) config |= _BV(WDP3);
62 WDTCSR = _BV(WDCE) | _BV(WDE);
67 s_ms_per_tick = (1 << (prescale + 4));
76 ms += s_ms_per_tick / 2;
83 Watchdog::s_millis += Watchdog::s_ms_per_tick;
86 if (Watchdog::s_scheduler !=
NULL)
90 if (Watchdog::s_clock !=
NULL)
91 Watchdog::s_clock->
tick(Watchdog::s_ms_per_tick);
static uint32_t since(uint32_t start)
friend void WDT_vect(void)
static void begin(uint16_t ms=16)
static void delay(uint32_t ms)