-
-
Notifications
You must be signed in to change notification settings - Fork 436
/
tm_stm32_touch_ts3510.h
164 lines (145 loc) · 3.86 KB
/
tm_stm32_touch_ts3510.h
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
/**
* @author Tilen MAJERLE
* @email tilen@majerle.eu
* @website http://stm32f4-discovery.net
* @link http://stm32f4-discovery.net/2015/08/hal-library-23-touch-for-stm32fxxx/
* @version v1.0
* @ide Keil uVision
* @license MIT
* @brief TS3510 low level library
*
\verbatim
----------------------------------------------------------------------
Copyright (c) 2016 Tilen MAJERLE
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------
\endverbatim
*/
#ifndef TM_TOUCH_TS3510_H
#define TM_TOUCH_TS3510_H 100
/* C++ detection */
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup TM_STM32Fxxx_HAL_Libraries
* @{
*/
/**
* @defgroup TM_TOUCH_TS3510
* @brief TS3510 low level library - http://stm32f4-discovery.net/2015/08/hal-library-23-touch-for-stm32fxxx/
* @{
*
* This is a low-level driver for TS3510 touch screen controller.
*
* To use this library, check @ref TM_TOUCH library on how to use it properly.
*
* \par Select custom I2C
*
* This touch controller is used on STM32F39-EVAL board and settings for I2C are for this board by default.
* If you have own board and you need custom pins for I2C, open defines.h file and add/edit following lines.
*
\code
//Select I2C for TS3510 conroller
#define TOUCH_TS3510_I2C I2C1
#define TOUCH_TS3510_I2C_PP TM_I2C_PinsPack_3
\endcode
*
* @note Check @ref TM_I2C library for corresponding pins for selected I2C peripheral and pinspack
*
* \par Changelog
*
\verbatim
Version 1.0
- First release
\endverbatim
*
* \par Dependencies
*
\verbatim
- STM32Fxxx HAL
- defines.h
- TM TOUCH
- TM I2C
- TM GPIO
\endverbatim
*/
#include "stm32fxxx_hal.h"
#include "defines.h"
#include "tm_stm32_i2c.h"
#include "tm_stm32_touch.h"
/**
* @defgroup TM_TOUCH_TS3510_Macros
* @brief Library defines
* @{
*/
/* Touch I2C settings */
#ifndef TOUCH_TS3510_I2C
#define TOUCH_TS3510_I2C I2C1
#define TOUCH_TS3510_I2C_PP TM_I2C_PinsPack_3
#endif
/* I2C device address */
#define TOUCH_TS3510_I2C_DEV 0x80
/**
* @}
*/
/**
* @defgroup TM_TOUCH_TS3510_Typedefs
* @brief Library Typedefs
* @{
*/
/* Typedefs here */
/**
* @}
*/
/**
* @defgroup TM_TOUCH_TS3510_Functions
* @brief Library Functions
* @{
*/
/**
* @brief Initializes TS3510 touch controller
* @param *TS: Pointer to @ref TM_TOUCH_t structure with settings
* @retval Touch status:
* - 0: OK
* - > 0: Error
*/
uint8_t TM_TOUCH_TS3510_Init(TM_TOUCH_t* TS);
/**
* @brief Reads touch data from TS3510 touch controller
* @param *TS: Pointer to @ref TM_TOUCH_t to save data into
* @retval Touch status:
* - 0: OK
* - > 0: Error
*/
uint8_t TM_TOUCH_TS3510_Read(TM_TOUCH_t* TS);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/* C++ detection */
#ifdef __cplusplus
}
#endif
#endif