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:
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.
Code: Select all
stm.mem32[stm.PWR + stm.PWR_CSR] |= 1 << 8 machine.deepsleep()
Thanks for the help everyone!