Is there some mechanism through which an interrupt service routine can detect that the CPU was in a low power mode at the time of the interrupt?
In my application, the CPU spends as much time as possible in LPM3. Some of my interrupts are simply indicators that an event has occurred that should be processed in active mode; not in the interrupt service routine. Using IAR 4.20 C++, I use the intrinsic __low_power_mode_3 () to enter low power mode and within the interrupt service routines I use __low_power_mode_off_on_exit () when I need to return the CPU to active mode.
The problem is that I should not use __low_power_mode_off_on_exit () if the CPU was not in LPM3 when the interrupt occurred. I can think of no safe way to to make this determination unless the CPU itself sets a flag bit somewhere.
Has anyone worked out a solution to this problem?