rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
touch_map.h
Go to the documentation of this file.
1
8
9#pragma once
10
11#include "touch_types.h"
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17typedef struct {
18 int16_t src_w;
19 int16_t src_h;
20 bool mirror_x;
21 bool mirror_y;
24
31void touch_map_size(const touch_map_t *m, int16_t *w, int16_t *h);
32
43void touch_map_apply(const touch_map_t *m, int16_t x, int16_t y,
44 int16_t *out_x, int16_t *out_y);
45
52
67touch_map_t touch_map_turned(const touch_map_t *m, bool turned);
68
80void touch_map_points(const touch_map_t *m, touch_point_t *pts, int n);
81
97int touch_map_crop(touch_point_t *pts, int count, int16_t w, int16_t h);
98
99/* ----------------------------------------------------------------- tracker */
100
106
112
124#define TOUCH_JUMP_PX 120
125
146 const touch_point_t *cur, int cur_count,
147 touch_event_t *out, int max_out);
148
149#ifdef __cplusplus
150}
151#endif
A DOWN, MOVE or UP of one contact.
Definition touch_types.h:69
Definition touch_map.h:17
bool mirror_x
Definition touch_map.h:20
bool mirror_y
Definition touch_map.h:21
int16_t src_h
Definition touch_map.h:19
int16_t src_w
Definition touch_map.h:18
touch_rotation_t rotation
Definition touch_map.h:22
One contact.
Definition touch_types.h:23
The contacts of the last frame, to diff the next against.
Definition touch_map.h:102
touch_point_t prev[TOUCH_MAX_POINTS]
Definition touch_map.h:103
uint8_t prev_count
Definition touch_map.h:104
int touch_tracker_update(touch_tracker_t *t, const touch_point_t *cur, int cur_count, touch_event_t *out, int max_out)
Diff the current contact set against the previous one and emit DOWN/MOVE/UP events.
Definition touch_map.c:164
void touch_map_size(const touch_map_t *m, int16_t *w, int16_t *h)
Size of the mapped coordinate space (rotation may swap the axes).
Definition touch_map.c:35
void touch_map_points(const touch_map_t *m, touch_point_t *pts, int n)
Map n points in place, each as touch_map_point() maps it.
Definition touch_map.c:110
void touch_map_point(const touch_map_t *m, touch_point_t *p)
Map a whole point in place (id and strength are untouched).
Definition touch_map.c:85
void touch_tracker_reset(touch_tracker_t *t)
Forget every contact: the next frame's are all new.
Definition touch_map.c:139
touch_map_t touch_map_turned(const touch_map_t *m, bool turned)
The map m with the picture turned by 180 degrees on top of it: a point m maps to (x,...
Definition touch_map.c:94
void touch_map_apply(const touch_map_t *m, int16_t x, int16_t y, int16_t *out_x, int16_t *out_y)
Map one raw controller coordinate into screen space. Inputs outside the native range are clamped,...
Definition touch_map.c:45
int touch_map_crop(touch_point_t *pts, int count, int16_t w, int16_t h)
Keep the mapped points inside a w x h area at the origin and drop the rest, in place and in order....
Definition touch_map.c:121
Plain data types shared by the touch controller driver, the coordinate mapper and the event tracker....
touch_rotation_t
How far the controller's frame is turned against the panel's.
Definition touch_types.h:31
#define TOUCH_MAX_POINTS
The GT911 reports at most five simultaneous contacts.
Definition touch_types.h:20