summaryrefslogtreecommitdiff
path: root/bsp/nxp/lpc/lpc55sxx/libraries/drivers/drv_gt911.h
blob: 2a9d2ce20ac591586fadcf195c826ea7679f27c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * Copyright (c) 2006-2023, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2023-05-26     Chushicheng  the first version
 */

#ifndef __DRV_GT911_H
#define __DRV_GT911_H

#include <rtdevice.h>

typedef enum
{
    GT911_INT_MODE_IRQ_RISE = 0x00U,
    GT911_INT_MODE_IRQ_FALL = 0x01U,
    GT911_INT_MODE_POLL     = 0x03U,
} gt911_int_mode_t;

typedef struct
{
    rt_uint8_t  id;
    rt_uint16_t pos_x;
    rt_uint16_t pos_y;
    rt_uint16_t size;
} gt911_point_t;

typedef struct
{
    rt_uint8_t       num_pos;
    gt911_point_t pos[5];
} gt911_input_t;

typedef struct
{
    rt_uint8_t *tx_data;
    rt_uint8_t *rx_data;
    rt_uint16_t tx_len;
    rt_uint16_t rx_len;
} gt911_i2c_xfer_t;

typedef rt_err_t (*gt911_ops_reset_t)(void *handle);
typedef rt_err_t (*gt911_ops_i2c_xfer_t)(void *handle, gt911_i2c_xfer_t *xfer);

typedef struct
{
    gt911_ops_reset_t    reset;
    gt911_ops_i2c_xfer_t xfer;
} gt911_ops_t;

typedef struct
{
    rt_uint16_t         pos_x_max;
    rt_uint16_t         pos_y_max;
    rt_uint8_t          pos_max;
    rt_uint8_t          fw_version;
    gt911_int_mode_t int_mode;
    gt911_ops_t      ops;
    void            *user_data;
} gt911_t;

typedef struct
{
    struct rt_device            parent;
    struct rt_i2c_bus_device   *bus;
    gt911_t                     gt911;
} capt_t;

rt_err_t gt911_ctp_read(gt911_t *ctp, gt911_input_t *input);
int drv_capt_hw_init(void);

#endif /* __DRV_GT911_H */