Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::control::input::TapHold Class Reference

Tells a tap from a hold on a debounced button. More...

Detailed Description

Tells a tap from a hold on a debounced button.

Definition at line 32 of file tap_hold.hpp.

#include <tap_hold.hpp>

Public Member Functions

 TapHold (uint32_t hold_ticks)
 
void update (bool pressed, bool just_released, uint32_t elapsed_ticks)
 
bool tapped ()
 
bool held ()
 
bool released_from_hold ()
 
bool holding () const
 
uint32_t pressed_ticks () const
 
void reset ()
 

Constructor & Destructor Documentation

◆ TapHold()

sbl::control::input::TapHold::TapHold ( uint32_t  hold_ticks)
inlineexplicit
Parameters
hold_ticksHow long a press lasts before it is a hold, in ticks.

Definition at line 35 of file tap_hold.hpp.

Member Function Documentation

◆ update()

void sbl::control::input::TapHold::update ( bool  pressed,
bool  just_released,
uint32_t  elapsed_ticks 
)
inline
Parameters
pressedthe button's debounced state
just_releasedits release edge
elapsed_ticksticks since the previous update

Definition at line 42 of file tap_hold.hpp.

◆ tapped()

bool sbl::control::input::TapHold::tapped ( )
inline

True once after a short press (released before the hold time).

Definition at line 70 of file tap_hold.hpp.

◆ held()

bool sbl::control::input::TapHold::held ( )
inline

True once when the hold time is reached, while still pressed.

Definition at line 77 of file tap_hold.hpp.

◆ released_from_hold()

bool sbl::control::input::TapHold::released_from_hold ( )
inline

True once when released after a hold.

Definition at line 84 of file tap_hold.hpp.

◆ holding()

bool sbl::control::input::TapHold::holding ( ) const
inline

Pressed past the hold time and not yet released.

Definition at line 91 of file tap_hold.hpp.

◆ pressed_ticks()

uint32_t sbl::control::input::TapHold::pressed_ticks ( ) const
inline

Ticks since the press was first seen; 0 when not pressed.

Definition at line 94 of file tap_hold.hpp.

◆ reset()

void sbl::control::input::TapHold::reset ( )
inline

Definition at line 96 of file tap_hold.hpp.


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