BSP driver for DISCO_L496AG

Dependents:   DISCO_L496AG-LCD-prova_1 DISCO_L496AG-LCD-prova_2 DISCO_L496AG-LCD-demo DISCO_L496AG-SRAM-demo

Committer:
Jerome Coutant
Date:
Wed Nov 20 16:48:24 2019 +0100
Revision:
2:106c7b82e064
Parent:
0:d83f1c8ca282
Update BSP files with CubeL4 V1.14.0

Who changed what in which revision?

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