improve sleep based on lamp switch and add parameterized enableWdt

This commit is contained in:
Nicu Hodos 2017-01-29 20:23:29 +01:00
parent 0c29976404
commit 2a70b3a12e

View File

@ -22,18 +22,26 @@ public:
adc_disable();
sleep_enable(); // Sets the Sleep Enable bit in the MCUCR Register (SE BIT)
sleep_bod_disable();
sei(); // Enable interrupts
sleep_cpu(); // sleep
sleep_disable(); // Clear SE bit
cli(); // Disable interrupts
PCMSK &= ~_BV(PCINT0); // Turn off PB0 as interrupt pin
sleep_disable(); // Clear SE bit
adc_enable();
sei(); // Enable interrupts
}
static void enableWdt(byte time)
{
MCUSR = 0x00;
WDTCR |= _BV(WDCE) | _BV(WDE);
WDTCR = _BV(WDIE) | time;
}
//enable the wdt for 8sec interrupt
static void enableWdt()
{