Nam

Dependencies:   mbed

Dependents:   uSD LCD

Committer:
nhancap98
Date:
Mon Jun 10 11:10:42 2019 +0000
Revision:
11:862f171dda3c
Parent:
8:56384bddaba5
SPKT

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 6:e1d9da7fe856 1 /**
bcostm 6:e1d9da7fe856 2 ******************************************************************************
bcostm 6:e1d9da7fe856 3 * @file stm32746g_discovery_ts.h
bcostm 6:e1d9da7fe856 4 * @author MCD Application Team
Jerome Coutant 8:56384bddaba5 5 * @version V2.0.0
Jerome Coutant 8:56384bddaba5 6 * @date 30-December-2016
bcostm 6:e1d9da7fe856 7 * @brief This file contains the common defines and functions prototypes for
bcostm 6:e1d9da7fe856 8 * the stm32746g_discovery_ts.c driver.
bcostm 6:e1d9da7fe856 9 ******************************************************************************
bcostm 6:e1d9da7fe856 10 * @attention
bcostm 6:e1d9da7fe856 11 *
bcostm 6:e1d9da7fe856 12 * <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM32746G_DISCOVERY_TS_H
bcostm 6:e1d9da7fe856 41 #define __STM32746G_DISCOVERY_TS_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 /* Includes ------------------------------------------------------------------*/
bcostm 6:e1d9da7fe856 48 #include "stm32746g_discovery.h"
bcostm 6:e1d9da7fe856 49 /* Include touch screen FT5336 component Driver */
bcostm 6:e1d9da7fe856 50 #include "../Components/ft5336/ft5336.h"
bcostm 6:e1d9da7fe856 51
bcostm 6:e1d9da7fe856 52 /** @addtogroup BSP
bcostm 6:e1d9da7fe856 53 * @{
bcostm 6:e1d9da7fe856 54 */
bcostm 6:e1d9da7fe856 55
bcostm 6:e1d9da7fe856 56 /** @addtogroup STM32746G_DISCOVERY
bcostm 6:e1d9da7fe856 57 * @{
bcostm 6:e1d9da7fe856 58 */
bcostm 6:e1d9da7fe856 59
bcostm 6:e1d9da7fe856 60 /** @addtogroup STM32746G_DISCOVERY_TS
bcostm 6:e1d9da7fe856 61 * @{
bcostm 6:e1d9da7fe856 62 */
bcostm 6:e1d9da7fe856 63
bcostm 6:e1d9da7fe856 64 /** @defgroup STM32746G_DISCOVERY_TS_Exported_Constants STM32746G_DISCOVERY_TS Exported Constants
bcostm 6:e1d9da7fe856 65 * @{
bcostm 6:e1d9da7fe856 66 */
bcostm 6:e1d9da7fe856 67
bcostm 6:e1d9da7fe856 68 /** @brief With FT5336 : maximum 5 touches detected simultaneously
bcostm 6:e1d9da7fe856 69 */
bcostm 6:e1d9da7fe856 70 #define TS_MAX_NB_TOUCH ((uint32_t) FT5336_MAX_DETECTABLE_TOUCH)
bcostm 6:e1d9da7fe856 71
bcostm 6:e1d9da7fe856 72 #define TS_NO_IRQ_PENDING ((uint8_t) 0)
bcostm 6:e1d9da7fe856 73 #define TS_IRQ_PENDING ((uint8_t) 1)
bcostm 6:e1d9da7fe856 74
bcostm 6:e1d9da7fe856 75 #define TS_SWAP_NONE ((uint8_t) 0x01)
bcostm 6:e1d9da7fe856 76 #define TS_SWAP_X ((uint8_t) 0x02)
bcostm 6:e1d9da7fe856 77 #define TS_SWAP_Y ((uint8_t) 0x04)
bcostm 6:e1d9da7fe856 78 #define TS_SWAP_XY ((uint8_t) 0x08)
bcostm 6:e1d9da7fe856 79
bcostm 6:e1d9da7fe856 80 /**
bcostm 6:e1d9da7fe856 81 * @}
bcostm 6:e1d9da7fe856 82 */
bcostm 6:e1d9da7fe856 83
bcostm 6:e1d9da7fe856 84 /** @defgroup STM32746G_DISCOVERY_TS_Exported_Types STM32746G_DISCOVERY_TS Exported Types
bcostm 6:e1d9da7fe856 85 * @{
bcostm 6:e1d9da7fe856 86 */
bcostm 6:e1d9da7fe856 87 /**
bcostm 6:e1d9da7fe856 88 * @brief TS_StateTypeDef
bcostm 6:e1d9da7fe856 89 * Define TS State structure
bcostm 6:e1d9da7fe856 90 */
bcostm 6:e1d9da7fe856 91 typedef struct
bcostm 6:e1d9da7fe856 92 {
bcostm 6:e1d9da7fe856 93 uint8_t touchDetected; /*!< Total number of active touches detected at last scan */
bcostm 6:e1d9da7fe856 94 uint16_t touchX[TS_MAX_NB_TOUCH]; /*!< Touch X[0], X[1] coordinates on 12 bits */
bcostm 6:e1d9da7fe856 95 uint16_t touchY[TS_MAX_NB_TOUCH]; /*!< Touch Y[0], Y[1] coordinates on 12 bits */
bcostm 6:e1d9da7fe856 96
bcostm 6:e1d9da7fe856 97 #if (TS_MULTI_TOUCH_SUPPORTED == 1)
bcostm 6:e1d9da7fe856 98 uint8_t touchWeight[TS_MAX_NB_TOUCH]; /*!< Touch_Weight[0], Touch_Weight[1] : weight property of touches */
bcostm 6:e1d9da7fe856 99 uint8_t touchEventId[TS_MAX_NB_TOUCH]; /*!< Touch_EventId[0], Touch_EventId[1] : take value of type @ref TS_TouchEventTypeDef */
bcostm 6:e1d9da7fe856 100 uint8_t touchArea[TS_MAX_NB_TOUCH]; /*!< Touch_Area[0], Touch_Area[1] : touch area of each touch */
bcostm 6:e1d9da7fe856 101 uint32_t gestureId; /*!< type of gesture detected : take value of type @ref TS_GestureIdTypeDef */
bcostm 6:e1d9da7fe856 102 #endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */
bcostm 6:e1d9da7fe856 103
bcostm 6:e1d9da7fe856 104 } TS_StateTypeDef;
bcostm 6:e1d9da7fe856 105
bcostm 6:e1d9da7fe856 106 /**
bcostm 6:e1d9da7fe856 107 * @}
bcostm 6:e1d9da7fe856 108 */
bcostm 6:e1d9da7fe856 109
bcostm 6:e1d9da7fe856 110 /** @defgroup STM32746G_DISCOVERY_TS_Exported_Constants STM32746G_DISCOVERY_TS Exported Constants
bcostm 6:e1d9da7fe856 111 * @{
bcostm 6:e1d9da7fe856 112 */
bcostm 6:e1d9da7fe856 113
bcostm 6:e1d9da7fe856 114 typedef enum
bcostm 6:e1d9da7fe856 115 {
bcostm 6:e1d9da7fe856 116 TS_OK = 0x00, /*!< Touch Ok */
bcostm 6:e1d9da7fe856 117 TS_ERROR = 0x01, /*!< Touch Error */
bcostm 6:e1d9da7fe856 118 TS_TIMEOUT = 0x02, /*!< Touch Timeout */
bcostm 6:e1d9da7fe856 119 TS_DEVICE_NOT_FOUND = 0x03 /*!< Touchscreen device not found */
bcostm 6:e1d9da7fe856 120 }TS_StatusTypeDef;
bcostm 6:e1d9da7fe856 121
bcostm 6:e1d9da7fe856 122 /**
bcostm 6:e1d9da7fe856 123 * @brief TS_GestureIdTypeDef
bcostm 6:e1d9da7fe856 124 * Define Possible managed gesture identification values returned by touch screen
bcostm 6:e1d9da7fe856 125 * driver.
bcostm 6:e1d9da7fe856 126 */
bcostm 6:e1d9da7fe856 127 typedef enum
bcostm 6:e1d9da7fe856 128 {
bcostm 6:e1d9da7fe856 129 GEST_ID_NO_GESTURE = 0x00, /*!< Gesture not defined / recognized */
bcostm 6:e1d9da7fe856 130 GEST_ID_MOVE_UP = 0x01, /*!< Gesture Move Up */
bcostm 6:e1d9da7fe856 131 GEST_ID_MOVE_RIGHT = 0x02, /*!< Gesture Move Right */
bcostm 6:e1d9da7fe856 132 GEST_ID_MOVE_DOWN = 0x03, /*!< Gesture Move Down */
bcostm 6:e1d9da7fe856 133 GEST_ID_MOVE_LEFT = 0x04, /*!< Gesture Move Left */
bcostm 6:e1d9da7fe856 134 GEST_ID_ZOOM_IN = 0x05, /*!< Gesture Zoom In */
bcostm 6:e1d9da7fe856 135 GEST_ID_ZOOM_OUT = 0x06, /*!< Gesture Zoom Out */
bcostm 6:e1d9da7fe856 136 GEST_ID_NB_MAX = 0x07 /*!< max number of gesture id */
bcostm 6:e1d9da7fe856 137
bcostm 6:e1d9da7fe856 138 } TS_GestureIdTypeDef;
bcostm 6:e1d9da7fe856 139
bcostm 6:e1d9da7fe856 140 /**
bcostm 6:e1d9da7fe856 141 * @brief TS_TouchEventTypeDef
bcostm 6:e1d9da7fe856 142 * Define Possible touch events kind as returned values
bcostm 6:e1d9da7fe856 143 * by touch screen IC Driver.
bcostm 6:e1d9da7fe856 144 */
bcostm 6:e1d9da7fe856 145 typedef enum
bcostm 6:e1d9da7fe856 146 {
bcostm 6:e1d9da7fe856 147 TOUCH_EVENT_NO_EVT = 0x00, /*!< Touch Event : undetermined */
bcostm 6:e1d9da7fe856 148 TOUCH_EVENT_PRESS_DOWN = 0x01, /*!< Touch Event Press Down */
bcostm 6:e1d9da7fe856 149 TOUCH_EVENT_LIFT_UP = 0x02, /*!< Touch Event Lift Up */
bcostm 6:e1d9da7fe856 150 TOUCH_EVENT_CONTACT = 0x03, /*!< Touch Event Contact */
bcostm 6:e1d9da7fe856 151 TOUCH_EVENT_NB_MAX = 0x04 /*!< max number of touch events kind */
bcostm 6:e1d9da7fe856 152
bcostm 6:e1d9da7fe856 153 } TS_TouchEventTypeDef;
bcostm 6:e1d9da7fe856 154 /**
bcostm 6:e1d9da7fe856 155 * @}
bcostm 6:e1d9da7fe856 156 */
bcostm 6:e1d9da7fe856 157
bcostm 6:e1d9da7fe856 158 /** @defgroup STM32746G_DISCOVERY_TS_Imported_Variables STM32746G_DISCOVERY_TS Imported Variables
bcostm 6:e1d9da7fe856 159 * @{
bcostm 6:e1d9da7fe856 160 */
bcostm 6:e1d9da7fe856 161 /**
bcostm 6:e1d9da7fe856 162 * @brief Table for touchscreen event information display on LCD :
bcostm 6:e1d9da7fe856 163 * table indexed on enum @ref TS_TouchEventTypeDef information
bcostm 6:e1d9da7fe856 164 */
bcostm 6:e1d9da7fe856 165 extern char * ts_event_string_tab[TOUCH_EVENT_NB_MAX];
bcostm 6:e1d9da7fe856 166
bcostm 6:e1d9da7fe856 167 /**
bcostm 6:e1d9da7fe856 168 * @brief Table for touchscreen gesture Id information display on LCD : table indexed
bcostm 6:e1d9da7fe856 169 * on enum @ref TS_GestureIdTypeDef information
bcostm 6:e1d9da7fe856 170 */
bcostm 6:e1d9da7fe856 171 extern char * ts_gesture_id_string_tab[GEST_ID_NB_MAX];
bcostm 6:e1d9da7fe856 172 /**
bcostm 6:e1d9da7fe856 173 * @}
bcostm 6:e1d9da7fe856 174 */
bcostm 6:e1d9da7fe856 175
bcostm 6:e1d9da7fe856 176 /** @addtogroup STM32746G_DISCOVERY_TS_Exported_Functions
bcostm 6:e1d9da7fe856 177 * @{
bcostm 6:e1d9da7fe856 178 */
bcostm 6:e1d9da7fe856 179 uint8_t BSP_TS_Init(uint16_t ts_SizeX, uint16_t ts_SizeY);
bcostm 6:e1d9da7fe856 180 uint8_t BSP_TS_DeInit(void);
bcostm 6:e1d9da7fe856 181 uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State);
bcostm 6:e1d9da7fe856 182
bcostm 6:e1d9da7fe856 183 #if (TS_MULTI_TOUCH_SUPPORTED == 1)
bcostm 6:e1d9da7fe856 184 uint8_t BSP_TS_Get_GestureId(TS_StateTypeDef *TS_State);
bcostm 6:e1d9da7fe856 185 #endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */
bcostm 6:e1d9da7fe856 186
bcostm 6:e1d9da7fe856 187 uint8_t BSP_TS_ITConfig(void);
bcostm 6:e1d9da7fe856 188 uint8_t BSP_TS_ITGetStatus(void);
bcostm 6:e1d9da7fe856 189 void BSP_TS_ITClear(void);
bcostm 6:e1d9da7fe856 190 uint8_t BSP_TS_ResetTouchData(TS_StateTypeDef *TS_State);
bcostm 6:e1d9da7fe856 191 /**
bcostm 6:e1d9da7fe856 192 * @}
bcostm 6:e1d9da7fe856 193 */
bcostm 6:e1d9da7fe856 194
bcostm 6:e1d9da7fe856 195 /**
bcostm 6:e1d9da7fe856 196 * @}
bcostm 6:e1d9da7fe856 197 */
bcostm 6:e1d9da7fe856 198
bcostm 6:e1d9da7fe856 199 /**
bcostm 6:e1d9da7fe856 200 * @}
bcostm 6:e1d9da7fe856 201 */
bcostm 6:e1d9da7fe856 202
bcostm 6:e1d9da7fe856 203 /**
bcostm 6:e1d9da7fe856 204 * @}
bcostm 6:e1d9da7fe856 205 */
bcostm 6:e1d9da7fe856 206
bcostm 6:e1d9da7fe856 207
bcostm 6:e1d9da7fe856 208 #ifdef __cplusplus
bcostm 6:e1d9da7fe856 209 }
bcostm 6:e1d9da7fe856 210 #endif
bcostm 6:e1d9da7fe856 211
bcostm 6:e1d9da7fe856 212 #endif /* __STM32746G_DISCOVERY_TS_H */
bcostm 6:e1d9da7fe856 213
bcostm 6:e1d9da7fe856 214 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/