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