BSP files for STM32H747I-Discovery Copy from ST Cube delivery

Dependents:   DISCO_H747I_LCD_demo DISCO_H747I_AUDIO_demo

Committer:
Jerome Coutant
Date:
Wed Nov 06 11:32:01 2019 +0100
Revision:
3:bc403474b366
Parent:
0:146cf26a9bbb
Add PDM lib

Who changed what in which revision?

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