DEBOUNCE(9)

πŸ’– DEBOUNCE(9) πŸ’–

okay bestie, sit down, we're talking about debounce from the HAL Component manual, and honestly? she's iconic. she filters noisy digital inputs so your signal stops being a chaotic mess. periodt.


✨ NAME ✨

debounce β€” filter noisy digital inputs πŸŽ€


🌸 SYNOPSIS 🌸

loadrt debounce cfg=size[,size,...]

So the way this works: it creates debounce groups, and each group has however many filters you told it to have (that's the size). Every filter inside the same group shares the same sample rate and the same delay β€” they're all matching, it's giving coordinated friend group energy. 🫢

For example, cfg=2,3 creates two filter groups: the first group gets 2 filters, and the second group gets 3 filters. simple as that, no cap.


πŸ¦‹ NOTE πŸ¦‹

There's an alternate component named dbounce that does similar functionality but uses the conventional count= and names= parameters instead. and listen β€” with dbounce, the delay settings are implemented by a delay pin for each instance, instead of using filter groups. different vibe, same goal πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

The debounce filter works by incrementing a counter whenever the input is true, and decrementing the counter when it's false. like, the counter is the main character and the input is just... feeding it.

Here's the tea β˜•:

  • If the counter decrements to zero, the output is set false and the counter ignores any further decrements. she's done, she's not going lower, we respect the boundary.
  • If the counter increments up to a threshold, the output is set true and the counter ignores further increments. locked in. πŸ”’
  • If the counter is somewhere between zero and the threshold, the output just retains its previous state. no drama, no change.
  • The threshold determines the amount of filtering: a threshold of 1 does no filtering at all, and a threshold of N requires a signal to be present for N samples before the output changes state.

πŸ”₯ FUNCTIONS πŸ”₯

  • debounce.G β€” Sample all the input pins in group G and update the output pins. she's doing the whole group's homework in one go, efficient queen πŸ‘‘

🌈 PINS 🌈

  • debounce.G.F.in bit in β€” The F'th input pin in group G. the raw, noisy little gremlin coming in πŸ™ˆ
  • debounce.G.F.out bit out β€” The F'th output pin in group G. Reflects the last "stable" input seen on the corresponding input pin. this one's the calm, collected version ✨
  • debounce.G.delay signed rw β€” Sets the amount of filtering for all pins in group G. one setting, whole group, slay πŸ’…

aaaand that's the whole page bestie, you ate it πŸ“

this was brought to you by LinuxCNC Documentation, dated 2007-01-16 β€” yes she's an older icon but she still hits, no cap πŸ’–βœ¨