Skip to main content

Module long_press

Module long_press 

Source
Expand description

Long-press detection: distinguishes short press from long press using timestamps.

Call update(edge, now_ms) on each input poll. Returns a Gesture when detected:

  • ShortPress on release before threshold
  • LongPress on hold ≥ threshold

Platform-agnostic: firmware provides Mono::now(), simulator provides Instant::now().

Structs§

LongPressDetector
Detects long-press gestures using absolute timestamps.

Enums§

Edge
Input edge from a debounced button.
Gesture
Detected gesture after timing analysis.

Constants§

LONG_PRESS_MS
Default long-press threshold in milliseconds.