WPILibC++ 2024.3.2
frc::Debouncer Class Reference

A simple debounce filter for boolean streams. More...

#include <frc/filter/Debouncer.h>

Public Types

enum  DebounceType { kRising , kFalling , kBoth }
 Type of debouncing to perform. More...
 

Public Member Functions

 Debouncer (units::second_t debounceTime, DebounceType type=DebounceType::kRising)
 Creates a new Debouncer. More...
 
bool Calculate (bool input)
 Applies the debouncer to the input stream. More...
 

Detailed Description

A simple debounce filter for boolean streams.

Requires that the boolean change value from baseline for a specified period of time before the filtered value changes.

Member Enumeration Documentation

◆ DebounceType

Type of debouncing to perform.

Enumerator
kRising 

Rising edge.

kFalling 

Falling edge.

kBoth 

Both rising and falling edges.

Constructor & Destructor Documentation

◆ Debouncer()

frc::Debouncer::Debouncer ( units::second_t  debounceTime,
DebounceType  type = DebounceType::kRising 
)
explicit

Creates a new Debouncer.

Parameters
debounceTimeThe number of seconds the value must change from baseline for the filtered value to change.
typeWhich type of state change the debouncing will be performed on.

Member Function Documentation

◆ Calculate()

bool frc::Debouncer::Calculate ( bool  input)

Applies the debouncer to the input stream.

Parameters
inputThe current value of the input stream.
Returns
The debounced value of the input stream.

The documentation for this class was generated from the following file: