|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
Touch input for the 7-inch ESP32-P4 display board. More...
Go to the source code of this file.
Data Structures | |
| struct | touch_config_t |
| How touch_init() sets the touch input up. More... | |
Macros | |
| #define | TOUCH_CONFIG_DEFAULT() |
| Polled every 10ms, mirrored as board_pins.h says, 32 events. | |
Functions | |
| esp_err_t | touch_init (const touch_config_t *cfg) |
| Reset the controller, probe it and start the polling task. | |
| esp_err_t | touch_deinit (void) |
| Stop the task and release the controller. | |
| int | touch_snapshot (touch_point_t *out, int max) |
| bool | touch_pressed (touch_point_t *out) |
| bool | touch_wait_event (touch_event_t *out, uint32_t *seq, uint32_t timeout_ms) |
| uint32_t | touch_published (void) |
| void | touch_flush_events (void) |
| uint16_t | touch_i2c_address (void) |
| uint32_t | touch_age_ms (void) |
| bool | touch_injector_attached (void) |
| Whether a touch injector (testbench/touch-injector) is attached: it answered at start-up and has not been silent for 1000ms since, or a probe has re-attached it. Always true when the injector is the only touch device (nothing at 0x5D, and the product ID "9INJ" at 0x14). Declared in a build with RCBENCH_TOUCH_INJECTOR (the default) only; touch_inject.h has the rest. | |
Touch input for the 7-inch ESP32-P4 display board.
A background task polls the GT911 every poll_interval_ms, maps the coordinates into screen space, drops the ones outside the UI's BOARD_UI_H_RES x BOARD_UI_V_RES area and publishes the result two ways:
SPDX-License-Identifier: MIT
| #define TOUCH_CONFIG_DEFAULT | ( | ) |
Polled every 10ms, mirrored as board_pins.h says, 32 events.
| uint32_t touch_age_ms | ( | void | ) |
Milliseconds since the controller last answered a read, or UINT32_MAX when touch never came up.
"Answered" means the I2C (Inter-Integrated Circuit) transaction succeeded, not that a finger was down. An untouched panel is healthy and reports an age near zero, so this separates "nobody is touching it" from "the controller stopped answering", which the event stream cannot.
An application that can act on input, and only on input, treats a large age as a fault rather than as quiet.
| esp_err_t touch_deinit | ( | void | ) |
Stop the task and release the controller.
| void touch_flush_events | ( | void | ) |
Drop any queued events (useful after a screen change).
| uint16_t touch_i2c_address | ( | void | ) |
I2C address the controller answered on, or 0 before init.
| esp_err_t touch_init | ( | const touch_config_t * | cfg | ) |
Reset the controller, probe it and start the polling task.
| cfg | The set-up; NULL takes TOUCH_CONFIG_DEFAULT(). |
| bool touch_injector_attached | ( | void | ) |
Whether a touch injector (testbench/touch-injector) is attached: it answered at start-up and has not been silent for 1000ms since, or a probe has re-attached it. Always true when the injector is the only touch device (nothing at 0x5D, and the product ID "9INJ" at 0x14). Declared in a build with RCBENCH_TOUCH_INJECTOR (the default) only; touch_inject.h has the rest.
| bool touch_pressed | ( | touch_point_t * | out | ) |
True when at least one finger is down; fills out if given.
| uint32_t touch_published | ( | void | ) |
The number of the last event the driver offered to its queue, stored after the offer. Read before draining the queue: an event up to it that the drain did not deliver was dropped, which a loss at the end of the stream, with no later event to show the gap, needs.
| int touch_snapshot | ( | touch_point_t * | out, |
| int | max ) |
Copy the current contact set. Returns the number of active contacts, which may exceed max (only max of them are written).
| bool touch_wait_event | ( | touch_event_t * | out, |
| uint32_t * | seq, | ||
| uint32_t | timeout_ms ) |
Pop the next input event. timeout_ms of 0 polls, UINT32_MAX blocks. Returns false when nothing arrived in time.
seq, when not NULL, receives the event's number. The driver numbers every event it offers to its queue, from 1 and in order, whether or not the queue kept it, so a number skipped is an event the queue dropped because nobody collected it. touch_loss.h turns the numbers into losses.