Page 2 of 2

Re: Pin IRQ Debounce Messing with REPL

Posted: Wed Apr 01, 2020 1:33 pm
by Duramaximizer
Finally got it working!

Made a new debounce routine using a timer, thank you for the suggestion jimmo!

I needed to wait for the user to press and release the button as I was getting bounce after the release also. After the debounce is handled it calls my function to put the board to sleep, first enabling the wake up on rising edge of PA0 pin using:

Code: Select all

stm.mem32[stm.PWR + stm.PWR_CSR] |= 1 << 8
machine.deepsleep()
The button is then used to wake up from deep sleep. Some delays in my main program prevent any bounce on the wake up press from putting the board back to sleep since the timer interrupt is not initialized until all initialization are complete and the main routine is running.

Thanks for the help everyone!