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. | |
bool | Calculate (bool input) |
Applies the debouncer to the input stream. | |
constexpr void | SetDebounceTime (units::second_t time) |
Sets the time to debounce. | |
constexpr units::second_t | GetDebounceTime () const |
Gets the time to debounce. | |
constexpr void | SetDebounceType (DebounceType type) |
Set the debounce type. | |
constexpr DebounceType | GetDebounceType () const |
Get the debounce type. | |
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.
|
explicit |
Creates a new Debouncer.
debounceTime | The number of seconds the value must change from baseline for the filtered value to change. |
type | Which type of state change the debouncing will be performed on. |
bool frc::Debouncer::Calculate | ( | bool | input | ) |
Applies the debouncer to the input stream.
input | The current value of the input stream. |
|
inlineconstexpr |
Gets the time to debounce.
|
inlineconstexpr |
Get the debounce type.
|
inlineconstexpr |
Sets the time to debounce.
time | The number of seconds the value must change from baseline for the filtered value to change. |
|
inlineconstexpr |
Set the debounce type.
type | Which type of state change the debouncing will be performed on. |