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

Detailed Description

Definition at line 28 of file tap_hold.hpp.

#include <tap_hold.hpp>

Public Member Functions

 TapHold (uint16_t hold_threshold=60)
 
void update (bool pressed, bool just_released)
 Call every tick with the button's current pressed state and release edge.
 
bool tapped ()
 True once after a short press (released before hold threshold).
 
bool held ()
 True once when hold threshold is reached (while still pressed).
 
bool released_from_hold ()
 True once when released after a hold.
 
bool holding () const
 Currently in held state (pressed past threshold, not yet released).
 
uint16_t hold_ticks () const
 Current tick count (0 when not pressed).
 
void reset ()
 

Constructor & Destructor Documentation

◆ TapHold()

sbl::components::input::TapHold::TapHold ( uint16_t  hold_threshold = 60)
inlineexplicit
Parameters
hold_thresholdTicks before press becomes a hold.

Definition at line 31 of file tap_hold.hpp.

Member Function Documentation

◆ update()

void sbl::components::input::TapHold::update ( bool  pressed,
bool  just_released 
)
inline

Call every tick with the button's current pressed state and release edge.

Definition at line 35 of file tap_hold.hpp.

◆ tapped()

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

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

Definition at line 57 of file tap_hold.hpp.

◆ held()

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

True once when hold threshold is reached (while still pressed).

Definition at line 64 of file tap_hold.hpp.

◆ released_from_hold()

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

True once when released after a hold.

Definition at line 71 of file tap_hold.hpp.

◆ holding()

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

Currently in held state (pressed past threshold, not yet released).

Definition at line 78 of file tap_hold.hpp.

◆ hold_ticks()

uint16_t sbl::components::input::TapHold::hold_ticks ( ) const
inline

Current tick count (0 when not pressed).

Definition at line 81 of file tap_hold.hpp.

◆ reset()

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

Definition at line 83 of file tap_hold.hpp.


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