Patched for Audio example - Add status check when DFSDM's filter and channel de-init.

Dependents:   DISCO_F413ZH-AUDIO-demo

The base repository is https://os.mbed.com/teams/ST/code/BSP_DISCO_F413ZH/. I've just added workaround patch for Audio-in demo on DISCO_F413ZH board(Microphone U16, U17)

Committer:
Daniel_Lee
Date:
Fri Jan 31 07:17:05 2020 +0000
Revision:
4:c051317d4051
Parent:
0:4af3ca173992
Patched for Audio example;

Who changed what in which revision?

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