2022-Robot
Robot code for 2022 FRC Season by Argos, FRC team #1756
Loading...
Searching...
No Matches
argos_lib::Debouncer Class Reference

#include <debouncer.h>

Public Member Functions

 Debouncer (const argos_lib::DebounceSettings debounceSettings, bool initialValue=false)
 Construct a new Debouncer object with asymmetric times. More...
 
 Debouncer (const units::millisecond_t symmetricDebounceTime)
 Construct a new Debouncer object with symmetric times. More...
 
bool operator() (bool newVal)
 Update debouncer with new input and retreive latest debounced status. More...
 
void Reset (bool newVal)
 Resets debouncer to a known status like at construction. More...
 

Private Attributes

argos_lib::DebounceSettings m_debounceSettings
 Configuration for asymmetric debouncer. More...
 
bool m_rawStatus
 Last raw value. More...
 
bool m_debouncedStatus
 Current value after applying debounce. More...
 
std::chrono::time_point< std::chrono::steady_clock > m_debounceTransitionTime
 Time when latest transition detected. More...
 

Constructor & Destructor Documentation

◆ Debouncer() [1/2]

Debouncer::Debouncer ( const argos_lib::DebounceSettings  debounceSettings,
bool  initialValue = false 
)
explicit

Construct a new Debouncer object with asymmetric times.

Parameters
debounceSettingsConfiguration settings for activate and clear times
initialValueInitializes debouncer to this value

◆ Debouncer() [2/2]

Debouncer::Debouncer ( const units::millisecond_t  symmetricDebounceTime)
explicit

Construct a new Debouncer object with symmetric times.

Parameters
symmetricDebounceTimeSymmetric activate and clear time

Member Function Documentation

◆ operator()()

bool Debouncer::operator() ( bool  newVal)

Update debouncer with new input and retreive latest debounced status.

Parameters
newValLatest raw value
Returns
Value after applying debounce

◆ Reset()

void Debouncer::Reset ( bool  newVal)

Resets debouncer to a known status like at construction.

Parameters
newValValue to set to

Member Data Documentation

◆ m_debouncedStatus

bool argos_lib::Debouncer::m_debouncedStatus
private

Current value after applying debounce.

◆ m_debounceSettings

argos_lib::DebounceSettings argos_lib::Debouncer::m_debounceSettings
private

Configuration for asymmetric debouncer.

◆ m_debounceTransitionTime

std::chrono::time_point<std::chrono::steady_clock> argos_lib::Debouncer::m_debounceTransitionTime
private

Time when latest transition detected.

◆ m_rawStatus

bool argos_lib::Debouncer::m_rawStatus
private

Last raw value.


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