Skip to main content

Module touch

Module touch 

Source
Expand description

Touch button sampling task.

Samples the button GPIO at 1 ms intervals, runs the signal through a [Debouncer], and posts [Event::TouchPressed] on every confirmed press (low -> high transition of the user-facing “pressed” boolean).

The button is active-low on this hardware (pull-up to 3V3, switch to ground); the [Button] trait abstracts that away, so [Button::is_pressed_raw] returns true when the user is pressing.

§Testability

The driving logic is implemented as the generic helper sample_once, which takes any Button impl. The embassy task touch_task is a thin shell that owns a real Input<'static> and forwards to the helper; tests in this module exercise the helper directly with a MockButton.

Constants§

SAMPLE_INTERVAL 🔒
Sampling period for the button GPIO.

Functions§

sample_once 🔒
Sample the button once and post a [Event::TouchPressed] event if the debouncer accepts a low->high transition (release -> press).
touch_task 🔒
Drive the touch button sampler. Spawn once at boot.