Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Debounce Class Reference

Debounce a boolean reading. More...

#include <Debounce.h>

Inheritance diagram for Debounce:
BelaDebounce GpioDebounce

Classes

struct  Settings
 

Public Types

enum  Edge { FALLING = -1, NONE = 0, RISING = 1 }
 

Public Member Functions

 Debounce (unsigned int interval)
 
 Debounce (const Settings &settings)
 
void setup (unsigned int interval)
 
void setup (const Settings &settings)
 
bool process (bool input)
 
bool get ()
 
Edge edgeDetected ()
 

Static Public Member Functions

static Edge detectEdge (bool oldState, bool newState)
 

Protected Attributes

bool state
 
bool oldState
 

Detailed Description

Debounce a boolean reading.

Debounce a boolean reading which is read at regular intervals. Additionally, provide edge detection functionalities.

Member Enumeration Documentation

Enumerator
FALLING 

The state has transitioned from high to low.

NONE 

The state has remained the same.

RISING 

The state has transitioned from low to high.

Constructor & Destructor Documentation

Debounce::Debounce ( unsigned int  interval)

Same as setup().

Debounce::Debounce ( const Settings settings)

Same as setup().

Member Function Documentation

void Debounce::setup ( unsigned int  interval)

Set up the debouncer and reset the internal state.

Parameters
debouncethe number of calls to process() during which changes are ignored after a change in the input vaulue has been detected.
void Debounce::setup ( const Settings settings)

Set up the debouncer and reset the internal state.

Parameters
settingsthe number of calls to process() during which changes are ignored after a change in the input vaulue has been detected.
bool Debounce::process ( bool  input)
inline

Process an input through the debouncer and obtain an output.

bool Debounce::get ( )
inline

Get the current debounced state.

Edge Debounce::edgeDetected ( )
inline

Return what edge was detected during the previous call to process()

static Edge Debounce::detectEdge ( bool  oldState,
bool  newState 
)
inlinestatic

Detect what edge occurs between two values.


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