|
TB2026-YDS Firmware
|
Pure button-state -> UI-event logic: debounce + press-edge detection + mapping. More...
Go to the source code of this file.
Data Structures | |
| struct | input_debounce_t |
| Debounce/edge state. Zero-initialise before the first call (memset or {0}). More... | |
Macros | |
| #define | INPUT_BTN_COUNT 6 |
| Number of physical buttons handled (5 expander + A). | |
| #define | INPUT_DEBOUNCE_MS 30 |
| Leading-edge lockout in ms: a button's press is accepted only this long after the previous accepted press, which swallows contact bounce (must exceed the bounce duration). | |
Functions | |
| int | input_logic_update (input_debounce_t *st, uint8_t exp_port, bool a_pressed, uint32_t now_ms, ui_event_t *out, int out_cap) |
| Fold one button sample into the debounce state, emitting just-pressed UI events. | |
Pure button-state -> UI-event logic: debounce + press-edge detection + mapping.
The hardware-free core of the Input service service, split out so it can be exercised off-target (test/host/input_test.c). It takes a raw expander input byte, the A button level, and a millisecond timestamp, and returns the UI events for buttons that were just pressed. No I2C, no ISR, no RTC: feed it samples, get events. The service (input.c) supplies the real samples from the IRQ-driven task.