SPKT

Dependencies:   mbed

Committer:
bcostm
Date:
Thu Nov 10 09:57:11 2016 +0100
Revision:
6:e1d9da7fe856
Update all files present in STM32CubeF7 V1.5.1. Keep original folders structure.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 6:e1d9da7fe856 1 /**
bcostm 6:e1d9da7fe856 2 ******************************************************************************
bcostm 6:e1d9da7fe856 3 * @file ft5336.h
bcostm 6:e1d9da7fe856 4 * @author MCD Application Team
bcostm 6:e1d9da7fe856 5 * @version V1.0.0
bcostm 6:e1d9da7fe856 6 * @date 25-June-2015
bcostm 6:e1d9da7fe856 7 * @brief This file contains all the functions prototypes for the
bcostm 6:e1d9da7fe856 8 * ft5336.c Touch screen driver.
bcostm 6:e1d9da7fe856 9 ******************************************************************************
bcostm 6:e1d9da7fe856 10 * @attention
bcostm 6:e1d9da7fe856 11 *
bcostm 6:e1d9da7fe856 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bcostm 6:e1d9da7fe856 13 *
bcostm 6:e1d9da7fe856 14 * Redistribution and use in source and binary forms, with or without modification,
bcostm 6:e1d9da7fe856 15 * are permitted provided that the following conditions are met:
bcostm 6:e1d9da7fe856 16 * 1. Redistributions of source code must retain the above copyright notice,
bcostm 6:e1d9da7fe856 17 * this list of conditions and the following disclaimer.
bcostm 6:e1d9da7fe856 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
bcostm 6:e1d9da7fe856 19 * this list of conditions and the following disclaimer in the documentation
bcostm 6:e1d9da7fe856 20 * and/or other materials provided with the distribution.
bcostm 6:e1d9da7fe856 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bcostm 6:e1d9da7fe856 22 * may be used to endorse or promote products derived from this software
bcostm 6:e1d9da7fe856 23 * without specific prior written permission.
bcostm 6:e1d9da7fe856 24 *
bcostm 6:e1d9da7fe856 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bcostm 6:e1d9da7fe856 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bcostm 6:e1d9da7fe856 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bcostm 6:e1d9da7fe856 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bcostm 6:e1d9da7fe856 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bcostm 6:e1d9da7fe856 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bcostm 6:e1d9da7fe856 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bcostm 6:e1d9da7fe856 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bcostm 6:e1d9da7fe856 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bcostm 6:e1d9da7fe856 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bcostm 6:e1d9da7fe856 35 *
bcostm 6:e1d9da7fe856 36 ******************************************************************************
bcostm 6:e1d9da7fe856 37 */
bcostm 6:e1d9da7fe856 38
bcostm 6:e1d9da7fe856 39 /* Define to prevent recursive inclusion -------------------------------------*/
bcostm 6:e1d9da7fe856 40 #ifndef __FT5336_H
bcostm 6:e1d9da7fe856 41 #define __FT5336_H
bcostm 6:e1d9da7fe856 42
bcostm 6:e1d9da7fe856 43 #ifdef __cplusplus
bcostm 6:e1d9da7fe856 44 extern "C" {
bcostm 6:e1d9da7fe856 45 #endif
bcostm 6:e1d9da7fe856 46
bcostm 6:e1d9da7fe856 47 /* Set Multi-touch as supported */
bcostm 6:e1d9da7fe856 48 #if !defined(TS_MONO_TOUCH_SUPPORTED)
bcostm 6:e1d9da7fe856 49 #define TS_MULTI_TOUCH_SUPPORTED 1
bcostm 6:e1d9da7fe856 50 #endif /* TS_MONO_TOUCH_SUPPORTED */
bcostm 6:e1d9da7fe856 51
bcostm 6:e1d9da7fe856 52 /* Includes ------------------------------------------------------------------*/
bcostm 6:e1d9da7fe856 53 #include "../Common/ts.h"
bcostm 6:e1d9da7fe856 54
bcostm 6:e1d9da7fe856 55 /* Macros --------------------------------------------------------------------*/
bcostm 6:e1d9da7fe856 56
bcostm 6:e1d9da7fe856 57 #if defined(FT5336_ENABLE_ASSERT)
bcostm 6:e1d9da7fe856 58 /* Assert activated */
bcostm 6:e1d9da7fe856 59 #define FT5336_ASSERT(__condition__) do { if(__condition__) \
bcostm 6:e1d9da7fe856 60 { \
bcostm 6:e1d9da7fe856 61 while(1); \
bcostm 6:e1d9da7fe856 62 } \
bcostm 6:e1d9da7fe856 63 }while(0)
bcostm 6:e1d9da7fe856 64 #else
bcostm 6:e1d9da7fe856 65 /* Assert not activated : macro has no effect */
bcostm 6:e1d9da7fe856 66 #define FT5336_ASSERT(__condition__) do { if(__condition__) \
bcostm 6:e1d9da7fe856 67 { \
bcostm 6:e1d9da7fe856 68 ; \
bcostm 6:e1d9da7fe856 69 } \
bcostm 6:e1d9da7fe856 70 }while(0)
bcostm 6:e1d9da7fe856 71 #endif /* FT5336_ENABLE_ASSERT == 1 */
bcostm 6:e1d9da7fe856 72
bcostm 6:e1d9da7fe856 73 /** @typedef ft5336_handle_TypeDef
bcostm 6:e1d9da7fe856 74 * ft5336 Handle definition.
bcostm 6:e1d9da7fe856 75 */
bcostm 6:e1d9da7fe856 76 typedef struct
bcostm 6:e1d9da7fe856 77 {
bcostm 6:e1d9da7fe856 78 uint8_t i2cInitialized;
bcostm 6:e1d9da7fe856 79
bcostm 6:e1d9da7fe856 80 /* field holding the current number of simultaneous active touches */
bcostm 6:e1d9da7fe856 81 uint8_t currActiveTouchNb;
bcostm 6:e1d9da7fe856 82
bcostm 6:e1d9da7fe856 83 /* field holding the touch index currently managed */
bcostm 6:e1d9da7fe856 84 uint8_t currActiveTouchIdx;
bcostm 6:e1d9da7fe856 85
bcostm 6:e1d9da7fe856 86 } ft5336_handle_TypeDef;
bcostm 6:e1d9da7fe856 87
bcostm 6:e1d9da7fe856 88 /** @addtogroup BSP
bcostm 6:e1d9da7fe856 89 * @{
bcostm 6:e1d9da7fe856 90 */
bcostm 6:e1d9da7fe856 91
bcostm 6:e1d9da7fe856 92 /** @addtogroup Component
bcostm 6:e1d9da7fe856 93 * @{
bcostm 6:e1d9da7fe856 94 */
bcostm 6:e1d9da7fe856 95
bcostm 6:e1d9da7fe856 96 /** @defgroup FT5336
bcostm 6:e1d9da7fe856 97 * @{
bcostm 6:e1d9da7fe856 98 */
bcostm 6:e1d9da7fe856 99
bcostm 6:e1d9da7fe856 100 /* Exported types ------------------------------------------------------------*/
bcostm 6:e1d9da7fe856 101
bcostm 6:e1d9da7fe856 102 /** @defgroup FT5336_Exported_Types
bcostm 6:e1d9da7fe856 103 * @{
bcostm 6:e1d9da7fe856 104 */
bcostm 6:e1d9da7fe856 105
bcostm 6:e1d9da7fe856 106 /* Exported constants --------------------------------------------------------*/
bcostm 6:e1d9da7fe856 107
bcostm 6:e1d9da7fe856 108 /** @defgroup FT5336_Exported_Constants
bcostm 6:e1d9da7fe856 109 * @{
bcostm 6:e1d9da7fe856 110 */
bcostm 6:e1d9da7fe856 111
bcostm 6:e1d9da7fe856 112 /* I2C Slave address of touchscreen FocalTech FT5336 */
bcostm 6:e1d9da7fe856 113 #define FT5336_I2C_SLAVE_ADDRESS ((uint8_t)0x70)
bcostm 6:e1d9da7fe856 114
bcostm 6:e1d9da7fe856 115 /* Maximum border values of the touchscreen pad */
bcostm 6:e1d9da7fe856 116 #define FT5336_MAX_WIDTH ((uint16_t)480) /* Touchscreen pad max width */
bcostm 6:e1d9da7fe856 117 #define FT5336_MAX_HEIGHT ((uint16_t)272) /* Touchscreen pad max height */
bcostm 6:e1d9da7fe856 118
bcostm 6:e1d9da7fe856 119 /* Possible values of driver functions return status */
bcostm 6:e1d9da7fe856 120 #define FT5336_STATUS_OK ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 121 #define FT5336_STATUS_NOT_OK ((uint8_t)0x01)
bcostm 6:e1d9da7fe856 122
bcostm 6:e1d9da7fe856 123 /* Possible values of global variable 'TS_I2C_Initialized' */
bcostm 6:e1d9da7fe856 124 #define FT5336_I2C_NOT_INITIALIZED ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 125 #define FT5336_I2C_INITIALIZED ((uint8_t)0x01)
bcostm 6:e1d9da7fe856 126
bcostm 6:e1d9da7fe856 127 /* Max detectable simultaneous touches */
bcostm 6:e1d9da7fe856 128 #define FT5336_MAX_DETECTABLE_TOUCH ((uint8_t)0x05)
bcostm 6:e1d9da7fe856 129
bcostm 6:e1d9da7fe856 130 /**
bcostm 6:e1d9da7fe856 131 * @brief : Definitions for FT5336 I2C register addresses on 8 bit
bcostm 6:e1d9da7fe856 132 **/
bcostm 6:e1d9da7fe856 133
bcostm 6:e1d9da7fe856 134 /* Current mode register of the FT5336 (R/W) */
bcostm 6:e1d9da7fe856 135 #define FT5336_DEV_MODE_REG ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 136
bcostm 6:e1d9da7fe856 137 /* Possible values of FT5336_DEV_MODE_REG */
bcostm 6:e1d9da7fe856 138 #define FT5336_DEV_MODE_WORKING ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 139 #define FT5336_DEV_MODE_FACTORY ((uint8_t)0x04)
bcostm 6:e1d9da7fe856 140
bcostm 6:e1d9da7fe856 141 #define FT5336_DEV_MODE_MASK ((uint8_t)0x07)
bcostm 6:e1d9da7fe856 142 #define FT5336_DEV_MODE_SHIFT ((uint8_t)0x04)
bcostm 6:e1d9da7fe856 143
bcostm 6:e1d9da7fe856 144 /* Gesture ID register */
bcostm 6:e1d9da7fe856 145 #define FT5336_GEST_ID_REG ((uint8_t)0x01)
bcostm 6:e1d9da7fe856 146
bcostm 6:e1d9da7fe856 147 /* Possible values of FT5336_GEST_ID_REG */
bcostm 6:e1d9da7fe856 148 #define FT5336_GEST_ID_NO_GESTURE ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 149 #define FT5336_GEST_ID_MOVE_UP ((uint8_t)0x10)
bcostm 6:e1d9da7fe856 150 #define FT5336_GEST_ID_MOVE_RIGHT ((uint8_t)0x14)
bcostm 6:e1d9da7fe856 151 #define FT5336_GEST_ID_MOVE_DOWN ((uint8_t)0x18)
bcostm 6:e1d9da7fe856 152 #define FT5336_GEST_ID_MOVE_LEFT ((uint8_t)0x1C)
bcostm 6:e1d9da7fe856 153 #define FT5336_GEST_ID_SINGLE_CLICK ((uint8_t)0x20)
bcostm 6:e1d9da7fe856 154 #define FT5336_GEST_ID_DOUBLE_CLICK ((uint8_t)0x22)
bcostm 6:e1d9da7fe856 155 #define FT5336_GEST_ID_ROTATE_CLOCKWISE ((uint8_t)0x28)
bcostm 6:e1d9da7fe856 156 #define FT5336_GEST_ID_ROTATE_C_CLOCKWISE ((uint8_t)0x29)
bcostm 6:e1d9da7fe856 157 #define FT5336_GEST_ID_ZOOM_IN ((uint8_t)0x40)
bcostm 6:e1d9da7fe856 158 #define FT5336_GEST_ID_ZOOM_OUT ((uint8_t)0x49)
bcostm 6:e1d9da7fe856 159
bcostm 6:e1d9da7fe856 160 /* Touch Data Status register : gives number of active touch points (0..5) */
bcostm 6:e1d9da7fe856 161 #define FT5336_TD_STAT_REG ((uint8_t)0x02)
bcostm 6:e1d9da7fe856 162
bcostm 6:e1d9da7fe856 163 /* Values related to FT5336_TD_STAT_REG */
bcostm 6:e1d9da7fe856 164 #define FT5336_TD_STAT_MASK ((uint8_t)0x0F)
bcostm 6:e1d9da7fe856 165 #define FT5336_TD_STAT_SHIFT ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 166
bcostm 6:e1d9da7fe856 167 /* Values Pn_XH and Pn_YH related */
bcostm 6:e1d9da7fe856 168 #define FT5336_TOUCH_EVT_FLAG_PRESS_DOWN ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 169 #define FT5336_TOUCH_EVT_FLAG_LIFT_UP ((uint8_t)0x01)
bcostm 6:e1d9da7fe856 170 #define FT5336_TOUCH_EVT_FLAG_CONTACT ((uint8_t)0x02)
bcostm 6:e1d9da7fe856 171 #define FT5336_TOUCH_EVT_FLAG_NO_EVENT ((uint8_t)0x03)
bcostm 6:e1d9da7fe856 172
bcostm 6:e1d9da7fe856 173 #define FT5336_TOUCH_EVT_FLAG_SHIFT ((uint8_t)0x06)
bcostm 6:e1d9da7fe856 174 #define FT5336_TOUCH_EVT_FLAG_MASK ((uint8_t)(3 << FT5336_TOUCH_EVT_FLAG_SHIFT))
bcostm 6:e1d9da7fe856 175
bcostm 6:e1d9da7fe856 176 #define FT5336_TOUCH_POS_MSB_MASK ((uint8_t)0x0F)
bcostm 6:e1d9da7fe856 177 #define FT5336_TOUCH_POS_MSB_SHIFT ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 178
bcostm 6:e1d9da7fe856 179 /* Values Pn_XL and Pn_YL related */
bcostm 6:e1d9da7fe856 180 #define FT5336_TOUCH_POS_LSB_MASK ((uint8_t)0xFF)
bcostm 6:e1d9da7fe856 181 #define FT5336_TOUCH_POS_LSB_SHIFT ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 182
bcostm 6:e1d9da7fe856 183 #define FT5336_P1_XH_REG ((uint8_t)0x03)
bcostm 6:e1d9da7fe856 184 #define FT5336_P1_XL_REG ((uint8_t)0x04)
bcostm 6:e1d9da7fe856 185 #define FT5336_P1_YH_REG ((uint8_t)0x05)
bcostm 6:e1d9da7fe856 186 #define FT5336_P1_YL_REG ((uint8_t)0x06)
bcostm 6:e1d9da7fe856 187
bcostm 6:e1d9da7fe856 188 /* Touch Pressure register value (R) */
bcostm 6:e1d9da7fe856 189 #define FT5336_P1_WEIGHT_REG ((uint8_t)0x07)
bcostm 6:e1d9da7fe856 190
bcostm 6:e1d9da7fe856 191 /* Values Pn_WEIGHT related */
bcostm 6:e1d9da7fe856 192 #define FT5336_TOUCH_WEIGHT_MASK ((uint8_t)0xFF)
bcostm 6:e1d9da7fe856 193 #define FT5336_TOUCH_WEIGHT_SHIFT ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 194
bcostm 6:e1d9da7fe856 195 /* Touch area register */
bcostm 6:e1d9da7fe856 196 #define FT5336_P1_MISC_REG ((uint8_t)0x08)
bcostm 6:e1d9da7fe856 197
bcostm 6:e1d9da7fe856 198 /* Values related to FT5336_Pn_MISC_REG */
bcostm 6:e1d9da7fe856 199 #define FT5336_TOUCH_AREA_MASK ((uint8_t)(0x04 << 4))
bcostm 6:e1d9da7fe856 200 #define FT5336_TOUCH_AREA_SHIFT ((uint8_t)0x04)
bcostm 6:e1d9da7fe856 201
bcostm 6:e1d9da7fe856 202 #define FT5336_P2_XH_REG ((uint8_t)0x09)
bcostm 6:e1d9da7fe856 203 #define FT5336_P2_XL_REG ((uint8_t)0x0A)
bcostm 6:e1d9da7fe856 204 #define FT5336_P2_YH_REG ((uint8_t)0x0B)
bcostm 6:e1d9da7fe856 205 #define FT5336_P2_YL_REG ((uint8_t)0x0C)
bcostm 6:e1d9da7fe856 206 #define FT5336_P2_WEIGHT_REG ((uint8_t)0x0D)
bcostm 6:e1d9da7fe856 207 #define FT5336_P2_MISC_REG ((uint8_t)0x0E)
bcostm 6:e1d9da7fe856 208
bcostm 6:e1d9da7fe856 209 #define FT5336_P3_XH_REG ((uint8_t)0x0F)
bcostm 6:e1d9da7fe856 210 #define FT5336_P3_XL_REG ((uint8_t)0x10)
bcostm 6:e1d9da7fe856 211 #define FT5336_P3_YH_REG ((uint8_t)0x11)
bcostm 6:e1d9da7fe856 212 #define FT5336_P3_YL_REG ((uint8_t)0x12)
bcostm 6:e1d9da7fe856 213 #define FT5336_P3_WEIGHT_REG ((uint8_t)0x13)
bcostm 6:e1d9da7fe856 214 #define FT5336_P3_MISC_REG ((uint8_t)0x14)
bcostm 6:e1d9da7fe856 215
bcostm 6:e1d9da7fe856 216 #define FT5336_P4_XH_REG ((uint8_t)0x15)
bcostm 6:e1d9da7fe856 217 #define FT5336_P4_XL_REG ((uint8_t)0x16)
bcostm 6:e1d9da7fe856 218 #define FT5336_P4_YH_REG ((uint8_t)0x17)
bcostm 6:e1d9da7fe856 219 #define FT5336_P4_YL_REG ((uint8_t)0x18)
bcostm 6:e1d9da7fe856 220 #define FT5336_P4_WEIGHT_REG ((uint8_t)0x19)
bcostm 6:e1d9da7fe856 221 #define FT5336_P4_MISC_REG ((uint8_t)0x1A)
bcostm 6:e1d9da7fe856 222
bcostm 6:e1d9da7fe856 223 #define FT5336_P5_XH_REG ((uint8_t)0x1B)
bcostm 6:e1d9da7fe856 224 #define FT5336_P5_XL_REG ((uint8_t)0x1C)
bcostm 6:e1d9da7fe856 225 #define FT5336_P5_YH_REG ((uint8_t)0x1D)
bcostm 6:e1d9da7fe856 226 #define FT5336_P5_YL_REG ((uint8_t)0x1E)
bcostm 6:e1d9da7fe856 227 #define FT5336_P5_WEIGHT_REG ((uint8_t)0x1F)
bcostm 6:e1d9da7fe856 228 #define FT5336_P5_MISC_REG ((uint8_t)0x20)
bcostm 6:e1d9da7fe856 229
bcostm 6:e1d9da7fe856 230 #define FT5336_P6_XH_REG ((uint8_t)0x21)
bcostm 6:e1d9da7fe856 231 #define FT5336_P6_XL_REG ((uint8_t)0x22)
bcostm 6:e1d9da7fe856 232 #define FT5336_P6_YH_REG ((uint8_t)0x23)
bcostm 6:e1d9da7fe856 233 #define FT5336_P6_YL_REG ((uint8_t)0x24)
bcostm 6:e1d9da7fe856 234 #define FT5336_P6_WEIGHT_REG ((uint8_t)0x25)
bcostm 6:e1d9da7fe856 235 #define FT5336_P6_MISC_REG ((uint8_t)0x26)
bcostm 6:e1d9da7fe856 236
bcostm 6:e1d9da7fe856 237 #define FT5336_P7_XH_REG ((uint8_t)0x27)
bcostm 6:e1d9da7fe856 238 #define FT5336_P7_XL_REG ((uint8_t)0x28)
bcostm 6:e1d9da7fe856 239 #define FT5336_P7_YH_REG ((uint8_t)0x29)
bcostm 6:e1d9da7fe856 240 #define FT5336_P7_YL_REG ((uint8_t)0x2A)
bcostm 6:e1d9da7fe856 241 #define FT5336_P7_WEIGHT_REG ((uint8_t)0x2B)
bcostm 6:e1d9da7fe856 242 #define FT5336_P7_MISC_REG ((uint8_t)0x2C)
bcostm 6:e1d9da7fe856 243
bcostm 6:e1d9da7fe856 244 #define FT5336_P8_XH_REG ((uint8_t)0x2D)
bcostm 6:e1d9da7fe856 245 #define FT5336_P8_XL_REG ((uint8_t)0x2E)
bcostm 6:e1d9da7fe856 246 #define FT5336_P8_YH_REG ((uint8_t)0x2F)
bcostm 6:e1d9da7fe856 247 #define FT5336_P8_YL_REG ((uint8_t)0x30)
bcostm 6:e1d9da7fe856 248 #define FT5336_P8_WEIGHT_REG ((uint8_t)0x31)
bcostm 6:e1d9da7fe856 249 #define FT5336_P8_MISC_REG ((uint8_t)0x32)
bcostm 6:e1d9da7fe856 250
bcostm 6:e1d9da7fe856 251 #define FT5336_P9_XH_REG ((uint8_t)0x33)
bcostm 6:e1d9da7fe856 252 #define FT5336_P9_XL_REG ((uint8_t)0x34)
bcostm 6:e1d9da7fe856 253 #define FT5336_P9_YH_REG ((uint8_t)0x35)
bcostm 6:e1d9da7fe856 254 #define FT5336_P9_YL_REG ((uint8_t)0x36)
bcostm 6:e1d9da7fe856 255 #define FT5336_P9_WEIGHT_REG ((uint8_t)0x37)
bcostm 6:e1d9da7fe856 256 #define FT5336_P9_MISC_REG ((uint8_t)0x38)
bcostm 6:e1d9da7fe856 257
bcostm 6:e1d9da7fe856 258 #define FT5336_P10_XH_REG ((uint8_t)0x39)
bcostm 6:e1d9da7fe856 259 #define FT5336_P10_XL_REG ((uint8_t)0x3A)
bcostm 6:e1d9da7fe856 260 #define FT5336_P10_YH_REG ((uint8_t)0x3B)
bcostm 6:e1d9da7fe856 261 #define FT5336_P10_YL_REG ((uint8_t)0x3C)
bcostm 6:e1d9da7fe856 262 #define FT5336_P10_WEIGHT_REG ((uint8_t)0x3D)
bcostm 6:e1d9da7fe856 263 #define FT5336_P10_MISC_REG ((uint8_t)0x3E)
bcostm 6:e1d9da7fe856 264
bcostm 6:e1d9da7fe856 265 /* Threshold for touch detection */
bcostm 6:e1d9da7fe856 266 #define FT5336_TH_GROUP_REG ((uint8_t)0x80)
bcostm 6:e1d9da7fe856 267
bcostm 6:e1d9da7fe856 268 /* Values FT5336_TH_GROUP_REG : threshold related */
bcostm 6:e1d9da7fe856 269 #define FT5336_THRESHOLD_MASK ((uint8_t)0xFF)
bcostm 6:e1d9da7fe856 270 #define FT5336_THRESHOLD_SHIFT ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 271
bcostm 6:e1d9da7fe856 272 /* Filter function coefficients */
bcostm 6:e1d9da7fe856 273 #define FT5336_TH_DIFF_REG ((uint8_t)0x85)
bcostm 6:e1d9da7fe856 274
bcostm 6:e1d9da7fe856 275 /* Control register */
bcostm 6:e1d9da7fe856 276 #define FT5336_CTRL_REG ((uint8_t)0x86)
bcostm 6:e1d9da7fe856 277
bcostm 6:e1d9da7fe856 278 /* Values related to FT5336_CTRL_REG */
bcostm 6:e1d9da7fe856 279
bcostm 6:e1d9da7fe856 280 /* Will keep the Active mode when there is no touching */
bcostm 6:e1d9da7fe856 281 #define FT5336_CTRL_KEEP_ACTIVE_MODE ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 282
bcostm 6:e1d9da7fe856 283 /* Switching from Active mode to Monitor mode automatically when there is no touching */
bcostm 6:e1d9da7fe856 284 #define FT5336_CTRL_KEEP_AUTO_SWITCH_MONITOR_MODE ((uint8_t)0x01
bcostm 6:e1d9da7fe856 285
bcostm 6:e1d9da7fe856 286 /* The time period of switching from Active mode to Monitor mode when there is no touching */
bcostm 6:e1d9da7fe856 287 #define FT5336_TIMEENTERMONITOR_REG ((uint8_t)0x87)
bcostm 6:e1d9da7fe856 288
bcostm 6:e1d9da7fe856 289 /* Report rate in Active mode */
bcostm 6:e1d9da7fe856 290 #define FT5336_PERIODACTIVE_REG ((uint8_t)0x88)
bcostm 6:e1d9da7fe856 291
bcostm 6:e1d9da7fe856 292 /* Report rate in Monitor mode */
bcostm 6:e1d9da7fe856 293 #define FT5336_PERIODMONITOR_REG ((uint8_t)0x89)
bcostm 6:e1d9da7fe856 294
bcostm 6:e1d9da7fe856 295 /* The value of the minimum allowed angle while Rotating gesture mode */
bcostm 6:e1d9da7fe856 296 #define FT5336_RADIAN_VALUE_REG ((uint8_t)0x91)
bcostm 6:e1d9da7fe856 297
bcostm 6:e1d9da7fe856 298 /* Maximum offset while Moving Left and Moving Right gesture */
bcostm 6:e1d9da7fe856 299 #define FT5336_OFFSET_LEFT_RIGHT_REG ((uint8_t)0x92)
bcostm 6:e1d9da7fe856 300
bcostm 6:e1d9da7fe856 301 /* Maximum offset while Moving Up and Moving Down gesture */
bcostm 6:e1d9da7fe856 302 #define FT5336_OFFSET_UP_DOWN_REG ((uint8_t)0x93)
bcostm 6:e1d9da7fe856 303
bcostm 6:e1d9da7fe856 304 /* Minimum distance while Moving Left and Moving Right gesture */
bcostm 6:e1d9da7fe856 305 #define FT5336_DISTANCE_LEFT_RIGHT_REG ((uint8_t)0x94)
bcostm 6:e1d9da7fe856 306
bcostm 6:e1d9da7fe856 307 /* Minimum distance while Moving Up and Moving Down gesture */
bcostm 6:e1d9da7fe856 308 #define FT5336_DISTANCE_UP_DOWN_REG ((uint8_t)0x95)
bcostm 6:e1d9da7fe856 309
bcostm 6:e1d9da7fe856 310 /* Maximum distance while Zoom In and Zoom Out gesture */
bcostm 6:e1d9da7fe856 311 #define FT5336_DISTANCE_ZOOM_REG ((uint8_t)0x96)
bcostm 6:e1d9da7fe856 312
bcostm 6:e1d9da7fe856 313 /* High 8-bit of LIB Version info */
bcostm 6:e1d9da7fe856 314 #define FT5336_LIB_VER_H_REG ((uint8_t)0xA1)
bcostm 6:e1d9da7fe856 315
bcostm 6:e1d9da7fe856 316 /* Low 8-bit of LIB Version info */
bcostm 6:e1d9da7fe856 317 #define FT5336_LIB_VER_L_REG ((uint8_t)0xA2)
bcostm 6:e1d9da7fe856 318
bcostm 6:e1d9da7fe856 319 /* Chip Selecting */
bcostm 6:e1d9da7fe856 320 #define FT5336_CIPHER_REG ((uint8_t)0xA3)
bcostm 6:e1d9da7fe856 321
bcostm 6:e1d9da7fe856 322 /* Interrupt mode register (used when in interrupt mode) */
bcostm 6:e1d9da7fe856 323 #define FT5336_GMODE_REG ((uint8_t)0xA4)
bcostm 6:e1d9da7fe856 324
bcostm 6:e1d9da7fe856 325 #define FT5336_G_MODE_INTERRUPT_MASK ((uint8_t)0x03)
bcostm 6:e1d9da7fe856 326 #define FT5336_G_MODE_INTERRUPT_SHIFT ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 327
bcostm 6:e1d9da7fe856 328 /* Possible values of FT5336_GMODE_REG */
bcostm 6:e1d9da7fe856 329 #define FT5336_G_MODE_INTERRUPT_POLLING ((uint8_t)0x00)
bcostm 6:e1d9da7fe856 330 #define FT5336_G_MODE_INTERRUPT_TRIGGER ((uint8_t)0x01)
bcostm 6:e1d9da7fe856 331
bcostm 6:e1d9da7fe856 332 /* Current power mode the FT5336 system is in (R) */
bcostm 6:e1d9da7fe856 333 #define FT5336_PWR_MODE_REG ((uint8_t)0xA5)
bcostm 6:e1d9da7fe856 334
bcostm 6:e1d9da7fe856 335 /* FT5336 firmware version */
bcostm 6:e1d9da7fe856 336 #define FT5336_FIRMID_REG ((uint8_t)0xA6)
bcostm 6:e1d9da7fe856 337
bcostm 6:e1d9da7fe856 338 /* FT5336 Chip identification register */
bcostm 6:e1d9da7fe856 339 #define FT5336_CHIP_ID_REG ((uint8_t)0xA8)
bcostm 6:e1d9da7fe856 340
bcostm 6:e1d9da7fe856 341 /* Possible values of FT5336_CHIP_ID_REG */
bcostm 6:e1d9da7fe856 342 #define FT5336_ID_VALUE ((uint8_t)0x51)
bcostm 6:e1d9da7fe856 343
bcostm 6:e1d9da7fe856 344 /* Release code version */
bcostm 6:e1d9da7fe856 345 #define FT5336_RELEASE_CODE_ID_REG ((uint8_t)0xAF)
bcostm 6:e1d9da7fe856 346
bcostm 6:e1d9da7fe856 347 /* Current operating mode the FT5336 system is in (R) */
bcostm 6:e1d9da7fe856 348 #define FT5336_STATE_REG ((uint8_t)0xBC)
bcostm 6:e1d9da7fe856 349
bcostm 6:e1d9da7fe856 350 /**
bcostm 6:e1d9da7fe856 351 * @}
bcostm 6:e1d9da7fe856 352 */
bcostm 6:e1d9da7fe856 353
bcostm 6:e1d9da7fe856 354 /* Exported macro ------------------------------------------------------------*/
bcostm 6:e1d9da7fe856 355
bcostm 6:e1d9da7fe856 356 /** @defgroup ft5336_Exported_Macros
bcostm 6:e1d9da7fe856 357 * @{
bcostm 6:e1d9da7fe856 358 */
bcostm 6:e1d9da7fe856 359
bcostm 6:e1d9da7fe856 360 /* Exported functions --------------------------------------------------------*/
bcostm 6:e1d9da7fe856 361
bcostm 6:e1d9da7fe856 362 /** @defgroup ft5336_Exported_Functions
bcostm 6:e1d9da7fe856 363 * @{
bcostm 6:e1d9da7fe856 364 */
bcostm 6:e1d9da7fe856 365
bcostm 6:e1d9da7fe856 366 /**
bcostm 6:e1d9da7fe856 367 * @brief ft5336 Control functions
bcostm 6:e1d9da7fe856 368 */
bcostm 6:e1d9da7fe856 369
bcostm 6:e1d9da7fe856 370
bcostm 6:e1d9da7fe856 371 /**
bcostm 6:e1d9da7fe856 372 * @brief Initialize the ft5336 communication bus
bcostm 6:e1d9da7fe856 373 * from MCU to FT5336 : ie I2C channel initialization (if required).
bcostm 6:e1d9da7fe856 374 * @param DeviceAddr: Device address on communication Bus (I2C slave address of FT5336).
bcostm 6:e1d9da7fe856 375 * @retval None
bcostm 6:e1d9da7fe856 376 */
bcostm 6:e1d9da7fe856 377 void ft5336_Init(uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 378
bcostm 6:e1d9da7fe856 379 /**
bcostm 6:e1d9da7fe856 380 * @brief Software Reset the ft5336.
bcostm 6:e1d9da7fe856 381 * @param DeviceAddr: Device address on communication Bus (I2C slave address of FT5336).
bcostm 6:e1d9da7fe856 382 * @retval None
bcostm 6:e1d9da7fe856 383 */
bcostm 6:e1d9da7fe856 384 void ft5336_Reset(uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 385
bcostm 6:e1d9da7fe856 386 /**
bcostm 6:e1d9da7fe856 387 * @brief Read the ft5336 device ID, pre initialize I2C in case of need to be
bcostm 6:e1d9da7fe856 388 * able to read the FT5336 device ID, and verify this is a FT5336.
bcostm 6:e1d9da7fe856 389 * @param DeviceAddr: I2C FT5336 Slave address.
bcostm 6:e1d9da7fe856 390 * @retval The Device ID (two bytes).
bcostm 6:e1d9da7fe856 391 */
bcostm 6:e1d9da7fe856 392 uint16_t ft5336_ReadID(uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 393
bcostm 6:e1d9da7fe856 394 /**
bcostm 6:e1d9da7fe856 395 * @brief Configures the touch Screen IC device to start detecting touches
bcostm 6:e1d9da7fe856 396 * @param DeviceAddr: Device address on communication Bus (I2C slave address).
bcostm 6:e1d9da7fe856 397 * @retval None.
bcostm 6:e1d9da7fe856 398 */
bcostm 6:e1d9da7fe856 399 void ft5336_TS_Start(uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 400
bcostm 6:e1d9da7fe856 401 /**
bcostm 6:e1d9da7fe856 402 * @brief Return if there is touches detected or not.
bcostm 6:e1d9da7fe856 403 * Try to detect new touches and forget the old ones (reset internal global
bcostm 6:e1d9da7fe856 404 * variables).
bcostm 6:e1d9da7fe856 405 * @param DeviceAddr: Device address on communication Bus.
bcostm 6:e1d9da7fe856 406 * @retval : Number of active touches detected (can be 0, 1 or 2).
bcostm 6:e1d9da7fe856 407 */
bcostm 6:e1d9da7fe856 408 uint8_t ft5336_TS_DetectTouch(uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 409
bcostm 6:e1d9da7fe856 410 /**
bcostm 6:e1d9da7fe856 411 * @brief Get the touch screen X and Y positions values
bcostm 6:e1d9da7fe856 412 * Manage multi touch thanks to touch Index global
bcostm 6:e1d9da7fe856 413 * variable 'ft5336_handle.currActiveTouchIdx'.
bcostm 6:e1d9da7fe856 414 * @param DeviceAddr: Device address on communication Bus.
bcostm 6:e1d9da7fe856 415 * @param X: Pointer to X position value
bcostm 6:e1d9da7fe856 416 * @param Y: Pointer to Y position value
bcostm 6:e1d9da7fe856 417 * @retval None.
bcostm 6:e1d9da7fe856 418 */
bcostm 6:e1d9da7fe856 419 void ft5336_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y);
bcostm 6:e1d9da7fe856 420
bcostm 6:e1d9da7fe856 421 /**
bcostm 6:e1d9da7fe856 422 * @brief Configure the FT5336 device to generate IT on given INT pin
bcostm 6:e1d9da7fe856 423 * connected to MCU as EXTI.
bcostm 6:e1d9da7fe856 424 * @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT5336).
bcostm 6:e1d9da7fe856 425 * @retval None
bcostm 6:e1d9da7fe856 426 */
bcostm 6:e1d9da7fe856 427 void ft5336_TS_EnableIT(uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 428
bcostm 6:e1d9da7fe856 429 /**
bcostm 6:e1d9da7fe856 430 * @brief Configure the FT5336 device to stop generating IT on the given INT pin
bcostm 6:e1d9da7fe856 431 * connected to MCU as EXTI.
bcostm 6:e1d9da7fe856 432 * @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT5336).
bcostm 6:e1d9da7fe856 433 * @retval None
bcostm 6:e1d9da7fe856 434 */
bcostm 6:e1d9da7fe856 435 void ft5336_TS_DisableIT(uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 436
bcostm 6:e1d9da7fe856 437 /**
bcostm 6:e1d9da7fe856 438 * @brief Get IT status from FT5336 interrupt status registers
bcostm 6:e1d9da7fe856 439 * Should be called Following an EXTI coming to the MCU to know the detailed
bcostm 6:e1d9da7fe856 440 * reason of the interrupt.
bcostm 6:e1d9da7fe856 441 * @param DeviceAddr: Device address on communication Bus (I2C slave address of FT5336).
bcostm 6:e1d9da7fe856 442 * @retval TS interrupts status
bcostm 6:e1d9da7fe856 443 */
bcostm 6:e1d9da7fe856 444 uint8_t ft5336_TS_ITStatus (uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 445
bcostm 6:e1d9da7fe856 446 /**
bcostm 6:e1d9da7fe856 447 * @brief Clear IT status in FT5336 interrupt status clear registers
bcostm 6:e1d9da7fe856 448 * Should be called Following an EXTI coming to the MCU.
bcostm 6:e1d9da7fe856 449 * @param DeviceAddr: Device address on communication Bus (I2C slave address of FT5336).
bcostm 6:e1d9da7fe856 450 * @retval TS interrupts status
bcostm 6:e1d9da7fe856 451 */
bcostm 6:e1d9da7fe856 452 void ft5336_TS_ClearIT (uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 453
bcostm 6:e1d9da7fe856 454 /**** NEW FEATURES enabled when Multi-touch support is enabled ****/
bcostm 6:e1d9da7fe856 455
bcostm 6:e1d9da7fe856 456 #if (TS_MULTI_TOUCH_SUPPORTED == 1)
bcostm 6:e1d9da7fe856 457
bcostm 6:e1d9da7fe856 458 /**
bcostm 6:e1d9da7fe856 459 * @brief Get the last touch gesture identification (zoom, move up/down...).
bcostm 6:e1d9da7fe856 460 * @param DeviceAddr: Device address on communication Bus (I2C slave address of FT5336).
bcostm 6:e1d9da7fe856 461 * @param pGestureId : Pointer to get last touch gesture Identification.
bcostm 6:e1d9da7fe856 462 * @retval None.
bcostm 6:e1d9da7fe856 463 */
bcostm 6:e1d9da7fe856 464 void ft5336_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId);
bcostm 6:e1d9da7fe856 465
bcostm 6:e1d9da7fe856 466 /**
bcostm 6:e1d9da7fe856 467 * @brief Get the touch detailed informations on touch number 'touchIdx' (0..1)
bcostm 6:e1d9da7fe856 468 * This touch detailed information contains :
bcostm 6:e1d9da7fe856 469 * - weight that was applied to this touch
bcostm 6:e1d9da7fe856 470 * - sub-area of the touch in the touch panel
bcostm 6:e1d9da7fe856 471 * - event of linked to the touch (press down, lift up, ...)
bcostm 6:e1d9da7fe856 472 * @param DeviceAddr: Device address on communication Bus (I2C slave address of FT5336).
bcostm 6:e1d9da7fe856 473 * @param touchIdx : Passed index of the touch (0..1) on which we want to get the
bcostm 6:e1d9da7fe856 474 * detailed information.
bcostm 6:e1d9da7fe856 475 * @param pWeight : Pointer to to get the weight information of 'touchIdx'.
bcostm 6:e1d9da7fe856 476 * @param pArea : Pointer to to get the sub-area information of 'touchIdx'.
bcostm 6:e1d9da7fe856 477 * @param pEvent : Pointer to to get the event information of 'touchIdx'.
bcostm 6:e1d9da7fe856 478
bcostm 6:e1d9da7fe856 479 * @retval None.
bcostm 6:e1d9da7fe856 480 */
bcostm 6:e1d9da7fe856 481 void ft5336_TS_GetTouchInfo(uint16_t DeviceAddr,
bcostm 6:e1d9da7fe856 482 uint32_t touchIdx,
bcostm 6:e1d9da7fe856 483 uint32_t * pWeight,
bcostm 6:e1d9da7fe856 484 uint32_t * pArea,
bcostm 6:e1d9da7fe856 485 uint32_t * pEvent);
bcostm 6:e1d9da7fe856 486
bcostm 6:e1d9da7fe856 487 #endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */
bcostm 6:e1d9da7fe856 488
bcostm 6:e1d9da7fe856 489 /* Imported TS IO functions --------------------------------------------------------*/
bcostm 6:e1d9da7fe856 490
bcostm 6:e1d9da7fe856 491 /** @defgroup ft5336_Imported_Functions
bcostm 6:e1d9da7fe856 492 * @{
bcostm 6:e1d9da7fe856 493 */
bcostm 6:e1d9da7fe856 494
bcostm 6:e1d9da7fe856 495 /* TouchScreen (TS) external IO functions */
bcostm 6:e1d9da7fe856 496 extern void TS_IO_Init(void);
bcostm 6:e1d9da7fe856 497 extern void TS_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
bcostm 6:e1d9da7fe856 498 extern uint8_t TS_IO_Read(uint8_t Addr, uint8_t Reg);
bcostm 6:e1d9da7fe856 499 extern void TS_IO_Delay(uint32_t Delay);
bcostm 6:e1d9da7fe856 500
bcostm 6:e1d9da7fe856 501 /**
bcostm 6:e1d9da7fe856 502 * @}
bcostm 6:e1d9da7fe856 503 */
bcostm 6:e1d9da7fe856 504
bcostm 6:e1d9da7fe856 505 /* Imported global variables --------------------------------------------------------*/
bcostm 6:e1d9da7fe856 506
bcostm 6:e1d9da7fe856 507 /** @defgroup ft5336_Imported_Globals
bcostm 6:e1d9da7fe856 508 * @{
bcostm 6:e1d9da7fe856 509 */
bcostm 6:e1d9da7fe856 510
bcostm 6:e1d9da7fe856 511
bcostm 6:e1d9da7fe856 512 /* Touch screen driver structure */
bcostm 6:e1d9da7fe856 513 extern TS_DrvTypeDef ft5336_ts_drv;
bcostm 6:e1d9da7fe856 514
bcostm 6:e1d9da7fe856 515 /**
bcostm 6:e1d9da7fe856 516 * @}
bcostm 6:e1d9da7fe856 517 */
bcostm 6:e1d9da7fe856 518
bcostm 6:e1d9da7fe856 519 #ifdef __cplusplus
bcostm 6:e1d9da7fe856 520 }
bcostm 6:e1d9da7fe856 521 #endif
bcostm 6:e1d9da7fe856 522 #endif /* __FT5336_H */
bcostm 6:e1d9da7fe856 523
bcostm 6:e1d9da7fe856 524
bcostm 6:e1d9da7fe856 525 /**
bcostm 6:e1d9da7fe856 526 * @}
bcostm 6:e1d9da7fe856 527 */
bcostm 6:e1d9da7fe856 528
bcostm 6:e1d9da7fe856 529 /**
bcostm 6:e1d9da7fe856 530 * @}
bcostm 6:e1d9da7fe856 531 */
bcostm 6:e1d9da7fe856 532
bcostm 6:e1d9da7fe856 533 /**
bcostm 6:e1d9da7fe856 534 * @}
bcostm 6:e1d9da7fe856 535 */
bcostm 6:e1d9da7fe856 536
bcostm 6:e1d9da7fe856 537 /**
bcostm 6:e1d9da7fe856 538 * @}
bcostm 6:e1d9da7fe856 539 */
bcostm 6:e1d9da7fe856 540 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/