Most elegant way to Detect button press and switch actions with STM32L4 MCU
I have a need where, to execute certain action depending on duration of button press.
Example when press from 100ms : Play Song, 200ms : Next Song.
I want to know what is the smartest way to implement this so that the user experience is good in the context it's consistent throughout the program ?
The circuit connecting button to the IO is using a pull up 10k resistor so it also means i would need some debouching as well. The mcu is STM32L4 a