2019-11-10 07:10 AM
i am new in stm32 . i am using stm32lo31 series nucleo board . i want to read push button press timing so i am using polling method to detect read button press event. then i want time between press event to release. how can i configure systick to read time between that .i tried so many online questions and answers but i can't find proper answer in detail in HAL library.
2019-11-10 07:59 AM
Would SysTick be managed by CMSIS functions? You could read the count directly also. 24-bit down-count so will need to factor that into your delta computation.
2019-11-10 09:55 AM
Buttons... deboucing, glitches, etc..
I would set a ram flag in systick interrupt every 50 msec.
In the main loop, once the flag is set, I check the pin level and if pressed, increment a KeyPressedTime_50msec or clear it.
Debounce? Counter must reach 3 to key pressed. Key repetition press events, Hot key event after pressing for more than 5 seconds, etc... can be done through this polling counter. For waking up the MCU from low power mode, select a EXTI or WAKEUP pin as button press signal.
Set the flag in interrupt, wait for it in the main loop and clear it once its purpose is done.