STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
ts3510.c
Go to the documentation of this file.
1 
39 /* Includes ------------------------------------------------------------------*/
40 #include "ts3510.h"
41 
54 /* Private typedef -----------------------------------------------------------*/
55 
60 /* Private define ------------------------------------------------------------*/
61 
66 /* Private macro -------------------------------------------------------------*/
67 
72 /* Private variables ---------------------------------------------------------*/
73 
78 /* Touch screen driver structure initialization */
80 {
84 
88 
93 };
94 
99 /* Private function prototypes -----------------------------------------------*/
100 
105 /* Private functions ---------------------------------------------------------*/
106 
116 void ts3510_Init(uint16_t DeviceAddr)
117 {
118  /* Initialize IO BUS layer */
119  IOE_Init();
120 
121 }
122 
128 void ts3510_Reset(uint16_t DeviceAddr)
129 {
130 
131 }
132 
138 uint16_t ts3510_ReadID(uint16_t DeviceAddr)
139 {
140  return 0;
141 }
142 
148 void ts3510_TS_Start(uint16_t DeviceAddr)
149 {
150 }
151 
157 uint8_t ts3510_TS_DetectTouch(uint16_t DeviceAddr)
158 {
159  uint8_t aBufferTS[11];
160  uint8_t aTmpBuffer[2] = {TS3510_READ_CMD, TS3510_WRITE_CMD};
161 
162  /* Prepare for LCD read data */
163  IOE_WriteMultiple(DeviceAddr, TS3510_SEND_CMD_REG, aTmpBuffer, 2);
164 
165  /* Read TS data from LCD */
166  IOE_ReadMultiple(DeviceAddr, TS3510_READ_BLOCK_REG, aBufferTS, 11);
167 
168  /* check for first byte */
169  if((aBufferTS[1] == 0xFF) && (aBufferTS[2] == 0xFF) && (aBufferTS[3] == 0xFF) && (aBufferTS[4] == 0xFF))
170  {
171  return 0;
172  }
173  else
174  {
175  return 1;
176  }
177 }
178 
186 void ts3510_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
187 {
188  uint8_t aBufferTS[11];
189  uint8_t aTmpBuffer[2] = {TS3510_READ_CMD, TS3510_WRITE_CMD};
190 
191  /* Prepare for LCD read data */
192  IOE_WriteMultiple(DeviceAddr, TS3510_SEND_CMD_REG, aTmpBuffer, 2);
193 
194  /* Read TS data from LCD */
195  IOE_ReadMultiple(DeviceAddr, TS3510_READ_BLOCK_REG, aBufferTS, 11);
196 
197  /* Calculate positions */
198  *X = (((aBufferTS[1] << 8) | aBufferTS[2]) << 12) / 640;
199  *Y = (((aBufferTS[3] << 8) | aBufferTS[4]) << 12) / 480;
200 
201  /* set position to be relative to 12bits resolution */
202 }
203 
209 void ts3510_TS_EnableIT(uint16_t DeviceAddr)
210 {
211 }
212 
218 void ts3510_TS_DisableIT(uint16_t DeviceAddr)
219 {
220 }
221 
227 uint8_t ts3510_TS_ITStatus(uint16_t DeviceAddr)
228 {
229  return 0;
230 }
231 
237 void ts3510_TS_ClearIT(uint16_t DeviceAddr)
238 {
239 }
240 
256 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#define TS3510_READ_CMD
Definition: ts3510.h:77
void IOE_WriteMultiple(uint8_t addr, uint8_t reg, uint8_t *buffer, uint16_t length)
uint16_t ts3510_ReadID(uint16_t DeviceAddr)
Read the ts3510 IO Expander device ID.
Definition: ts3510.c:138
void ts3510_Init(uint16_t DeviceAddr)
Initialize the ts3510 and configure the needed hardware resources.
Definition: ts3510.c:116
void ts3510_Reset(uint16_t DeviceAddr)
Reset the ts3510 by Software.
Definition: ts3510.c:128
void ts3510_TS_ClearIT(uint16_t DeviceAddr)
Configure the selected source to generate a global interrupt or not.
Definition: ts3510.c:237
TS_DrvTypeDef ts3510_ts_drv
Definition: ts3510.c:79
uint8_t aBufferTS[10]
Definition: exc7200.c:95
#define TS3510_READ_BLOCK_REG
Definition: ts3510.h:75
void ts3510_TS_Start(uint16_t DeviceAddr)
Configures the touch Screen Controller (Single point detection)
Definition: ts3510.c:148
uint16_t IOE_ReadMultiple(uint8_t addr, uint8_t reg, uint8_t *buffer, uint16_t length)
uint8_t ts3510_TS_ITStatus(uint16_t DeviceAddr)
Configure the selected source to generate a global interrupt or not.
Definition: ts3510.c:227
#define TS3510_SEND_CMD_REG
Definition: ts3510.h:76
void ts3510_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
Get the touch screen X and Y positions values.
Definition: ts3510.c:186
This file contains all the functions prototypes for the ts3510.c IO expander driver.
uint8_t ts3510_TS_DetectTouch(uint16_t DeviceAddr)
Return if there is touch detected or not.
Definition: ts3510.c:157
void ts3510_TS_DisableIT(uint16_t DeviceAddr)
Configure the selected source to generate a global interrupt or not.
Definition: ts3510.c:218
void IOE_Init(void)
void ts3510_TS_EnableIT(uint16_t DeviceAddr)
Configure the selected source to generate a global interrupt or not.
Definition: ts3510.c:209
#define TS3510_WRITE_CMD
Definition: ts3510.h:78