rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
gt911.h
Go to the documentation of this file.
1
12
13#pragma once
14
15#include "driver/i2c_master.h"
16#include "esp_err.h"
17
18#include "touch_types.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/* Register map (only what this driver needs). */
25#define GT911_REG_COMMAND 0x8040
26#define GT911_REG_CONFIG 0x8047
27#define GT911_REG_X_MAX 0x8048
28#define GT911_REG_Y_MAX 0x804A
29#define GT911_REG_PRODUCT_ID 0x8140
30#define GT911_REG_FW_VERSION 0x8144
31#define GT911_REG_STATUS 0x814E
32#define GT911_REG_POINT0 0x814F
33
34#define GT911_STATUS_READY 0x80
35#define GT911_STATUS_COUNT_MASK 0x0F
36#define GT911_POINT_STRIDE 8
37
38typedef struct gt911_dev_t *gt911_handle_t;
39
40typedef struct {
41 uint16_t i2c_addr;
42 uint32_t scl_speed_hz;
44
46esp_err_t gt911_new(i2c_master_bus_handle_t bus, const gt911_config_t *cfg,
47 gt911_handle_t *out);
48
49esp_err_t gt911_del(gt911_handle_t h);
50
52uint16_t gt911_address(gt911_handle_t h);
53
55esp_err_t gt911_info(gt911_handle_t h, char product_id[5], uint16_t *fw_version);
56
58esp_err_t gt911_resolution(gt911_handle_t h, uint16_t *x_max, uint16_t *y_max);
59
69esp_err_t gt911_read(gt911_handle_t h, touch_point_t *out, int max,
70 int *count, bool *fresh);
71
72#ifdef __cplusplus
73}
74#endif
Definition gt911.h:40
uint32_t scl_speed_hz
Definition gt911.h:42
uint16_t i2c_addr
Definition gt911.h:41
Definition gt911.c:19
One contact.
Definition touch_types.h:23
Plain data types shared by the touch controller driver, the coordinate mapper and the event tracker....