This simple example shows how to use the Sleep manager.
The sleep manager API can be found here.
All AVR XMEGA devices with an RTC and two free I/O pins can be used. The example has been tested on the Xplain board.
This example puts the device to sleep in sleep modes with increasing "depth" and utilizes the RTC and a pin change interrupt to wake it up again.
The device will remain in ACTIVE mode for approximately 3 seconds after wake- up, before it goes to sleep in the next mode.
The RTC overflows after 1.5 seconds, and will then wake the device up. If the device remains in sleep for longer (LED turned off), the device has been put in a too deep sleep mode for the RTC to operate. When this occurs, the user must wake the device up by means of the pin change interrupt (BUTTON_PIN).
A pin (LED_PIN) with, e.g., an on-board LED connected, is driven low to indicate when the device is active. The pin is driven high while the device is in sleep.
This software was written for the GNU GCC and IAR for AVR. Other compilers may or may not work.
For further information, visit Microchip.