WPILibC++ 2023.4.3-108-ge5452e3
frc::Debouncer Class Reference

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

#include <frc/filter/Debouncer.h>

Public Types

enum  DebounceType { kRising , kFalling , kBoth }
 

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

Enumerator
kRising 
kFalling 
kBoth 

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: