Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | List of all members
sbl::components::control::TapHold Class Reference

#include <tap_hold.hpp>

Collaboration diagram for sbl::components::control::TapHold:

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 ()
 

Detailed Description

Definition at line 27 of file tap_hold.hpp.

Constructor & Destructor Documentation

◆ TapHold()

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

Definition at line 30 of file tap_hold.hpp.

Member Function Documentation

◆ held()

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

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

Definition at line 63 of file tap_hold.hpp.

◆ hold_ticks()

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

Current tick count (0 when not pressed).

Definition at line 80 of file tap_hold.hpp.

◆ holding()

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

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

Definition at line 77 of file tap_hold.hpp.

◆ released_from_hold()

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

True once when released after a hold.

Definition at line 70 of file tap_hold.hpp.

◆ reset()

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

Definition at line 82 of file tap_hold.hpp.

◆ tapped()

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

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

Definition at line 56 of file tap_hold.hpp.

◆ update()

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

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

Definition at line 34 of file tap_hold.hpp.


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