patch for F746 demo

Dependents:   F7DISCO_Demo

Fork of BSP_DISCO_F746NG by ST

Committer:
NirT
Date:
Mon Nov 02 23:35:17 2015 +0000
Revision:
1:e8fac4061a5b
Parent:
0:c9112f0c67e3
Error: Incomplete type is not allowed in "patch/LwIP/src/include/lwip/dhcp.h", Line: 83, Col: 4; ; and more like this.

Who changed what in which revision?

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