STM32Cube BSP FW for STM32F769I-Discovery

Dependents:   mbed-os-example-blinky-5 DISCO-F769NI_TOUCHSCREEN_demo_custom_1 Datarecorder2 DISCO-F769NI_TOUCHSCREEN_demo ... more

Committer:
Jerome Coutant
Date:
Fri Nov 15 14:50:16 2019 +0100
Revision:
8:d13d7c447539
Parent:
4:72a949940ad6
Correct warning

Who changed what in which revision?

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