Embedded Template Library 1.0
etl::private_debounce::debounce_base Class Reference

Public Types

typedef uint_least8_t flags_t
 
typedef uint16_t count_t
 

Public Member Functions

void add_sample (bool sample)
 
bool has_changed () const
 
bool is_set () const
 
bool is_held () const
 
bool is_repeating () const
 

Protected Types

enum  states {
  Off = 0 , On = 1 , Held = 2 , Repeating = 3 ,
  State = 0x03U , Sample = 4 , Change = 8
}
 

Protected Member Functions

 debounce_base (bool initial_state)
 Constructor.
 
 ~debounce_base ()
 Destructor.
 
void get_next (bool sample, bool condition_set, bool condition_clear, const uint_least8_t state_table[][2])
 Gets the next state based on the inputs.
 

Protected Attributes

flags_t flags
 
count_t count
 

Member Function Documentation

◆ add_sample()

void etl::private_debounce::debounce_base::add_sample ( bool  sample)
inline

Adds the new sample and clears the state change flag. If the sample has changed then the counter is reset. The last sample state is stored as a bit in the flags.

◆ has_changed()

bool etl::private_debounce::debounce_base::has_changed ( ) const
inline

Gets the current debouncer change state.

Returns
'true' if the debouncer has changed state.

◆ is_held()

bool etl::private_debounce::debounce_base::is_held ( ) const
inline

Gets the debouncer hold state.

Returns
'true' if the debouncer is in the hold state.

◆ is_repeating()

bool etl::private_debounce::debounce_base::is_repeating ( ) const
inline

Gets the debouncer repeat state.

Returns
'true' if the debouncer is repeating.

◆ is_set()

bool etl::private_debounce::debounce_base::is_set ( ) const
inline

Gets the current debouncer state.

Returns
'true' if the debouncer is in the true state.

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