2023-Robot
Robot code for 2023 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.
 
 Debouncer (const units::millisecond_t symmetricDebounceTime)
 Construct a new Debouncer object with symmetric times.
 
bool operator() (bool newVal)
 Update debouncer with new input and retreive latest debounced status.
 
void Reset (bool newVal)
 Resets debouncer to a known status like at construction.
 

Private Attributes

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

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: