1 /*
2  * Copyright (c) 2006-2022, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2022-04-11     Wayne        the first version
9  */
10 
11 #ifndef __ST1663I_H__
12 #define __ST1663I_H__
13 
14 #include <rtdevice.h>
15 
16 #define ST_REGITER_LEN           1
17 #define ST_MAX_TOUCH             5
18 #define ST1663I_ADDRESS       0x55
19 
20 #pragma anon_unions
21 
22 typedef struct
23 {
24     //012H*n+0 (n=0, 1, ...,4)
25     union
26     {
27         uint8_t m_u8XY0_H;
28         struct
29         {
30             uint8_t u8Y0_H: 3;
31             uint8_t : 1;
32             uint8_t u8X0_H: 3;
33             uint8_t u8Valid: 1;
34         };
35     };
36 
37     //012H*n+1 (n=0, 1, ...,4)
38     uint8_t m_u8X0_L;
39 
40     //012H*n+2 (n=0, 1, ...,4)
41     uint8_t m_u8Y0_L;
42 
43     //012H*n+3 (n=0, 1, ...,4)
44     uint8_t m_u8Z;
45 
46 } S_ST_TP;
47 
48 
49 #pragma pack(push)
50 #pragma pack(4)
51 
52 typedef struct
53 {
54     union
55     {
56         uint8_t m_u8TouchInfo;
57         struct
58         {
59             uint8_t u8Fingers: 4;
60             uint8_t : 4;
61         };
62     };
63 
64     uint8_t m_u8Keys;
65 
66     S_ST_TP m_sTP[ST_MAX_TOUCH];
67 
68 } S_ST_REGMAP;
69 #pragma pack(pop)
70 
71 int rt_hw_st1663i_init(const char *name, struct rt_touch_config *cfg);
72 
73 #endif /* __ST1663I_H__ */
74