Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
Loading...
Searching...
No Matches
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

◆ Edge

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() [1/2]

Debounce::Debounce ( unsigned int interval)

Same as setup().

◆ Debounce() [2/2]

Debounce::Debounce ( const Settings & settings)

Same as setup().

Member Function Documentation

◆ setup() [1/2]

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.

◆ setup() [2/2]

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.

◆ process()

bool Debounce::process ( bool input)
inline

Process an input through the debouncer and obtain an output.

◆ get()

bool Debounce::get ( )
inline

Get the current debounced state.

◆ edgeDetected()

Edge Debounce::edgeDetected ( )
inline

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

◆ detectEdge()

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: