OpenMPTL - Helper Library
C++ Microprocessor Template Library
Public Member Functions | List of all members
debouncer< T, poll_func, time_func, time_freq, wait_time_ms > Class Template Reference

Debounce a value on a given time base. More...

#include <debouncer.hpp>

Public Member Functions

 debouncer (T _value)
 
bool poll (void)
 Feed debouncer with a new value. More...
 
get (void) const
 
 operator T () const
 

Detailed Description

template<typename T, T(*)(void) poll_func, unsigned(*)(void) time_func, unsigned int time_freq, unsigned wait_time_ms = 50>
class debouncer< T, poll_func, time_func, time_freq, wait_time_ms >

NOTE: time_func() must return a growing value!

Constructor & Destructor Documentation

◆ debouncer()

template<typename T , T(*)(void) poll_func, unsigned(*)(void) time_func, unsigned int time_freq, unsigned wait_time_ms = 50>
debouncer< T, poll_func, time_func, time_freq, wait_time_ms >::debouncer ( _value)
inline

Member Function Documentation

◆ get()

template<typename T , T(*)(void) poll_func, unsigned(*)(void) time_func, unsigned int time_freq, unsigned wait_time_ms = 50>
T debouncer< T, poll_func, time_func, time_freq, wait_time_ms >::get ( void  ) const
inline

◆ operator T()

template<typename T , T(*)(void) poll_func, unsigned(*)(void) time_func, unsigned int time_freq, unsigned wait_time_ms = 50>
debouncer< T, poll_func, time_func, time_freq, wait_time_ms >::operator T ( ) const
inline

◆ poll()

template<typename T , T(*)(void) poll_func, unsigned(*)(void) time_func, unsigned int time_freq, unsigned wait_time_ms = 50>
bool debouncer< T, poll_func, time_func, time_freq, wait_time_ms >::poll ( void  )
inline

Returns true if the value has changed.


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