|
TB2026-YDS Firmware
|
Input service: the six buttons -> one semantic ui_event_t in a single queue. More...
#include "esp_err.h"#include "event.h"#include "board_pins.h"#include "input_logic.h"#include "freertos/FreeRTOS.h"#include <stdint.h>#include <stdbool.h>Go to the source code of this file.
Data Structures | |
| struct | input_diag_t |
| Live button snapshot for the diagnostics screen. More... | |
Macros | |
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. | |
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. | |
Input service: the six buttons -> one semantic ui_event_t in a single queue.
Interrupt-driven, strictly discrete: one press emits exactly one ui_event_t (no long-press, no auto-repeat, no combos). Five buttons hang off the PI4IOE5V9554A expander (one shared INT on GPIO35); button A has its own GPIO39 line. Each ISR only notifies the input task, which reads the state over I2C / GPIO (never in ISR context), debounces, and posts the event. The task sleeps between interrupts, so an idle device costs no I2C traffic (see Rule 13). The UI layer drains the queue with input_get_event(); the debounce + mapping core lives in Input logic (pure).
Wake provisioning: A (GPIO39) is an RTC-IO and is the intended deep-sleep wake source. This service only configures the pin wake-compatibly and exposes INPUT_WAKE_GPIO / INPUT_WAKE_ACTIVE_LEVEL; it never calls esp_sleep_* — arming is the future sleep service's job.