debounce − filter noisy digital inputs |
loadrt debounce [cfg=size[,size,...]] Creates filter groups each with the given number of filters (size). Each filter group has the same sample rate and delay. |
The debounce filter works by incrementing a counter whenever the input is true, and decrementing the counter when it is false. If the counter decrements to zero, the output is set false and the counter ignores further decrements. If the counter increments up to a threshold, the output is set true and the counter ignores further increments. If the counter is between zero and the threshold, the output retains its previous state. 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. |
debounce.G |
Sample all the input pins in group G and update the output pins. |
debounce.G.F.in bit in |
The F’th input pin in group G. |
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. |
debounce.G.delay signed rw |
Sets the amount of filtering for all pins in group G. |