User manual
10
AVR1010
8267B-AVR-12/10
Note that the main loop of the application should be responsible for requesting the
sleep manager to put the device to sleep, as shown in Figure 4-1.
Figure 4-1: Suggested use of the sleep manager in main().
main()
Other initialization
and setup.
SLEEPMGR_Init()
Handle pending
data/events.
SLEEPMGR_Sleep()
Main loop
If an interrupt occurs while the sleep manager is about to put the device to sleep, it
will instantly wake up again and execute the corresponding ISR. Any update of the
locks must then occur in the ISR to ensure that the locks are set before the sleep
manager is requested to put the device to sleep again. A general example of an ISR
is shown in Figure 4-2.
Note that the sleep modes must also be unlocked when the firmware module is either
done with its task or it locks a different sleep mode.
Figure 4-2: Example use of the sleep manager in an ISR.
ISR
SLEEPMGR_Lock(SLEEPMGR_IDLE)
Initialize firmware
module.
reti()