Expand description
GPIO abstractions: LEDs and the touch button.
The hardware-facing implementations on the RP2040 use embassy_rp::gpio
and live in hsm-firmware/src/hal_rp2040.rs. They implement the Led
and Button traits defined here. The firmware tasks (animation,
touch) are generic over those traits so they can be exercised against
mocks host-side.
§Debouncing
The button on the dongle has an RC low-pass filter in hardware
(see schematic) plus a software debouncer here. The software step
requires the input to remain stable for at least
DEBOUNCE_STABLE_SAMPLES consecutive samples before the state is
considered settled. Sampling is the caller’s responsibility (this module
is just the debouncer state machine), typically driven by a 1 ms timer
task in the firmware.
Structs§
- Debouncer
- Software debouncer state.
Constants§
- DEBOUNCE_
STABLE_ SAMPLES - Number of consecutive identical samples required for the debouncer to accept a new stable state.