Low-power utility code using the Watchdog Timer (WDT). More...
#include <Ports.h>
Static Public Member Functions | |
| static void | watchdogInterrupts (char mode) |
| start the watchdog timer (or disable it if mode < 0) More... | |
| static void | powerDown () |
| enter low-power mode, wake up with watchdog, INT0/1, or pin-change More... | |
| static byte | loseSomeTime (word msecs) |
| Spend some time in low-power mode, the timing is only approximate. More... | |
| static void | watchdogEvent () |
| This must be called from your watchdog interrupt code. | |
Low-power utility code using the Watchdog Timer (WDT).
Requires a WDT interrupt handler, e.g. EMPTY_INTERRUPT(WDT_vect);
|
static |
Spend some time in low-power mode, the timing is only approximate.
| msecs | Number of milliseconds to sleep, in range 0..65535. |
ISR(WDT_vect) { Sleepy::watchdogEvent(); }
This will get called when the watchdog fires.
|
static |
enter low-power mode, wake up with watchdog, INT0/1, or pin-change
Take the ATmega into the deepest possible power down state.
Getting out of this state requires setting up the watchdog beforehand, or making sure that suitable interrupts will occur once powered down. Disables the Brown Out Detector (BOD), the A/D converter (ADC), and other peripheral functions such as TWI, SPI, and UART before sleeping, and restores their previous state when back up.
|
static |
start the watchdog timer (or disable it if mode < 0)
| mode | Enable watchdog trigger after "16 << mode" milliseconds (mode 0..9), or disable it (mode < 0). |
ISR(WDT_vect) { Sleepy::watchdogEvent(); }
This will get called when the watchdog fires.