This simple example shows how to use the Sleep manager.
The sleep manager API can be found here.
All SAM4L series devices can be used. The example can be applied on:
The device is put to sleep in sleep modes with increasing "depth", and is periodically woken up by the AST or asynchronously by an external interrupt for the modes which also disable the RTC. The device will remain in ACTIVE mode for approximately 3 seconds after wake- up, before it goes to sleep in the next mode.
The AST wakes the CPU every 4 seconds. If the device remains in sleep (LED turned off), the device has gone into a too deep sleep mode for the AST to operate (in the case of this example, the chosen source clock for the AST is the RCOSC and the RCOSC is stopped in the WAIT/RET sleep mode). In that case, the user must wake the device up by applying a low-level on the external interrupt pin, e.g., by pushing a button connected to the pin (WAKE_BUTTON_EIC_PIN).
A pin (LED_ACTIVITY_STATUS_PIN) with, e.g., a LED connected is driven low when the device is active and driven high when the device is sleeping.
This software was written for the GNU GCC and IAR. Other compilers may or may not work.
For further information, visit Microchip.
Support and FAQ: https://www.microchip.com/support/