In my project, I need to know, which interrupt caused the wake up of MCU from VLPS to RUN. There are few actions I need to perform, based on source of the wake-up. Any input or direction would be a great help. Some of the source for interrupt are,
- GPIO interrupt
- RTC alarm/timer interrupt
- ADC interrupt
One straight forward option I can think of is, manage some flag in all interrupt handlers which will be reset to default value before entering to VLPS. As soon as any interrupt is triggered, MCU moves to RUN mode. For the first ISR call, update the source of that interrupt with the flag.
Later on, decision will be taken based in that flag. Is there any better/classic way to make it work ? may be some SDK API , MCU registers.
Thanks in advance.