|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The glass's contacts and a touch injector's, merged (touch_merge.h). More...
Functions | |
| static int | clamp_count (int n) |
n held to 0..TOUCH_MAX_POINTS. | |
| static bool | same_point (const touch_point_t *a, const touch_point_t *b) |
| The same contact at the same place and strength. | |
| void | touch_merge_reset (touch_merge_t *m) |
| Forget both sets: no contacts, the injector attached at 0ms. | |
| void | touch_merge_attach (touch_merge_t *m, uint32_t now_ms) |
Reset, with the injector attached and answering at now_ms. | |
| void | touch_merge_start (touch_merge_t *m, bool answered, uint32_t now_ms) |
| The start-up look for the injector. | |
| bool | touch_merge_attached (const touch_merge_t *m) |
| Whether the injector is attached: false once detached, until a probe. | |
| bool | touch_merge_expire (touch_merge_t *m, uint32_t now_ms) |
| Detach the injector when its last good read is TOUCH_MERGE_DETACH_MS or more old. Detaching drops its contacts. | |
| bool | touch_merge_probe_due (const touch_merge_t *m, uint32_t now_ms) |
| Whether a detached injector is due to be probed: TOUCH_MERGE_PROBE_MS after the detach and after every probe. Never for an absent one. | |
| bool | touch_merge_probe (touch_merge_t *m, bool answered, uint32_t now_ms) |
| A detached injector was probed. | |
| static void | recut (touch_merge_t *m) |
| Decide which injected contacts the frame has room for. | |
| void | touch_merge_glass (touch_merge_t *m, const touch_point_t *pts, int n) |
| The glass reported a new contact set (0 points when every finger lifted). Injected contacts the frame no longer has room for are cut. | |
| bool | touch_merge_inject_due (const touch_merge_t *m, uint32_t now_ms) |
| Whether the injector is due to be asked: on every poll while it answers, and every TOUCH_MERGE_RETRY_MS once it has failed TOUCH_MERGE_FAIL_DROP times in a row. | |
| static bool | frames_differ (const touch_point_t *a, int na, const touch_point_t *b, int nb) |
| Whether two merged sets differ. | |
| bool | touch_merge_inject (touch_merge_t *m, const touch_point_t *pts, int n, bool fresh, uint32_t now_ms) |
The injector answered at now_ms. | |
| bool | touch_merge_inject_failed (touch_merge_t *m, uint32_t now_ms) |
| An injector read failed. | |
| int | touch_merge_frame (const touch_merge_t *m, touch_point_t *out, int max) |
| The merged set: the glass's contacts, then the injector's that are not cut, TOUCH_MAX_POINTS at most. | |
| int | touch_merge_mark_cut (const touch_merge_t *m, touch_event_t *evts, int n) |
| Mark the UP of every cut injected contact TOUCH_FLAG_NO_TAP. | |
| bool | touch_merge_is_injector (const char *product_id) |
Whether product_id is the touch injector's. | |
| touch_role_t | touch_merge_role (uint16_t addr, bool glass_found, const char *product_id) |
| The role of a controller that answered as a GT911 at start-up. | |
| touch_map_t | touch_merge_role_map (touch_role_t role, const touch_map_t *glass, const touch_map_t *inject, bool turned) |
The map for one report of a controller with role role. | |
The glass's contacts and a touch injector's, merged (touch_merge.h).
SPDX-License-Identifier: MIT
|
static |
Decide which injected contacts the frame has room for.
The room is what the glass leaves. A contact shown before keeps its place before a new one gets any, in report order; a cut one stays cut.
| m | The merge. |
| void touch_merge_attach | ( | touch_merge_t * | m, |
| uint32_t | now_ms ) |
Reset, with the injector attached and answering at now_ms.
| m | The merge. |
| now_ms | The clock. |
| bool touch_merge_attached | ( | const touch_merge_t * | m | ) |
Whether the injector is attached: false once detached, until a probe.
| m | The merge. |
| bool touch_merge_expire | ( | touch_merge_t * | m, |
| uint32_t | now_ms ) |
Detach the injector when its last good read is TOUCH_MERGE_DETACH_MS or more old. Detaching drops its contacts.
| m | The merge. |
| now_ms | The clock. |
| int touch_merge_frame | ( | const touch_merge_t * | m, |
| touch_point_t * | out, | ||
| int | max ) |
The merged set: the glass's contacts, then the injector's that are not cut, TOUCH_MAX_POINTS at most.
| m | The merge. |
| out | Where the set goes. |
| max | The room in out. |
| void touch_merge_glass | ( | touch_merge_t * | m, |
| const touch_point_t * | pts, | ||
| int | n ) |
The glass reported a new contact set (0 points when every finger lifted). Injected contacts the frame no longer has room for are cut.
| m | The merge. |
| pts | The points, in panel pixels. |
| n | How many; a count outside 0..TOUCH_MAX_POINTS is clamped. |
| bool touch_merge_inject | ( | touch_merge_t * | m, |
| const touch_point_t * | pts, | ||
| int | n, | ||
| bool | fresh, | ||
| uint32_t | now_ms ) |
The injector answered at now_ms.
A contact it reports keeps its cut by track id; a new one is cut when the frame has no room for it. A cut contact the injector lifts is forgotten, and its id is free again.
| m | The merge. |
| pts | The points, in panel pixels; not read when fresh is false. |
| n | How many. |
| fresh | False when it had no new report. |
| now_ms | The clock. |
| bool touch_merge_inject_due | ( | const touch_merge_t * | m, |
| uint32_t | now_ms ) |
Whether the injector is due to be asked: on every poll while it answers, and every TOUCH_MERGE_RETRY_MS once it has failed TOUCH_MERGE_FAIL_DROP times in a row.
| m | The merge. |
| now_ms | The clock. |
| bool touch_merge_inject_failed | ( | touch_merge_t * | m, |
| uint32_t | now_ms ) |
An injector read failed.
| m | The merge. |
| now_ms | The clock. |
| bool touch_merge_is_injector | ( | const char * | product_id | ) |
Whether product_id is the touch injector's.
| product_id | The 4 bytes read at 0x8140; NULL is not the injector. |
| int touch_merge_mark_cut | ( | const touch_merge_t * | m, |
| touch_event_t * | evts, | ||
| int | n ) |
Mark the UP of every cut injected contact TOUCH_FLAG_NO_TAP.
Called on the tracker's events for the frame touch_merge_frame() gave. A contact cut to make room for the glass's did not lift; its UP ends the press as TOUCH_FLAG_NO_TAP says. Every other event is left as it is.
| m | The merge. |
| evts | The events. |
| n | How many. |
| bool touch_merge_probe | ( | touch_merge_t * | m, |
| bool | answered, | ||
| uint32_t | now_ms ) |
A detached injector was probed.
| m | The merge. |
| answered | True when it answered as a GT911. |
| now_ms | The clock. |
| bool touch_merge_probe_due | ( | const touch_merge_t * | m, |
| uint32_t | now_ms ) |
Whether a detached injector is due to be probed: TOUCH_MERGE_PROBE_MS after the detach and after every probe. Never for an absent one.
| m | The merge. |
| now_ms | The clock. |
| void touch_merge_reset | ( | touch_merge_t * | m | ) |
Forget both sets: no contacts, the injector attached at 0ms.
| m | The merge; NULL does nothing. |
| touch_role_t touch_merge_role | ( | uint16_t | addr, |
| bool | glass_found, | ||
| const char * | product_id ) |
The role of a controller that answered as a GT911 at start-up.
glass_found false); not read when the glass answered at 0x5D, so 0x5D wins.| addr | The address it answered at. |
| glass_found | Whether a glass answered at TOUCH_MERGE_GLASS_ADDR before it. |
| product_id | Its 4-byte product ID; NULL when the read failed. |
| touch_map_t touch_merge_role_map | ( | touch_role_t | role, |
| const touch_map_t * | glass, | ||
| const touch_map_t * | inject, | ||
| bool | turned ) |
The map for one report of a controller with role role.
| role | Its role. |
| glass | The glass's map: its resolution, mirrors and rotation. |
| inject | The injector's map (logical pixels). |
| turned | Whether the turned picture is on the glass (gfx_turn_shown()); false again after the turn falls back. |
glass turned by turned for TOUCH_ROLE_GLASS; inject, never turned, for TOUCH_ROLE_INJECTOR; a zeroed map for TOUCH_ROLE_NONE or a NULL map. | void touch_merge_start | ( | touch_merge_t * | m, |
| bool | answered, | ||
| uint32_t | now_ms ) |
The start-up look for the injector.
An answer is touch_merge_attach(). No answer makes the injector absent until the next start: nothing in this header attaches, reads or probes it, and touch_merge_attached() stays false.
| m | The merge. |
| answered | True when 0x14 answered as a GT911. |
| now_ms | The clock. |