1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
35
41
47
53
54
55
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
79
80
86
87
88
91
92
97
103
104
109
113
114
119
123
124
129
132
133
138
139
140
141
142
143
144
145
146
147
148
149
150
154
158
159
160
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
190
193
194
199
202
203
208
212
213
218
221
222
225
226
229
230
233
234
/* ... */
#include "ts3510.h"
/* ... */
/* ... */
/* ... */
Includes
/* ... */
Private typedef
/* ... */
Private define
/* ... */
Private macro
/* ... */
TS_DrvTypeDef ts3510_ts_drv =
{
ts3510_Init,
ts3510_ReadID,
ts3510_Reset,
ts3510_TS_Start,
ts3510_TS_DetectTouch,
ts3510_TS_GetXY,
ts3510_TS_EnableIT,
ts3510_TS_ClearIT,
ts3510_TS_ITStatus,
ts3510_TS_DisableIT,
...};
/* ... */
Private variables
/* ... */
Private function prototypes
/* ... */
/* ... */
void ts3510_Init(uint16_t DeviceAddr)
{
IOE_Init();
}{ ... }
/* ... */
void ts3510_Reset(uint16_t DeviceAddr)
{
}{ ... }
/* ... */
uint16_t ts3510_ReadID(uint16_t DeviceAddr)
{
return 0;
}{ ... }
/* ... */
void ts3510_TS_Start(uint16_t DeviceAddr)
{
}{ ... }
/* ... */
uint8_t ts3510_TS_DetectTouch(uint16_t DeviceAddr)
{
uint8_t aBufferTS[11];
uint8_t aTmpBuffer[2] = {TS3510_READ_CMD, TS3510_WRITE_CMD};
IOE_WriteMultiple(DeviceAddr, TS3510_SEND_CMD_REG, aTmpBuffer, 2);
IOE_ReadMultiple(DeviceAddr, TS3510_READ_BLOCK_REG, aBufferTS, 11);
if((aBufferTS[1] == 0xFF) && (aBufferTS[2] == 0xFF) && (aBufferTS[3] == 0xFF) && (aBufferTS[4] == 0xFF))
{
return 0;
}if ((aBufferTS[1] == 0xFF) && (aBufferTS[2] == 0xFF) && (aBufferTS[3] == 0xFF) && (aBufferTS[4] == 0xFF)) { ... }
else
{
return 1;
}else { ... }
}{ ... }
/* ... */
void ts3510_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
{
uint8_t aBufferTS[11];
uint8_t aTmpBuffer[2] = {TS3510_READ_CMD, TS3510_WRITE_CMD};
IOE_WriteMultiple(DeviceAddr, TS3510_SEND_CMD_REG, aTmpBuffer, 2);
IOE_ReadMultiple(DeviceAddr, TS3510_READ_BLOCK_REG, aBufferTS, 11);
*X = (((aBufferTS[1] << 8) | aBufferTS[2]) << 12) / 640;
*Y = (((aBufferTS[3] << 8) | aBufferTS[4]) << 12) / 480;
}{ ... }
/* ... */
void ts3510_TS_EnableIT(uint16_t DeviceAddr)
{
}{ ... }
/* ... */
void ts3510_TS_DisableIT(uint16_t DeviceAddr)
{
}{ ... }
/* ... */
uint8_t ts3510_TS_ITStatus(uint16_t DeviceAddr)
{
return 0;
}{ ... }
/* ... */
void ts3510_TS_ClearIT(uint16_t DeviceAddr)
{
}{ ... }
/* ... */
/* ... */
/* ... */
/* ... */