fix enableWdt

This commit is contained in:
Nicu Hodos 2018-07-15 23:55:49 +02:00
parent 8c8ea27753
commit 534039dc08

View File

@ -36,16 +36,19 @@ public:
sei(); // Enable interrupts
}
static void enableWdt(byte time)
{
static void enableWdt(byte time) {
cli();
MCUSR = 0x00;
WDTCR |= _BV(WDCE) | _BV(WDE);
WDTCR = _BV(WDIE) | time;
WDTCR = _BV(WDIE) | (time & 0x08 ? _WD_PS3_MASK : 0x00) | (time & 0x07);
sei();
}
static void disableWdt() {
cli();
MCUSR = 0x00;
WDTCR |= _BV(WDCE) | _BV(WDE);
WDTCR = 0x00;
sei();
}
};