improve sleep based on lamp switch and add parameterized enableWdt
This commit is contained in:
parent
0c29976404
commit
2a70b3a12e
@ -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()
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user