Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "ts3510.h"
Private typedef
Private define
Private macro
Private variables
ts3510_ts_drv
Private function prototypes
ts3510_Init(uint16_t)
ts3510_Reset(uint16_t)
ts3510_ReadID(uint16_t)
ts3510_TS_Start(uint16_t)
ts3510_TS_DetectTouch(uint16_t)
ts3510_TS_GetXY(uint16_t, uint16_t *, uint16_t *)
ts3510_TS_EnableIT(uint16_t)
ts3510_TS_DisableIT(uint16_t)
ts3510_TS_ITStatus(uint16_t)
ts3510_TS_ClearIT(uint16_t)
Files
loading...
CodeScopeSTM32 Libraries and Samplests3510ts3510.c
 
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file ts3510.c * @author MCD Application Team * @brief This file provides a set of functions needed to manage the TS3510 * IO Expander devices. ****************************************************************************** * @attention * * Copyright (c) 2014 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ /* Includes ------------------------------------------------------------------*/ #include "ts3510.h" /** @addtogroup BSP * @{ *//* ... */ /** @addtogroup Component * @{ *//* ... */ /** @defgroup TS3510 * @{ *//* ... */ Includes /* Private typedef -----------------------------------------------------------*/ /** @defgroup TS3510_Private_Types_Definitions * @{ *//* ... */ Private typedef /* Private define ------------------------------------------------------------*/ /** @defgroup TS3510_Private_Defines * @{ *//* ... */ Private define /* Private macro -------------------------------------------------------------*/ /** @defgroup TS3510_Private_Macros * @{ *//* ... */ Private macro /* Private variables ---------------------------------------------------------*/ /** @defgroup TS3510_Private_Variables * @{ *//* ... */ /* Touch screen driver structure initialization */ 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 -----------------------------------------------*/ /** @defgroup ts3510_Private_Function_Prototypes * @{ *//* ... */ Private function prototypes /* Private functions ---------------------------------------------------------*/ /** @defgroup ts3510_Private_Functions * @{ *//* ... */ /** * @brief Initialize the ts3510 and configure the needed hardware resources * @param DeviceAddr: Device address on communication Bus. * @retval None *//* ... */ void ts3510_Init(uint16_t DeviceAddr) { /* Initialize IO BUS layer */ IOE_Init(); }{ ... } /** * @brief Reset the ts3510 by Software. * @param DeviceAddr: Device address on communication Bus. * @retval None *//* ... */ void ts3510_Reset(uint16_t DeviceAddr) { }{ ... } /** * @brief Read the ts3510 IO Expander device ID. * @param DeviceAddr: Device address on communication Bus. * @retval The Device ID (two bytes). *//* ... */ uint16_t ts3510_ReadID(uint16_t DeviceAddr) { return 0; }{ ... } /** * @brief Configures the touch Screen Controller (Single point detection) * @param DeviceAddr: Device address on communication Bus. * @retval None. *//* ... */ void ts3510_TS_Start(uint16_t DeviceAddr) { }{ ... } /** * @brief Return if there is touch detected or not. * @param DeviceAddr: Device address on communication Bus. * @retval Touch detected state. *//* ... */ uint8_t ts3510_TS_DetectTouch(uint16_t DeviceAddr) { uint8_t aBufferTS[11]; uint8_t aTmpBuffer[2] = {TS3510_READ_CMD, TS3510_WRITE_CMD}; /* Prepare for LCD read data */ IOE_WriteMultiple(DeviceAddr, TS3510_SEND_CMD_REG, aTmpBuffer, 2); /* Read TS data from LCD */ IOE_ReadMultiple(DeviceAddr, TS3510_READ_BLOCK_REG, aBufferTS, 11); /* check for first byte */ 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 { ... } }{ ... } /** * @brief Get the touch screen X and Y positions values * @param DeviceAddr: Device address on communication Bus. * @param X: Pointer to X position value * @param Y: Pointer to Y position value * @retval None. *//* ... */ 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}; /* Prepare for LCD read data */ IOE_WriteMultiple(DeviceAddr, TS3510_SEND_CMD_REG, aTmpBuffer, 2); /* Read TS data from LCD */ IOE_ReadMultiple(DeviceAddr, TS3510_READ_BLOCK_REG, aBufferTS, 11); /* Calculate positions */ *X = (((aBufferTS[1] << 8) | aBufferTS[2]) << 12) / 640; *Y = (((aBufferTS[3] << 8) | aBufferTS[4]) << 12) / 480; /* set position to be relative to 12bits resolution */ }{ ... } /** * @brief Configure the selected source to generate a global interrupt or not * @param DeviceAddr: Device address on communication Bus. * @retval None *//* ... */ void ts3510_TS_EnableIT(uint16_t DeviceAddr) { }{ ... } /** * @brief Configure the selected source to generate a global interrupt or not * @param DeviceAddr: Device address on communication Bus. * @retval None *//* ... */ void ts3510_TS_DisableIT(uint16_t DeviceAddr) { }{ ... } /** * @brief Configure the selected source to generate a global interrupt or not * @param DeviceAddr: Device address on communication Bus. * @retval TS interrupts status *//* ... */ uint8_t ts3510_TS_ITStatus(uint16_t DeviceAddr) { return 0; }{ ... } /** * @brief Configure the selected source to generate a global interrupt or not * @param DeviceAddr: Device address on communication Bus. * @retval None *//* ... */ void ts3510_TS_ClearIT(uint16_t DeviceAddr) { }{ ... } /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */