The touch injector at 0x14, read beside the glass (touch_inject.h).
More...
#include "touch_inject.h"
#include "esp_log.h"
#include "esp_timer.h"
#include "gt911.h"
#include "touch_merge.h"
|
|
#define | PROBE_TIMEOUT_MS 5 |
| | The probe's own timeout, in ms: an address-only write.
|
|
| void | touch_inject_attach (i2c_master_bus_handle_t bus, uint16_t glass_addr, touch_role_t glass_role, uint32_t now_ms) |
| | Look for the injector on bus beside the controller touch_init() found.
|
| touch_map_t | touch_inject_map (void) |
| | The map for the injector's contacts: panel pixels of the UI's BOARD_UI_H_RES x BOARD_UI_V_RES area, unmirrored.
|
| 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_inject_glass (touch_point_t *pts, int *count, bool fresh) |
| | Merge the glass's set with the injector's last one. No bus traffic.
|
| static void | probe (uint32_t now_ms) |
| | A detached injector, asked once a second whether it answers as the injector again: its product ID, TOUCH_MERGE_INJECT_PRODUCT, read on the handle made at start.
|
| bool | touch_inject_read (touch_point_t *pts, int *count, uint32_t now_ms) |
| | Read the injector when it is attached and due, detach it when it has been silent too long, and probe it when it is detached and due.
|
| void | touch_inject_mark (touch_event_t *evts, int n) |
| | Mark the UP of every injected contact the merge cut to make room for the glass's TOUCH_FLAG_NO_TAP (touch_merge_mark_cut()).
|
| uint32_t | touch_inject_age_ms (uint32_t now_ms) |
| | How old the injector's share of touch is.
|
|
|
static const char * | TAG = "touch_inject" |
| | The log tag.
|
| static const touch_map_t | k_inject_map |
| | The injector's map: its contacts are panel pixels of the UI's BOARD_UI_H_RES x BOARD_UI_V_RES area, unmirrored and unrotated (testbench/touch-injector/README.md).
|
|
static gt911_handle_t | s_dev |
| | the injector's handle
|
|
static bool | s_is_glass |
| | alone, in the glass's place
|
|
static touch_merge_t | s_merge |
| | the two sources merged
|
|
static volatile uint32_t | s_ok_ms |
| | its last good read
|
|
static volatile bool | s_attached |
| | attached, for the band
|
The touch injector at 0x14, read beside the glass (touch_inject.h).
SPDX-License-Identifier: MIT
◆ probe()
| void probe |
( |
uint32_t | now_ms | ) |
|
|
static |
A detached injector, asked once a second whether it answers as the injector again: its product ID, TOUCH_MERGE_INJECT_PRODUCT, read on the handle made at start.
- Parameters
-
◆ touch_inject_age_ms()
| uint32_t touch_inject_age_ms |
( |
uint32_t | now_ms | ) |
|
How old the injector's share of touch is.
- Parameters
-
- Returns
- Milliseconds since the injector last answered; 0 when none is attached, and from TOUCH_MERGE_DETACH_MS on, when it counts as detached.
◆ touch_inject_attach()
| void touch_inject_attach |
( |
i2c_master_bus_handle_t | bus, |
|
|
uint16_t | glass_addr, |
|
|
touch_role_t | glass_role, |
|
|
uint32_t | now_ms ) |
Look for the injector on bus beside the controller touch_init() found.
TOUCH_ROLE_INJECTOR: that controller is the injector, alone, and no second handle is made. The glass at TOUCH_INJECT_ADDR: nothing is looked for. The glass at 0x5D: 0x14 is probed, and attached only when it reports TOUCH_MERGE_INJECT_PRODUCT. Never fails touch: an absent injector is the normal case.
- Parameters
-
| bus | The touch bus. |
| glass_addr | The address that controller answered on. |
| glass_role | Its role (touch_merge_role()). |
| now_ms | The clock. |
◆ touch_inject_glass()
| bool touch_inject_glass |
( |
touch_point_t * | pts, |
|
|
int * | count, |
|
|
bool | fresh ) |
Merge the glass's set with the injector's last one. No bus traffic.
- Parameters
-
| pts | The glass's points in, the merged set out. |
| count | Their count in and out. |
| fresh | Whether the glass reported. |
- Returns
- Whether there is a new merged frame.
◆ touch_inject_map()
The map for the injector's contacts: panel pixels of the UI's BOARD_UI_H_RES x BOARD_UI_V_RES area, unmirrored.
- Returns
- The map; touch_init() also takes it for the injector alone (TOUCH_ROLE_INJECTOR).
◆ touch_inject_mark()
Mark the UP of every injected contact the merge cut to make room for the glass's TOUCH_FLAG_NO_TAP (touch_merge_mark_cut()).
- Parameters
-
| evts | The tracker's events for the frame just published. |
| n | How many. |
◆ touch_inject_read()
| bool touch_inject_read |
( |
touch_point_t * | pts, |
|
|
int * | count, |
|
|
uint32_t | now_ms ) |
Read the injector when it is attached and due, detach it when it has been silent too long, and probe it when it is detached and due.
- Parameters
-
| pts | The merged set, written when this returns true. |
| count | Its count. |
| now_ms | The clock. |
- Returns
- True when its contacts changed or it was detached.
◆ touch_injector_attached()
| 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.
- Returns
- true while an injector is attached
◆ k_inject_map
Initial value: = {
.mirror_x = false,
.mirror_y = false,
}
#define BOARD_UI_H_RES
The area the UI (user interface) draws: the whole panel, 1024 x.
Definition board_pins.h:41
#define BOARD_UI_V_RES
The UI area's height: the panel's 600 rows.
Definition board_pins.h:43
@ TOUCH_ROTATION_0
Definition touch_types.h:32
The injector's map: its contacts are panel pixels of the UI's BOARD_UI_H_RES x BOARD_UI_V_RES area, unmirrored and unrotated (testbench/touch-injector/README.md).