Wake Up on Comparator Interrupt | Cypress Semiconductor
Wake Up on Comparator Interrupt
I am very new to programming microcontrollers, and I have a few questions about the best way to solve a problem.
I want to wake up from Alternate Active Mode whenever a comparator threshold is reached. I then want to stay awake and do some stuff, then go back in Alternative Active Mode when I am done. Right now, the way I am trying to acomplish this is following:
1. Receive Interupt from Comparator
2. Call Comparator_Disable_Interupt() from Comparator in-side of the ISR assoicated with the Comparrator output.
3. Do Stuff
4. Prepare for AA, call Comparator_Enable_Interupt() from main routine.
5. Go into AA sensitive to ISR from Comparator
The problem that I am running into is what if step 4 completes, and then I receive an interrupt from the comparator and it calls Comparator_Disable_Interrupt() from its ISR, and then I go to AA. Would that not put me in a state were I could not be pulled back out of AA mode? What is the best way to go into AA, and wait for an interupt from a comparator?