Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
debounce< VALID_COUNT, HOLD_COUNT, REPEAT_COUNT > Class Template Reference
A class to debounce signals. More...
#include <debounce.h>
Inherits etl::__private_debounce__::debounce_base.
Public Member Functions | |
debounce (bool initial_state=false) | |
Constructor. | |
bool | add (bool sample) |
Adds a new sample. | |
bool | has_changed () const |
Gets the current debouncer change state. | |
bool | is_set () const |
Gets the current debouncer state. | |
bool | is_held () const |
Gets the debouncer hold state. | |
bool | is_repeating () const |
Gets the debouncer repeat state. | |
Protected Attributes | |
uint16_t | count |
The state count. |
Detailed Description
template<const uint16_t VALID_COUNT = 0, const uint16_t HOLD_COUNT = 0, const uint16_t REPEAT_COUNT = 0>
class etl::debounce< VALID_COUNT, HOLD_COUNT, REPEAT_COUNT >
A class to debounce signals.
The state is decided over N samples, defined by the VALID_COUNT value. If the samples are consistent for VALID_COUNT times then the debouncer state is defined. If the samples change then the debouncer will change state after VALID_COUNT samples. If the samples are true for a count of HOLD_COUNT then the debouncer input is 'held'. The debouncer may be constructed in either state.
Definition at line 136 of file debounce.h.
Constructor & Destructor Documentation
debounce | ( | bool | initial_state = false ) |
Constructor.
- Parameters:
-
initial_state The initial state. Default = false.
Definition at line 155 of file debounce.h.
Member Function Documentation
bool add | ( | bool | sample ) |
Adds a new sample.
Returns 'true' if the debouncer changes state from... 1. Clear to Set. 2. Set to Clear. 3. Not Held to Held. 4. Key repeats.
- Parameters:
-
sample The new sample.
- Returns:
- 'true' if the debouncer changed state.
Definition at line 170 of file debounce.h.
bool has_changed | ( | ) | const [inherited] |
Gets the current debouncer change state.
- Returns:
- 'true' if the debouncer has changed state.
Definition at line 62 of file debounce.h.
bool is_held | ( | ) | const [inherited] |
Gets the debouncer hold state.
- Returns:
- 'true' if the debouncer is in the hold state.
Definition at line 80 of file debounce.h.
bool is_repeating | ( | ) | const [inherited] |
Gets the debouncer repeat state.
- Returns:
- 'true' if the debouncer is repeating.
Definition at line 89 of file debounce.h.
bool is_set | ( | ) | const [inherited] |
Gets the current debouncer state.
- Returns:
- 'true' if the debouncer is in the true state.
Definition at line 71 of file debounce.h.
Field Documentation
uint16_t count [protected, inherited] |
The state count.
Definition at line 123 of file debounce.h.
Generated on Tue Jul 12 2022 14:05:49 by
