Skip to content

art-of-electronics/stm32_button_routines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

stm32_button_routines

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 in CubeIDE.

No interrupt nor lame 20ms delay "debounce".

The code includes non-blocking routines for following button events:

  • pressing button
  • pressing and releasing button

Use as many buttons as you wish, as long as you have enough GPIO_Inputs in your MCU!

Schematic for connecting button (and LED)

If you're short on space on PCB, you can use internall pull-up for button and ommit external resistors.

To do:

  • long / short press detection
  • multiple pressing detection

About

Routines for handling buttons done the right way :)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages