Driver for button

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
sdalu
Posts: 35
Joined: Wed Dec 30, 2015 5:31 pm
Has thanked: 1 time
Been thanked: 2 times

Re: Driver for button

Post by sdalu »

I'm no expert at embedded system, so when I wrote my little code I googled a lot, and found this docummentation about debouncing:
http://www.eng.utah.edu/~cs5780/debouncing.pdf
At page 6, it seemed to me that using an interrupt was not a good idea, and I went for the easy way of a virtual timer kicking at fixed interval.

The ASCII / keyboard analogy scares me a little, the sub system should be able to generate (if requested) click / dblclick / (tripleclick) / longhold / (verylonghold) / release events. That would make it for common usecase where you want a small system and can only afford one or two buttons. These buttons could be made from capacitive sensing subsystem, so I like the readButtonState(size_t N) to delegate reading to a spefic function.
Post Reply