cancel
Showing results for 
Search instead for 
Did you mean: 

how to implement 5s key press wakeup under stop mode?

David.Cheng
Associate II
 
5 REPLIES 5
JoniS
Senior

Wake up from the keypress and continue sampling the button state if it's long enought high/low , wake up else go back to sleep after the button is released.​

it seems that it will wakeup until key released for stm8, what if stm32?

Then it's configured to detect and wakeup on wrong edge of signal (rising/falling), or if not possible to configure such option you need to modify the hardware.​

wakeup edge of signal (rising/falling) is exit edge? or i have to write time detect in interrupt handler

What I mean your button is either grounding when pressed or pulling up to 3.3v/5v when pressed, if the button is grounding, then you need to detect falling edge of the signal to wake up, if the button is pulling high you need to detect ​rising edge of the signal.

And yes after wake up from initial pressing of the button you need to run timer or some code which samples the ​button state, so you then know if the button was pressed for 5 seconds or released quicker, I don't think there is any other way.