updated wait_ms(ms) to thread_sleep_for(ms) for Mbed OS 6

Committer:
Jerome Coutant
Date:
Tue May 16 10:50:26 2017 +0200
Revision:
2:123b894b49dd
STM32Cube_FW_BSP_DISCO_F469NI

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jerome Coutant 2:123b894b49dd 1 /**
Jerome Coutant 2:123b894b49dd 2 ******************************************************************************
Jerome Coutant 2:123b894b49dd 3 * @file ft6x06.h
Jerome Coutant 2:123b894b49dd 4 * @author MCD Application Team
Jerome Coutant 2:123b894b49dd 5 * @version V1.0.1
Jerome Coutant 2:123b894b49dd 6 * @date 03-May-2016
Jerome Coutant 2:123b894b49dd 7 * @brief This file contains all the functions prototypes for the
Jerome Coutant 2:123b894b49dd 8 * ft6x06.c IO expander driver.
Jerome Coutant 2:123b894b49dd 9 ******************************************************************************
Jerome Coutant 2:123b894b49dd 10 * @attention
Jerome Coutant 2:123b894b49dd 11 *
Jerome Coutant 2:123b894b49dd 12 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
Jerome Coutant 2:123b894b49dd 13 *
Jerome Coutant 2:123b894b49dd 14 * Redistribution and use in source and binary forms, with or without modification,
Jerome Coutant 2:123b894b49dd 15 * are permitted provided that the following conditions are met:
Jerome Coutant 2:123b894b49dd 16 * 1. Redistributions of source code must retain the above copyright notice,
Jerome Coutant 2:123b894b49dd 17 * this list of conditions and the following disclaimer.
Jerome Coutant 2:123b894b49dd 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
Jerome Coutant 2:123b894b49dd 19 * this list of conditions and the following disclaimer in the documentation
Jerome Coutant 2:123b894b49dd 20 * and/or other materials provided with the distribution.
Jerome Coutant 2:123b894b49dd 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Jerome Coutant 2:123b894b49dd 22 * may be used to endorse or promote products derived from this software
Jerome Coutant 2:123b894b49dd 23 * without specific prior written permission.
Jerome Coutant 2:123b894b49dd 24 *
Jerome Coutant 2:123b894b49dd 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Jerome Coutant 2:123b894b49dd 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Jerome Coutant 2:123b894b49dd 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Jerome Coutant 2:123b894b49dd 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Jerome Coutant 2:123b894b49dd 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Jerome Coutant 2:123b894b49dd 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Jerome Coutant 2:123b894b49dd 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Jerome Coutant 2:123b894b49dd 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Jerome Coutant 2:123b894b49dd 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Jerome Coutant 2:123b894b49dd 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Jerome Coutant 2:123b894b49dd 35 *
Jerome Coutant 2:123b894b49dd 36 ******************************************************************************
Jerome Coutant 2:123b894b49dd 37 */
Jerome Coutant 2:123b894b49dd 38
Jerome Coutant 2:123b894b49dd 39 /* Define to prevent recursive inclusion -------------------------------------*/
Jerome Coutant 2:123b894b49dd 40 #ifndef __FT6X06_H
Jerome Coutant 2:123b894b49dd 41 #define __FT6X06_H
Jerome Coutant 2:123b894b49dd 42
Jerome Coutant 2:123b894b49dd 43 #ifdef __cplusplus
Jerome Coutant 2:123b894b49dd 44 extern "C" {
Jerome Coutant 2:123b894b49dd 45 #endif
Jerome Coutant 2:123b894b49dd 46
Jerome Coutant 2:123b894b49dd 47 /* Set Multi-touch as non supported */
Jerome Coutant 2:123b894b49dd 48 #ifndef TS_MULTI_TOUCH_SUPPORTED
Jerome Coutant 2:123b894b49dd 49 #define TS_MULTI_TOUCH_SUPPORTED 0
Jerome Coutant 2:123b894b49dd 50 #endif
Jerome Coutant 2:123b894b49dd 51
Jerome Coutant 2:123b894b49dd 52 /* Set Auto-calibration as non supported */
Jerome Coutant 2:123b894b49dd 53 #ifndef TS_AUTO_CALIBRATION_SUPPORTED
Jerome Coutant 2:123b894b49dd 54 #define TS_AUTO_CALIBRATION_SUPPORTED 0
Jerome Coutant 2:123b894b49dd 55 #endif
Jerome Coutant 2:123b894b49dd 56
Jerome Coutant 2:123b894b49dd 57 /* Includes ------------------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 58 #include "../Common/ts.h"
Jerome Coutant 2:123b894b49dd 59
Jerome Coutant 2:123b894b49dd 60 /* Macros --------------------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 61
Jerome Coutant 2:123b894b49dd 62 /** @typedef ft6x06_handle_TypeDef
Jerome Coutant 2:123b894b49dd 63 * ft6x06 Handle definition.
Jerome Coutant 2:123b894b49dd 64 */
Jerome Coutant 2:123b894b49dd 65 typedef struct
Jerome Coutant 2:123b894b49dd 66 {
Jerome Coutant 2:123b894b49dd 67 uint8_t i2cInitialized;
Jerome Coutant 2:123b894b49dd 68
Jerome Coutant 2:123b894b49dd 69 /* field holding the current number of simultaneous active touches */
Jerome Coutant 2:123b894b49dd 70 uint8_t currActiveTouchNb;
Jerome Coutant 2:123b894b49dd 71
Jerome Coutant 2:123b894b49dd 72 /* field holding the touch index currently managed */
Jerome Coutant 2:123b894b49dd 73 uint8_t currActiveTouchIdx;
Jerome Coutant 2:123b894b49dd 74
Jerome Coutant 2:123b894b49dd 75 } ft6x06_handle_TypeDef;
Jerome Coutant 2:123b894b49dd 76
Jerome Coutant 2:123b894b49dd 77 /** @addtogroup BSP
Jerome Coutant 2:123b894b49dd 78 * @{
Jerome Coutant 2:123b894b49dd 79 */
Jerome Coutant 2:123b894b49dd 80
Jerome Coutant 2:123b894b49dd 81 /** @addtogroup Component
Jerome Coutant 2:123b894b49dd 82 * @{
Jerome Coutant 2:123b894b49dd 83 */
Jerome Coutant 2:123b894b49dd 84
Jerome Coutant 2:123b894b49dd 85 /** @defgroup FT6X06
Jerome Coutant 2:123b894b49dd 86 * @{
Jerome Coutant 2:123b894b49dd 87 */
Jerome Coutant 2:123b894b49dd 88
Jerome Coutant 2:123b894b49dd 89 /* Exported types ------------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 90
Jerome Coutant 2:123b894b49dd 91 /** @defgroup FT6X06_Exported_Types
Jerome Coutant 2:123b894b49dd 92 * @{
Jerome Coutant 2:123b894b49dd 93 */
Jerome Coutant 2:123b894b49dd 94
Jerome Coutant 2:123b894b49dd 95 /* Exported constants --------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 96
Jerome Coutant 2:123b894b49dd 97 /** @defgroup FT6X06_Exported_Constants
Jerome Coutant 2:123b894b49dd 98 * @{
Jerome Coutant 2:123b894b49dd 99 */
Jerome Coutant 2:123b894b49dd 100
Jerome Coutant 2:123b894b49dd 101 /* Maximum border values of the touchscreen pad */
Jerome Coutant 2:123b894b49dd 102 #define FT_6206_MAX_WIDTH ((uint16_t)800) /* Touchscreen pad max width */
Jerome Coutant 2:123b894b49dd 103 #define FT_6206_MAX_HEIGHT ((uint16_t)480) /* Touchscreen pad max height */
Jerome Coutant 2:123b894b49dd 104
Jerome Coutant 2:123b894b49dd 105 /* Touchscreen pad max width and height values for FT6x36 Touch*/
Jerome Coutant 2:123b894b49dd 106 #define FT_6206_MAX_WIDTH_HEIGHT ((uint16_t)240)
Jerome Coutant 2:123b894b49dd 107
Jerome Coutant 2:123b894b49dd 108 /* Possible values of driver functions return status */
Jerome Coutant 2:123b894b49dd 109 #define FT6206_STATUS_OK 0
Jerome Coutant 2:123b894b49dd 110 #define FT6206_STATUS_NOT_OK 1
Jerome Coutant 2:123b894b49dd 111
Jerome Coutant 2:123b894b49dd 112 /* Possible values of global variable 'TS_I2C_Initialized' */
Jerome Coutant 2:123b894b49dd 113 #define FT6206_I2C_NOT_INITIALIZED 0
Jerome Coutant 2:123b894b49dd 114 #define FT6206_I2C_INITIALIZED 1
Jerome Coutant 2:123b894b49dd 115
Jerome Coutant 2:123b894b49dd 116 /* Max detectable simultaneous touches */
Jerome Coutant 2:123b894b49dd 117 #define FT6206_MAX_DETECTABLE_TOUCH 2
Jerome Coutant 2:123b894b49dd 118
Jerome Coutant 2:123b894b49dd 119 /**
Jerome Coutant 2:123b894b49dd 120 * @brief : Definitions for FT6206 I2C register addresses on 8 bit
Jerome Coutant 2:123b894b49dd 121 **/
Jerome Coutant 2:123b894b49dd 122
Jerome Coutant 2:123b894b49dd 123 /* Current mode register of the FT6206 (R/W) */
Jerome Coutant 2:123b894b49dd 124 #define FT6206_DEV_MODE_REG 0x00
Jerome Coutant 2:123b894b49dd 125
Jerome Coutant 2:123b894b49dd 126 /* Possible values of FT6206_DEV_MODE_REG */
Jerome Coutant 2:123b894b49dd 127 #define FT6206_DEV_MODE_WORKING 0x00
Jerome Coutant 2:123b894b49dd 128 #define FT6206_DEV_MODE_FACTORY 0x04
Jerome Coutant 2:123b894b49dd 129
Jerome Coutant 2:123b894b49dd 130 #define FT6206_DEV_MODE_MASK 0x7
Jerome Coutant 2:123b894b49dd 131 #define FT6206_DEV_MODE_SHIFT 4
Jerome Coutant 2:123b894b49dd 132
Jerome Coutant 2:123b894b49dd 133 /* Gesture ID register */
Jerome Coutant 2:123b894b49dd 134 #define FT6206_GEST_ID_REG 0x01
Jerome Coutant 2:123b894b49dd 135
Jerome Coutant 2:123b894b49dd 136 /* Possible values of FT6206_GEST_ID_REG */
Jerome Coutant 2:123b894b49dd 137 #define FT6206_GEST_ID_NO_GESTURE 0x00
Jerome Coutant 2:123b894b49dd 138 #define FT6206_GEST_ID_MOVE_UP 0x10
Jerome Coutant 2:123b894b49dd 139 #define FT6206_GEST_ID_MOVE_RIGHT 0x14
Jerome Coutant 2:123b894b49dd 140 #define FT6206_GEST_ID_MOVE_DOWN 0x18
Jerome Coutant 2:123b894b49dd 141 #define FT6206_GEST_ID_MOVE_LEFT 0x1C
Jerome Coutant 2:123b894b49dd 142 #define FT6206_GEST_ID_ZOOM_IN 0x48
Jerome Coutant 2:123b894b49dd 143 #define FT6206_GEST_ID_ZOOM_OUT 0x49
Jerome Coutant 2:123b894b49dd 144
Jerome Coutant 2:123b894b49dd 145 /* Touch Data Status register : gives number of active touch points (0..2) */
Jerome Coutant 2:123b894b49dd 146 #define FT6206_TD_STAT_REG 0x02
Jerome Coutant 2:123b894b49dd 147
Jerome Coutant 2:123b894b49dd 148 /* Values related to FT6206_TD_STAT_REG */
Jerome Coutant 2:123b894b49dd 149 #define FT6206_TD_STAT_MASK 0x0F
Jerome Coutant 2:123b894b49dd 150 #define FT6206_TD_STAT_SHIFT 0x00
Jerome Coutant 2:123b894b49dd 151
Jerome Coutant 2:123b894b49dd 152 /* Values Pn_XH and Pn_YH related */
Jerome Coutant 2:123b894b49dd 153 #define FT6206_TOUCH_EVT_FLAG_PRESS_DOWN 0x00
Jerome Coutant 2:123b894b49dd 154 #define FT6206_TOUCH_EVT_FLAG_LIFT_UP 0x01
Jerome Coutant 2:123b894b49dd 155 #define FT6206_TOUCH_EVT_FLAG_CONTACT 0x02
Jerome Coutant 2:123b894b49dd 156 #define FT6206_TOUCH_EVT_FLAG_NO_EVENT 0x03
Jerome Coutant 2:123b894b49dd 157
Jerome Coutant 2:123b894b49dd 158 #define FT6206_TOUCH_EVT_FLAG_SHIFT 6
Jerome Coutant 2:123b894b49dd 159 #define FT6206_TOUCH_EVT_FLAG_MASK (3 << FT6206_TOUCH_EVT_FLAG_SHIFT)
Jerome Coutant 2:123b894b49dd 160
Jerome Coutant 2:123b894b49dd 161 #define FT6206_MSB_MASK 0x0F
Jerome Coutant 2:123b894b49dd 162 #define FT6206_MSB_SHIFT 0
Jerome Coutant 2:123b894b49dd 163
Jerome Coutant 2:123b894b49dd 164 /* Values Pn_XL and Pn_YL related */
Jerome Coutant 2:123b894b49dd 165 #define FT6206_LSB_MASK 0xFF
Jerome Coutant 2:123b894b49dd 166 #define FT6206_LSB_SHIFT 0
Jerome Coutant 2:123b894b49dd 167
Jerome Coutant 2:123b894b49dd 168 #define FT6206_P1_XH_REG 0x03
Jerome Coutant 2:123b894b49dd 169 #define FT6206_P1_XL_REG 0x04
Jerome Coutant 2:123b894b49dd 170 #define FT6206_P1_YH_REG 0x05
Jerome Coutant 2:123b894b49dd 171 #define FT6206_P1_YL_REG 0x06
Jerome Coutant 2:123b894b49dd 172
Jerome Coutant 2:123b894b49dd 173 /* Touch Pressure register value (R) */
Jerome Coutant 2:123b894b49dd 174 #define FT6206_P1_WEIGHT_REG 0x07
Jerome Coutant 2:123b894b49dd 175
Jerome Coutant 2:123b894b49dd 176 /* Values Pn_WEIGHT related */
Jerome Coutant 2:123b894b49dd 177 #define FT6206_TOUCH_WEIGHT_MASK 0xFF
Jerome Coutant 2:123b894b49dd 178 #define FT6206_TOUCH_WEIGHT_SHIFT 0
Jerome Coutant 2:123b894b49dd 179
Jerome Coutant 2:123b894b49dd 180 /* Touch area register */
Jerome Coutant 2:123b894b49dd 181 #define FT6206_P1_MISC_REG 0x08
Jerome Coutant 2:123b894b49dd 182
Jerome Coutant 2:123b894b49dd 183 /* Values related to FT6206_Pn_MISC_REG */
Jerome Coutant 2:123b894b49dd 184 #define FT6206_TOUCH_AREA_MASK (0x04 << 4)
Jerome Coutant 2:123b894b49dd 185 #define FT6206_TOUCH_AREA_SHIFT 0x04
Jerome Coutant 2:123b894b49dd 186
Jerome Coutant 2:123b894b49dd 187 #define FT6206_P2_XH_REG 0x09
Jerome Coutant 2:123b894b49dd 188 #define FT6206_P2_XL_REG 0x0A
Jerome Coutant 2:123b894b49dd 189 #define FT6206_P2_YH_REG 0x0B
Jerome Coutant 2:123b894b49dd 190 #define FT6206_P2_YL_REG 0x0C
Jerome Coutant 2:123b894b49dd 191 #define FT6206_P2_WEIGHT_REG 0x0D
Jerome Coutant 2:123b894b49dd 192 #define FT6206_P2_MISC_REG 0x0E
Jerome Coutant 2:123b894b49dd 193
Jerome Coutant 2:123b894b49dd 194 /* Threshold for touch detection */
Jerome Coutant 2:123b894b49dd 195 #define FT6206_TH_GROUP_REG 0x80
Jerome Coutant 2:123b894b49dd 196
Jerome Coutant 2:123b894b49dd 197 /* Values FT6206_TH_GROUP_REG : threshold related */
Jerome Coutant 2:123b894b49dd 198 #define FT6206_THRESHOLD_MASK 0xFF
Jerome Coutant 2:123b894b49dd 199 #define FT6206_THRESHOLD_SHIFT 0
Jerome Coutant 2:123b894b49dd 200
Jerome Coutant 2:123b894b49dd 201 /* Filter function coefficients */
Jerome Coutant 2:123b894b49dd 202 #define FT6206_TH_DIFF_REG 0x85
Jerome Coutant 2:123b894b49dd 203
Jerome Coutant 2:123b894b49dd 204 /* Control register */
Jerome Coutant 2:123b894b49dd 205 #define FT6206_CTRL_REG 0x86
Jerome Coutant 2:123b894b49dd 206
Jerome Coutant 2:123b894b49dd 207 /* Values related to FT6206_CTRL_REG */
Jerome Coutant 2:123b894b49dd 208
Jerome Coutant 2:123b894b49dd 209 /* Will keep the Active mode when there is no touching */
Jerome Coutant 2:123b894b49dd 210 #define FT6206_CTRL_KEEP_ACTIVE_MODE 0x00
Jerome Coutant 2:123b894b49dd 211
Jerome Coutant 2:123b894b49dd 212 /* Switching from Active mode to Monitor mode automatically when there is no touching */
Jerome Coutant 2:123b894b49dd 213 #define FT6206_CTRL_KEEP_AUTO_SWITCH_MONITOR_MODE 0x01
Jerome Coutant 2:123b894b49dd 214
Jerome Coutant 2:123b894b49dd 215 /* The time period of switching from Active mode to Monitor mode when there is no touching */
Jerome Coutant 2:123b894b49dd 216 #define FT6206_TIMEENTERMONITOR_REG 0x87
Jerome Coutant 2:123b894b49dd 217
Jerome Coutant 2:123b894b49dd 218 /* Report rate in Active mode */
Jerome Coutant 2:123b894b49dd 219 #define FT6206_PERIODACTIVE_REG 0x88
Jerome Coutant 2:123b894b49dd 220
Jerome Coutant 2:123b894b49dd 221 /* Report rate in Monitor mode */
Jerome Coutant 2:123b894b49dd 222 #define FT6206_PERIODMONITOR_REG 0x89
Jerome Coutant 2:123b894b49dd 223
Jerome Coutant 2:123b894b49dd 224 /* The value of the minimum allowed angle while Rotating gesture mode */
Jerome Coutant 2:123b894b49dd 225 #define FT6206_RADIAN_VALUE_REG 0x91
Jerome Coutant 2:123b894b49dd 226
Jerome Coutant 2:123b894b49dd 227 /* Maximum offset while Moving Left and Moving Right gesture */
Jerome Coutant 2:123b894b49dd 228 #define FT6206_OFFSET_LEFT_RIGHT_REG 0x92
Jerome Coutant 2:123b894b49dd 229
Jerome Coutant 2:123b894b49dd 230 /* Maximum offset while Moving Up and Moving Down gesture */
Jerome Coutant 2:123b894b49dd 231 #define FT6206_OFFSET_UP_DOWN_REG 0x93
Jerome Coutant 2:123b894b49dd 232
Jerome Coutant 2:123b894b49dd 233 /* Minimum distance while Moving Left and Moving Right gesture */
Jerome Coutant 2:123b894b49dd 234 #define FT6206_DISTANCE_LEFT_RIGHT_REG 0x94
Jerome Coutant 2:123b894b49dd 235
Jerome Coutant 2:123b894b49dd 236 /* Minimum distance while Moving Up and Moving Down gesture */
Jerome Coutant 2:123b894b49dd 237 #define FT6206_DISTANCE_UP_DOWN_REG 0x95
Jerome Coutant 2:123b894b49dd 238
Jerome Coutant 2:123b894b49dd 239 /* Maximum distance while Zoom In and Zoom Out gesture */
Jerome Coutant 2:123b894b49dd 240 #define FT6206_DISTANCE_ZOOM_REG 0x96
Jerome Coutant 2:123b894b49dd 241
Jerome Coutant 2:123b894b49dd 242 /* High 8-bit of LIB Version info */
Jerome Coutant 2:123b894b49dd 243 #define FT6206_LIB_VER_H_REG 0xA1
Jerome Coutant 2:123b894b49dd 244
Jerome Coutant 2:123b894b49dd 245 /* Low 8-bit of LIB Version info */
Jerome Coutant 2:123b894b49dd 246 #define FT6206_LIB_VER_L_REG 0xA2
Jerome Coutant 2:123b894b49dd 247
Jerome Coutant 2:123b894b49dd 248 /* Chip Selecting */
Jerome Coutant 2:123b894b49dd 249 #define FT6206_CIPHER_REG 0xA3
Jerome Coutant 2:123b894b49dd 250
Jerome Coutant 2:123b894b49dd 251 /* Interrupt mode register (used when in interrupt mode) */
Jerome Coutant 2:123b894b49dd 252 #define FT6206_GMODE_REG 0xA4
Jerome Coutant 2:123b894b49dd 253
Jerome Coutant 2:123b894b49dd 254 #define FT6206_G_MODE_INTERRUPT_MASK 0x03
Jerome Coutant 2:123b894b49dd 255 #define FT6206_G_MODE_INTERRUPT_SHIFT 0x00
Jerome Coutant 2:123b894b49dd 256
Jerome Coutant 2:123b894b49dd 257 /* Possible values of FT6206_GMODE_REG */
Jerome Coutant 2:123b894b49dd 258 #define FT6206_G_MODE_INTERRUPT_POLLING 0x00
Jerome Coutant 2:123b894b49dd 259 #define FT6206_G_MODE_INTERRUPT_TRIGGER 0x01
Jerome Coutant 2:123b894b49dd 260
Jerome Coutant 2:123b894b49dd 261 /* Current power mode the FT6206 system is in (R) */
Jerome Coutant 2:123b894b49dd 262 #define FT6206_PWR_MODE_REG 0xA5
Jerome Coutant 2:123b894b49dd 263
Jerome Coutant 2:123b894b49dd 264 /* FT6206 firmware version */
Jerome Coutant 2:123b894b49dd 265 #define FT6206_FIRMID_REG 0xA6
Jerome Coutant 2:123b894b49dd 266
Jerome Coutant 2:123b894b49dd 267 /* FT6206 Chip identification register */
Jerome Coutant 2:123b894b49dd 268 #define FT6206_CHIP_ID_REG 0xA8
Jerome Coutant 2:123b894b49dd 269
Jerome Coutant 2:123b894b49dd 270 /* Possible values of FT6206_CHIP_ID_REG */
Jerome Coutant 2:123b894b49dd 271 #define FT6206_ID_VALUE 0x11
Jerome Coutant 2:123b894b49dd 272 #define FT6x36_ID_VALUE 0xCD
Jerome Coutant 2:123b894b49dd 273
Jerome Coutant 2:123b894b49dd 274 /* Release code version */
Jerome Coutant 2:123b894b49dd 275 #define FT6206_RELEASE_CODE_ID_REG 0xAF
Jerome Coutant 2:123b894b49dd 276
Jerome Coutant 2:123b894b49dd 277 /* Current operating mode the FT6206 system is in (R) */
Jerome Coutant 2:123b894b49dd 278 #define FT6206_STATE_REG 0xBC
Jerome Coutant 2:123b894b49dd 279
Jerome Coutant 2:123b894b49dd 280 /**
Jerome Coutant 2:123b894b49dd 281 * @}
Jerome Coutant 2:123b894b49dd 282 */
Jerome Coutant 2:123b894b49dd 283
Jerome Coutant 2:123b894b49dd 284 /* Exported macro ------------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 285
Jerome Coutant 2:123b894b49dd 286 /** @defgroup ft6x06_Exported_Macros
Jerome Coutant 2:123b894b49dd 287 * @{
Jerome Coutant 2:123b894b49dd 288 */
Jerome Coutant 2:123b894b49dd 289
Jerome Coutant 2:123b894b49dd 290 /* Exported functions --------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 291
Jerome Coutant 2:123b894b49dd 292 /** @defgroup ft6x06_Exported_Functions
Jerome Coutant 2:123b894b49dd 293 * @{
Jerome Coutant 2:123b894b49dd 294 */
Jerome Coutant 2:123b894b49dd 295
Jerome Coutant 2:123b894b49dd 296 /**
Jerome Coutant 2:123b894b49dd 297 * @brief ft6x06 Control functions
Jerome Coutant 2:123b894b49dd 298 */
Jerome Coutant 2:123b894b49dd 299
Jerome Coutant 2:123b894b49dd 300
Jerome Coutant 2:123b894b49dd 301 /**
Jerome Coutant 2:123b894b49dd 302 * @brief Initialize the ft6x06 communication bus
Jerome Coutant 2:123b894b49dd 303 * from MCU to FT6206 : ie I2C channel initialization (if required).
Jerome Coutant 2:123b894b49dd 304 * @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
Jerome Coutant 2:123b894b49dd 305 * @retval None
Jerome Coutant 2:123b894b49dd 306 */
Jerome Coutant 2:123b894b49dd 307 void ft6x06_Init(uint16_t DeviceAddr);
Jerome Coutant 2:123b894b49dd 308
Jerome Coutant 2:123b894b49dd 309 /**
Jerome Coutant 2:123b894b49dd 310 * @brief Software Reset the ft6x06.
Jerome Coutant 2:123b894b49dd 311 * @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
Jerome Coutant 2:123b894b49dd 312 * @retval None
Jerome Coutant 2:123b894b49dd 313 */
Jerome Coutant 2:123b894b49dd 314 void ft6x06_Reset(uint16_t DeviceAddr);
Jerome Coutant 2:123b894b49dd 315
Jerome Coutant 2:123b894b49dd 316 /**
Jerome Coutant 2:123b894b49dd 317 * @brief Read the ft6x06 device ID, pre intitalize I2C in case of need to be
Jerome Coutant 2:123b894b49dd 318 * able to read the FT6206 device ID, and verify this is a FT6206.
Jerome Coutant 2:123b894b49dd 319 * @param DeviceAddr: I2C FT6x06 Slave address.
Jerome Coutant 2:123b894b49dd 320 * @retval The Device ID (two bytes).
Jerome Coutant 2:123b894b49dd 321 */
Jerome Coutant 2:123b894b49dd 322 uint16_t ft6x06_ReadID(uint16_t DeviceAddr);
Jerome Coutant 2:123b894b49dd 323
Jerome Coutant 2:123b894b49dd 324 /**
Jerome Coutant 2:123b894b49dd 325 * @brief Configures the touch Screen IC device to start detecting touches
Jerome Coutant 2:123b894b49dd 326 * @param DeviceAddr: Device address on communication Bus (I2C slave address).
Jerome Coutant 2:123b894b49dd 327 * @retval None.
Jerome Coutant 2:123b894b49dd 328 */
Jerome Coutant 2:123b894b49dd 329 void ft6x06_TS_Start(uint16_t DeviceAddr);
Jerome Coutant 2:123b894b49dd 330
Jerome Coutant 2:123b894b49dd 331 /**
Jerome Coutant 2:123b894b49dd 332 * @brief Return if there is touches detected or not.
Jerome Coutant 2:123b894b49dd 333 * Try to detect new touches and forget the old ones (reset internal global
Jerome Coutant 2:123b894b49dd 334 * variables).
Jerome Coutant 2:123b894b49dd 335 * @param DeviceAddr: Device address on communication Bus.
Jerome Coutant 2:123b894b49dd 336 * @retval : Number of active touches detected (can be 0, 1 or 2).
Jerome Coutant 2:123b894b49dd 337 */
Jerome Coutant 2:123b894b49dd 338 uint8_t ft6x06_TS_DetectTouch(uint16_t DeviceAddr);
Jerome Coutant 2:123b894b49dd 339
Jerome Coutant 2:123b894b49dd 340 /**
Jerome Coutant 2:123b894b49dd 341 * @brief Get the touch screen X and Y positions values
Jerome Coutant 2:123b894b49dd 342 * Manage multi touch thanks to touch Index global
Jerome Coutant 2:123b894b49dd 343 * variable 'ft6x06_handle.currActiveTouchIdx'.
Jerome Coutant 2:123b894b49dd 344 * @param DeviceAddr: Device address on communication Bus.
Jerome Coutant 2:123b894b49dd 345 * @param X: Pointer to X position value
Jerome Coutant 2:123b894b49dd 346 * @param Y: Pointer to Y position value
Jerome Coutant 2:123b894b49dd 347 * @retval None.
Jerome Coutant 2:123b894b49dd 348 */
Jerome Coutant 2:123b894b49dd 349 void ft6x06_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y);
Jerome Coutant 2:123b894b49dd 350
Jerome Coutant 2:123b894b49dd 351 /**
Jerome Coutant 2:123b894b49dd 352 * @brief Configure the FT6206 device to generate IT on given INT pin
Jerome Coutant 2:123b894b49dd 353 * connected to MCU as EXTI.
Jerome Coutant 2:123b894b49dd 354 * @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT6206).
Jerome Coutant 2:123b894b49dd 355 * @retval None
Jerome Coutant 2:123b894b49dd 356 */
Jerome Coutant 2:123b894b49dd 357 void ft6x06_TS_EnableIT(uint16_t DeviceAddr);
Jerome Coutant 2:123b894b49dd 358
Jerome Coutant 2:123b894b49dd 359 /**
Jerome Coutant 2:123b894b49dd 360 * @brief Configure the FT6206 device to stop generating IT on the given INT pin
Jerome Coutant 2:123b894b49dd 361 * connected to MCU as EXTI.
Jerome Coutant 2:123b894b49dd 362 * @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT6206).
Jerome Coutant 2:123b894b49dd 363 * @retval None
Jerome Coutant 2:123b894b49dd 364 */
Jerome Coutant 2:123b894b49dd 365 void ft6x06_TS_DisableIT(uint16_t DeviceAddr);
Jerome Coutant 2:123b894b49dd 366
Jerome Coutant 2:123b894b49dd 367 /**
Jerome Coutant 2:123b894b49dd 368 * @brief Get IT status from FT6206 interrupt status registers
Jerome Coutant 2:123b894b49dd 369 * Should be called Following an EXTI coming to the MCU to know the detailed
Jerome Coutant 2:123b894b49dd 370 * reason of the interrupt.
Jerome Coutant 2:123b894b49dd 371 * @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
Jerome Coutant 2:123b894b49dd 372 * @retval TS interrupts status
Jerome Coutant 2:123b894b49dd 373 */
Jerome Coutant 2:123b894b49dd 374 uint8_t ft6x06_TS_ITStatus (uint16_t DeviceAddr);
Jerome Coutant 2:123b894b49dd 375
Jerome Coutant 2:123b894b49dd 376 /**
Jerome Coutant 2:123b894b49dd 377 * @brief Clear IT status in FT6206 interrupt status clear registers
Jerome Coutant 2:123b894b49dd 378 * Should be called Following an EXTI coming to the MCU.
Jerome Coutant 2:123b894b49dd 379 * @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
Jerome Coutant 2:123b894b49dd 380 * @retval TS interrupts status
Jerome Coutant 2:123b894b49dd 381 */
Jerome Coutant 2:123b894b49dd 382 void ft6x06_TS_ClearIT (uint16_t DeviceAddr);
Jerome Coutant 2:123b894b49dd 383
Jerome Coutant 2:123b894b49dd 384 /**** NEW FEATURES enabled when Multi-touch support is enabled ****/
Jerome Coutant 2:123b894b49dd 385
Jerome Coutant 2:123b894b49dd 386 #if (TS_MULTI_TOUCH_SUPPORTED == 1)
Jerome Coutant 2:123b894b49dd 387
Jerome Coutant 2:123b894b49dd 388 /**
Jerome Coutant 2:123b894b49dd 389 * @brief Get the last touch gesture identification (zoom, move up/down...).
Jerome Coutant 2:123b894b49dd 390 * @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6x06).
Jerome Coutant 2:123b894b49dd 391 * @param pGestureId : Pointer to get last touch gesture Identification.
Jerome Coutant 2:123b894b49dd 392 * @retval None.
Jerome Coutant 2:123b894b49dd 393 */
Jerome Coutant 2:123b894b49dd 394 void ft6x06_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId);
Jerome Coutant 2:123b894b49dd 395
Jerome Coutant 2:123b894b49dd 396 /**
Jerome Coutant 2:123b894b49dd 397 * @brief Get the touch detailed informations on touch number 'touchIdx' (0..1)
Jerome Coutant 2:123b894b49dd 398 * This touch detailed information contains :
Jerome Coutant 2:123b894b49dd 399 * - weight that was applied to this touch
Jerome Coutant 2:123b894b49dd 400 * - sub-area of the touch in the touch panel
Jerome Coutant 2:123b894b49dd 401 * - event of linked to the touch (press down, lift up, ...)
Jerome Coutant 2:123b894b49dd 402 * @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6x06).
Jerome Coutant 2:123b894b49dd 403 * @param touchIdx : Passed index of the touch (0..1) on which we want to get the
Jerome Coutant 2:123b894b49dd 404 * detailed information.
Jerome Coutant 2:123b894b49dd 405 * @param pWeight : Pointer to to get the weight information of 'touchIdx'.
Jerome Coutant 2:123b894b49dd 406 * @param pArea : Pointer to to get the sub-area information of 'touchIdx'.
Jerome Coutant 2:123b894b49dd 407 * @param pEvent : Pointer to to get the event information of 'touchIdx'.
Jerome Coutant 2:123b894b49dd 408
Jerome Coutant 2:123b894b49dd 409 * @retval None.
Jerome Coutant 2:123b894b49dd 410 */
Jerome Coutant 2:123b894b49dd 411 void ft6x06_TS_GetTouchInfo(uint16_t DeviceAddr,
Jerome Coutant 2:123b894b49dd 412 uint32_t touchIdx,
Jerome Coutant 2:123b894b49dd 413 uint32_t * pWeight,
Jerome Coutant 2:123b894b49dd 414 uint32_t * pArea,
Jerome Coutant 2:123b894b49dd 415 uint32_t * pEvent);
Jerome Coutant 2:123b894b49dd 416
Jerome Coutant 2:123b894b49dd 417 #endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */
Jerome Coutant 2:123b894b49dd 418
Jerome Coutant 2:123b894b49dd 419 /* Imported TS IO functions --------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 420
Jerome Coutant 2:123b894b49dd 421 /** @defgroup ft6x06_Imported_Functions
Jerome Coutant 2:123b894b49dd 422 * @{
Jerome Coutant 2:123b894b49dd 423 */
Jerome Coutant 2:123b894b49dd 424
Jerome Coutant 2:123b894b49dd 425 /* TouchScreen (TS) external IO functions */
Jerome Coutant 2:123b894b49dd 426 extern void TS_IO_Init(void);
Jerome Coutant 2:123b894b49dd 427 extern void TS_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
Jerome Coutant 2:123b894b49dd 428 extern uint8_t TS_IO_Read(uint8_t Addr, uint8_t Reg);
Jerome Coutant 2:123b894b49dd 429 extern uint16_t TS_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
Jerome Coutant 2:123b894b49dd 430 extern void TS_IO_Delay(uint32_t Delay);
Jerome Coutant 2:123b894b49dd 431
Jerome Coutant 2:123b894b49dd 432 /**
Jerome Coutant 2:123b894b49dd 433 * @}
Jerome Coutant 2:123b894b49dd 434 */
Jerome Coutant 2:123b894b49dd 435
Jerome Coutant 2:123b894b49dd 436 /* Imported global variables --------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 437
Jerome Coutant 2:123b894b49dd 438 /** @defgroup ft6x06_Imported_Globals
Jerome Coutant 2:123b894b49dd 439 * @{
Jerome Coutant 2:123b894b49dd 440 */
Jerome Coutant 2:123b894b49dd 441
Jerome Coutant 2:123b894b49dd 442
Jerome Coutant 2:123b894b49dd 443 /* Touch screen driver structure */
Jerome Coutant 2:123b894b49dd 444 extern TS_DrvTypeDef ft6x06_ts_drv;
Jerome Coutant 2:123b894b49dd 445
Jerome Coutant 2:123b894b49dd 446 /**
Jerome Coutant 2:123b894b49dd 447 * @}
Jerome Coutant 2:123b894b49dd 448 */
Jerome Coutant 2:123b894b49dd 449
Jerome Coutant 2:123b894b49dd 450 #ifdef __cplusplus
Jerome Coutant 2:123b894b49dd 451 }
Jerome Coutant 2:123b894b49dd 452 #endif
Jerome Coutant 2:123b894b49dd 453 #endif /* __FT6X06_H */
Jerome Coutant 2:123b894b49dd 454
Jerome Coutant 2:123b894b49dd 455
Jerome Coutant 2:123b894b49dd 456 /**
Jerome Coutant 2:123b894b49dd 457 * @}
Jerome Coutant 2:123b894b49dd 458 */
Jerome Coutant 2:123b894b49dd 459
Jerome Coutant 2:123b894b49dd 460 /**
Jerome Coutant 2:123b894b49dd 461 * @}
Jerome Coutant 2:123b894b49dd 462 */
Jerome Coutant 2:123b894b49dd 463
Jerome Coutant 2:123b894b49dd 464 /**
Jerome Coutant 2:123b894b49dd 465 * @}
Jerome Coutant 2:123b894b49dd 466 */
Jerome Coutant 2:123b894b49dd 467
Jerome Coutant 2:123b894b49dd 468 /**
Jerome Coutant 2:123b894b49dd 469 * @}
Jerome Coutant 2:123b894b49dd 470 */
Jerome Coutant 2:123b894b49dd 471 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/