SLAU533D September 2013 – April 2017
When emulating the code, if the device is sleeping, main() execution is seen resting at the LPM0 entry. The demo application can then exit LPM0 and resume execution in response to three different events:
USB events are like software callbacks, functions called by the USB interrupt service routine (ISR) that the application can choose to service. These handlers are in the file usbEventHandling.c. If the event handler returns TRUE, the CPU remains awake after the USB ISR returns; this causes execution to resume from the point of LPM0 entry, if it had been sleeping there. (If it had not been sleeping, then the resumption has no effect.)
The last event that can wake the CPU out of LPM0 is a pushbutton press. This generates an I/O port interrupt, and the port ISR in hal.c is executed. It includes an intrinsic function __bic_SR_register_on_exit(LPM3_bits); this causes execution to resume from the point of LPM0 entry, if it had been sleeping there. Again, if it had not been sleeping, this resumption has no effect.