InputEvents v1.4.0
An easy to use but comprehensive Event Library for Buttons, Encoders, Encoder Buttons, Analog Inputs, Joysticks and Switches.
Public Member Functions | Protected Attributes | List of all members
DebounceAdapter Class Referenceabstract

Description

This is the interface/base class for debounce adapters.

#include <DebounceAdapter.h>

Inheritance diagram for DebounceAdapter:
Inheritance graph
[legend]

Public Member Functions

 DebounceAdapter (uint16_t debounceInterval=10)
 
 DebounceAdapter (PinAdapter *pinAdapter, uint16_t debounceInterval=10)
 
void begin ()
 Initialise the debouncer and pin adapter. Must be safe for repeated calls (Idempotent) More...
 
virtual bool read ()=0
 Return the debounced state of the pin adapter. More...
 
void setPinAdapter (PinAdapter *adapter)
 The pinAdapter is usually passed via the constructor. If it is not, it must be set before begin() is called. More...
 
virtual void setDebounceInterval (uint16_t interval)
 Set the debounce interval. Default is 10ms. More...
 
virtual void begin ()=0
 Initialise the pin adapter. Must be safe for repeated calls (Idempotent) More...
 
virtual bool read ()=0
 Read the current state of the pin. More...
 

Protected Attributes

PinAdapterpinAdapter
 
uint16_t debounceInterval = 10
 

Member Function Documentation

◆ begin()

void DebounceAdapter::begin ( )
inlinevirtual

Initialise the debouncer and pin adapter. Must be safe for repeated calls (Idempotent)

Implements PinAdapter.

Reimplemented in FoltmanDebounceAdapter.

◆ read()

virtual bool DebounceAdapter::read ( )
pure virtual

Return the debounced state of the pin adapter.

Returns
true/HIGH
false/LOW

Implements PinAdapter.

Implemented in FoltmanDebounceAdapter.

◆ setDebounceInterval()

virtual void DebounceAdapter::setDebounceInterval ( uint16_t  interval)
inlinevirtual

Set the debounce interval. Default is 10ms.

Parameters
interval

◆ setPinAdapter()

void DebounceAdapter::setPinAdapter ( PinAdapter adapter)
inline

The pinAdapter is usually passed via the constructor. If it is not, it must be set before begin() is called.

Parameters
adapter

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