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
tap_hold.hpp File Reference

Tap vs hold detector. More...

Detailed Description

Tap vs hold detector.

Tells a short tap from a long hold. Feed it a Button's pressed() and just_released() and the time since the update before.

  • tapped(): true once after a press shorter than the hold time
  • held(): true once when the hold time is reached
  • released_from_hold(): true once when released after a hold

Reading an edge clears it. Times are ticks of the clock that drives it; it holds no rate and counts no calls.

sbl::control::input::TapHold th(Clock::ticks_from_ms(300));
th.update(button.pressed(), button.just_released(), elapsed_ticks);
if (th.tapped()) { ... }
if (th.held()) { ... }
Tells a tap from a hold on a debounced button.
Definition tap_hold.hpp:32

Definition in file tap_hold.hpp.

#include <cstdint>

Go to the source code of this file.

Classes

class  sbl::control::input::TapHold
 Tells a tap from a hold on a debounced button. More...
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::control
 The control stack: scheduler, event queue, merge, CC mapping, calibration.
 
namespace  sbl::control::input
 Inputs: debounce, decoding, smoothing and scaling of raw samples.