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