Routines for handling buttons done the right way :)
If you ever struggled with handling buttons in your MCU project - struggle no more. Here is a good example of button routines for STM32 microcontrollers coded with HAL and LL in CubeMX IDE.
No interrupt nor lame 20ms delay "debounce".
- pressing button
- pressing and releasing button
If you're short on space on PCB, you can use internall pull-up for button and ommit external resistors.
- F103_Buttons_HAL - example with HAL library made on popular "bluepill" STM32F103;
- F103_Buttons_LL - example with LL library made on popular "bluepill" STM32F103;
- HAL - source and header files made with HAL;
- LL - source and header files made with LL;