Button debouncing #166
Unanswered
trappitsch
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have been playing around with the
teensy4
in Rust and really enjoy the bsp, thanks @mciantyre!Hooking up a button and using it to drive a counter via a hardware interrupt, I can't find any good way of debouncing the button easily. Is this something that is currently implemented and I just haven't found it yet / am I missing something here?
I have played with using a gpt for this and have thought about using the srtc for it too. A non-blocking debouncing routine for RTIC is not too complicated, however, it is kind of clunky... Here's my current playground approach.
In brief, the following lines describe the button and the debounce with a bunch of shared resources:
The full code mentioned above also has some logging over USB in it to make testing a bit easier.
Anyway, if anybody has a better/different/cooler approach, I'd be very happy :) Thanks so much!
Beta Was this translation helpful? Give feedback.
All reactions