|
TB2026-YDS Firmware
|
Buttons -> ui_event_t queue, interrupt-driven and discrete (one press, one event). More...

Files | |
| file | components/services/input/input.c |
| Input service: ISR-notified task reads buttons over I2C/GPIO, debounces, queues events. | |
Data Structures | |
| struct | input_diag_t |
| Live button snapshot for the diagnostics screen. More... | |
Functions | |
| esp_err_t | input_init (void) |
| Bring up the input service: queue, both ISRs, the input task, and A's wake-ready pin. | |
| bool | input_get_event (ui_event_t *out, TickType_t ticks_to_wait) |
| Block until the next input event (the UI task's read side of the queue). | |
| void | input_get_diag (input_diag_t *out) |
| Read the current button state and per-button press counts. | |
| uint32_t | input_idle_ms (void) |
| Milliseconds since the last button event was emitted. | |
Deep-sleep wake provisioning for button A (reused as-is by a future sleep service) | |
| #define | INPUT_WAKE_GPIO PIN_BTN_A |
| GPIO to arm as the ext0 wake source. A (GPIO39) is input-only and an RTC-IO. | |
| #define | INPUT_WAKE_ACTIVE_LEVEL 1 |
| Active level of A: A is active-HIGH (pressed pulls it high; external pull-down keeps it low at rest), unlike the active-low expander buttons. Wake on 1. | |
Buttons -> ui_event_t queue, interrupt-driven and discrete (one press, one event).
| #define INPUT_WAKE_ACTIVE_LEVEL 1 |
Active level of A: A is active-HIGH (pressed pulls it high; external pull-down keeps it low at rest), unlike the active-low expander buttons. Wake on 1.
| #define INPUT_WAKE_GPIO PIN_BTN_A |
GPIO to arm as the ext0 wake source. A (GPIO39) is input-only and an RTC-IO.
| void input_get_diag | ( | input_diag_t * | out | ) |
Read the current button state and per-button press counts.
Lock-free read of the input task's debounce state: a value may be momentarily stale, which is fine for a diagnostics display. No-op-safe before input_init() (reports all-released, zero counts).
| [out] | out | Receives the snapshot. |
| bool input_get_event | ( | ui_event_t * | out, |
| TickType_t | ticks_to_wait ) |
Block until the next input event (the UI task's read side of the queue).
| [out] | out | Receives the next ui_event_t. |
| ticks_to_wait | How long to wait (portMAX_DELAY to block indefinitely). |
| uint32_t input_idle_ms | ( | void | ) |
Milliseconds since the last button event was emitted.
The input service is the single choke point for all button activity, so this is the device-wide user-idle time. Reset to zero each time a debounced press produces an event; the volume potentiometer (a separate analog path) does not count. Consumed by the screen lock (UI task) and the idle auto power-off (maintenance task) – this service applies no timeout itself.
Lock-free single-word read. Returns 0 before input_init().
| esp_err_t input_init | ( | void | ) |
Bring up the input service: queue, both ISRs, the input task, and A's wake-ready pin.
Creates the event queue, configures the expander INT (GPIO35, falling edge) and A (GPIO39, input, no internal pull), installs the GPIO ISR service, registers both handlers, and starts the input task. The expander itself must already be initialised by the bsp. Idempotent.