library
Dependents: Aprendendo Final_v3
stm32469i_discovery/stm32469i_discovery_ts.h@4:e746cdd3e76a, 2020-10-19 (annotated)
- Committer:
- zigdrix
- Date:
- Mon Oct 19 22:13:50 2020 +0000
- Revision:
- 4:e746cdd3e76a
- Parent:
- 0:0002c86c2220
Projeto Final PI 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:0002c86c2220 | 1 | /** |
bcostm | 0:0002c86c2220 | 2 | ****************************************************************************** |
bcostm | 0:0002c86c2220 | 3 | * @file stm32469i_discovery_ts.h |
bcostm | 0:0002c86c2220 | 4 | * @author MCD Application Team |
bcostm | 0:0002c86c2220 | 5 | * @version V1.0.1 |
bcostm | 0:0002c86c2220 | 6 | * @date 29-September-2015 |
bcostm | 0:0002c86c2220 | 7 | * @brief This file contains the common defines and functions prototypes for |
bcostm | 0:0002c86c2220 | 8 | * the stm32469i_discovery_ts.c driver. |
bcostm | 0:0002c86c2220 | 9 | ****************************************************************************** |
bcostm | 0:0002c86c2220 | 10 | * @attention |
bcostm | 0:0002c86c2220 | 11 | * |
bcostm | 0:0002c86c2220 | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
bcostm | 0:0002c86c2220 | 13 | * |
bcostm | 0:0002c86c2220 | 14 | * Redistribution and use in source and binary forms, with or without modification, |
bcostm | 0:0002c86c2220 | 15 | * are permitted provided that the following conditions are met: |
bcostm | 0:0002c86c2220 | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
bcostm | 0:0002c86c2220 | 17 | * this list of conditions and the following disclaimer. |
bcostm | 0:0002c86c2220 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bcostm | 0:0002c86c2220 | 19 | * this list of conditions and the following disclaimer in the documentation |
bcostm | 0:0002c86c2220 | 20 | * and/or other materials provided with the distribution. |
bcostm | 0:0002c86c2220 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bcostm | 0:0002c86c2220 | 22 | * may be used to endorse or promote products derived from this software |
bcostm | 0:0002c86c2220 | 23 | * without specific prior written permission. |
bcostm | 0:0002c86c2220 | 24 | * |
bcostm | 0:0002c86c2220 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bcostm | 0:0002c86c2220 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bcostm | 0:0002c86c2220 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bcostm | 0:0002c86c2220 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bcostm | 0:0002c86c2220 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bcostm | 0:0002c86c2220 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bcostm | 0:0002c86c2220 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bcostm | 0:0002c86c2220 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bcostm | 0:0002c86c2220 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bcostm | 0:0002c86c2220 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bcostm | 0:0002c86c2220 | 35 | * |
bcostm | 0:0002c86c2220 | 36 | ****************************************************************************** |
bcostm | 0:0002c86c2220 | 37 | */ |
bcostm | 0:0002c86c2220 | 38 | |
bcostm | 0:0002c86c2220 | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bcostm | 0:0002c86c2220 | 40 | #ifndef __STM32469I_DISCOVERY_TS_H |
bcostm | 0:0002c86c2220 | 41 | #define __STM32469I_DISCOVERY_TS_H |
bcostm | 0:0002c86c2220 | 42 | |
bcostm | 0:0002c86c2220 | 43 | #ifdef __cplusplus |
bcostm | 0:0002c86c2220 | 44 | extern "C" { |
bcostm | 0:0002c86c2220 | 45 | #endif |
bcostm | 0:0002c86c2220 | 46 | |
bcostm | 0:0002c86c2220 | 47 | /* Includes ------------------------------------------------------------------*/ |
bcostm | 0:0002c86c2220 | 48 | #include "stm32469i_discovery.h" |
bcostm | 0:0002c86c2220 | 49 | #include "stm32469i_discovery_lcd.h" |
bcostm | 0:0002c86c2220 | 50 | |
bcostm | 0:0002c86c2220 | 51 | /* Include TouchScreen component driver */ |
bcostm | 0:0002c86c2220 | 52 | #include "../Components/ft6x06/ft6x06.h" |
bcostm | 0:0002c86c2220 | 53 | |
bcostm | 0:0002c86c2220 | 54 | /** @addtogroup BSP |
bcostm | 0:0002c86c2220 | 55 | * @{ |
bcostm | 0:0002c86c2220 | 56 | */ |
bcostm | 0:0002c86c2220 | 57 | |
bcostm | 0:0002c86c2220 | 58 | /** @addtogroup STM32469I-Discovery |
bcostm | 0:0002c86c2220 | 59 | * @{ |
bcostm | 0:0002c86c2220 | 60 | */ |
bcostm | 0:0002c86c2220 | 61 | |
bcostm | 0:0002c86c2220 | 62 | /** @defgroup STM32469I-Discovery_TS STM32469I-Discovery TS |
bcostm | 0:0002c86c2220 | 63 | * @{ |
bcostm | 0:0002c86c2220 | 64 | */ |
bcostm | 0:0002c86c2220 | 65 | |
bcostm | 0:0002c86c2220 | 66 | /** @defgroup STM32469I-Discovery_TS_Exported_Constants TS Exported Constants |
bcostm | 0:0002c86c2220 | 67 | * @{ |
bcostm | 0:0002c86c2220 | 68 | */ |
bcostm | 0:0002c86c2220 | 69 | /** @brief With FT6206 : maximum 2 touches detected simultaneously |
bcostm | 0:0002c86c2220 | 70 | */ |
bcostm | 0:0002c86c2220 | 71 | #define TS_MAX_NB_TOUCH ((uint32_t) FT6206_MAX_DETECTABLE_TOUCH) |
bcostm | 0:0002c86c2220 | 72 | #define TS_NO_IRQ_PENDING ((uint8_t) 0) |
bcostm | 0:0002c86c2220 | 73 | #define TS_IRQ_PENDING ((uint8_t) 1) |
bcostm | 0:0002c86c2220 | 74 | |
bcostm | 0:0002c86c2220 | 75 | #define TS_SWAP_NONE ((uint8_t) 0x01) |
bcostm | 0:0002c86c2220 | 76 | #define TS_SWAP_X ((uint8_t) 0x02) |
bcostm | 0:0002c86c2220 | 77 | #define TS_SWAP_Y ((uint8_t) 0x04) |
bcostm | 0:0002c86c2220 | 78 | #define TS_SWAP_XY ((uint8_t) 0x08) |
bcostm | 0:0002c86c2220 | 79 | |
bcostm | 0:0002c86c2220 | 80 | /** |
bcostm | 0:0002c86c2220 | 81 | * @} |
bcostm | 0:0002c86c2220 | 82 | */ |
bcostm | 0:0002c86c2220 | 83 | |
bcostm | 0:0002c86c2220 | 84 | /** @defgroup STM32469I-Discovery_TS_Exported_Types TS Exported Types |
bcostm | 0:0002c86c2220 | 85 | * @{ |
bcostm | 0:0002c86c2220 | 86 | */ |
bcostm | 0:0002c86c2220 | 87 | /** |
bcostm | 0:0002c86c2220 | 88 | * @brief TS_StateTypeDef |
bcostm | 0:0002c86c2220 | 89 | * Define TS State structure |
bcostm | 0:0002c86c2220 | 90 | */ |
bcostm | 0:0002c86c2220 | 91 | typedef struct |
bcostm | 0:0002c86c2220 | 92 | { |
bcostm | 0:0002c86c2220 | 93 | uint8_t touchDetected; /*!< Total number of active touches detected at last scan */ |
bcostm | 0:0002c86c2220 | 94 | uint16_t touchX[TS_MAX_NB_TOUCH]; /*!< Touch X[0], X[1] coordinates on 12 bits */ |
bcostm | 0:0002c86c2220 | 95 | uint16_t touchY[TS_MAX_NB_TOUCH]; /*!< Touch Y[0], Y[1] coordinates on 12 bits */ |
bcostm | 0:0002c86c2220 | 96 | |
bcostm | 0:0002c86c2220 | 97 | #if (TS_MULTI_TOUCH_SUPPORTED == 1) |
bcostm | 0:0002c86c2220 | 98 | uint8_t touchWeight[TS_MAX_NB_TOUCH]; /*!< Touch_Weight[0], Touch_Weight[1] : weight property of touches */ |
bcostm | 0:0002c86c2220 | 99 | uint8_t touchEventId[TS_MAX_NB_TOUCH]; /*!< Touch_EventId[0], Touch_EventId[1] : take value of type @ref TS_TouchEventTypeDef */ |
bcostm | 0:0002c86c2220 | 100 | uint8_t touchArea[TS_MAX_NB_TOUCH]; /*!< Touch_Area[0], Touch_Area[1] : touch area of each touch */ |
bcostm | 0:0002c86c2220 | 101 | uint32_t gestureId; /*!< type of gesture detected : take value of type @ref TS_GestureIdTypeDef */ |
bcostm | 0:0002c86c2220 | 102 | #endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */ |
bcostm | 0:0002c86c2220 | 103 | |
bcostm | 0:0002c86c2220 | 104 | } TS_StateTypeDef; |
bcostm | 0:0002c86c2220 | 105 | |
bcostm | 0:0002c86c2220 | 106 | /** |
bcostm | 0:0002c86c2220 | 107 | * @brief TS_StatusTypeDef |
bcostm | 0:0002c86c2220 | 108 | * Define BSP_TS_xxx() functions possible return value, |
bcostm | 0:0002c86c2220 | 109 | * when status is returned by those functions. |
bcostm | 0:0002c86c2220 | 110 | */ |
bcostm | 0:0002c86c2220 | 111 | typedef enum |
bcostm | 0:0002c86c2220 | 112 | { |
bcostm | 0:0002c86c2220 | 113 | TS_OK = 0x00, /*!< Touch Ok */ |
bcostm | 0:0002c86c2220 | 114 | TS_ERROR = 0x01, /*!< Touch Error */ |
bcostm | 0:0002c86c2220 | 115 | TS_TIMEOUT = 0x02, /*!< Touch Timeout */ |
bcostm | 0:0002c86c2220 | 116 | TS_DEVICE_NOT_FOUND = 0x03 /*!< Touchscreen device not found */ |
bcostm | 0:0002c86c2220 | 117 | } TS_StatusTypeDef; |
bcostm | 0:0002c86c2220 | 118 | |
bcostm | 0:0002c86c2220 | 119 | /** |
bcostm | 0:0002c86c2220 | 120 | * @brief TS_GestureIdTypeDef |
bcostm | 0:0002c86c2220 | 121 | * Define Possible managed gesture identification values returned by touch screen |
bcostm | 0:0002c86c2220 | 122 | * driver. |
bcostm | 0:0002c86c2220 | 123 | */ |
bcostm | 0:0002c86c2220 | 124 | typedef enum |
bcostm | 0:0002c86c2220 | 125 | { |
bcostm | 0:0002c86c2220 | 126 | GEST_ID_NO_GESTURE = 0x00, /*!< Gesture not defined / recognized */ |
bcostm | 0:0002c86c2220 | 127 | GEST_ID_MOVE_UP = 0x01, /*!< Gesture Move Up */ |
bcostm | 0:0002c86c2220 | 128 | GEST_ID_MOVE_RIGHT = 0x02, /*!< Gesture Move Right */ |
bcostm | 0:0002c86c2220 | 129 | GEST_ID_MOVE_DOWN = 0x03, /*!< Gesture Move Down */ |
bcostm | 0:0002c86c2220 | 130 | GEST_ID_MOVE_LEFT = 0x04, /*!< Gesture Move Left */ |
bcostm | 0:0002c86c2220 | 131 | GEST_ID_ZOOM_IN = 0x05, /*!< Gesture Zoom In */ |
bcostm | 0:0002c86c2220 | 132 | GEST_ID_ZOOM_OUT = 0x06, /*!< Gesture Zoom Out */ |
bcostm | 0:0002c86c2220 | 133 | GEST_ID_NB_MAX = 0x07 /*!< max number of gesture id */ |
bcostm | 0:0002c86c2220 | 134 | } TS_GestureIdTypeDef; |
bcostm | 0:0002c86c2220 | 135 | |
bcostm | 0:0002c86c2220 | 136 | /** |
bcostm | 0:0002c86c2220 | 137 | * @brief TS_TouchEventTypeDef |
bcostm | 0:0002c86c2220 | 138 | * Define Possible touch events kind as returned values |
bcostm | 0:0002c86c2220 | 139 | * by touch screen IC Driver. |
bcostm | 0:0002c86c2220 | 140 | */ |
bcostm | 0:0002c86c2220 | 141 | typedef enum |
bcostm | 0:0002c86c2220 | 142 | { |
bcostm | 0:0002c86c2220 | 143 | TOUCH_EVENT_NO_EVT = 0x00, /*!< Touch Event : undetermined */ |
bcostm | 0:0002c86c2220 | 144 | TOUCH_EVENT_PRESS_DOWN = 0x01, /*!< Touch Event Press Down */ |
bcostm | 0:0002c86c2220 | 145 | TOUCH_EVENT_LIFT_UP = 0x02, /*!< Touch Event Lift Up */ |
bcostm | 0:0002c86c2220 | 146 | TOUCH_EVENT_CONTACT = 0x03, /*!< Touch Event Contact */ |
bcostm | 0:0002c86c2220 | 147 | TOUCH_EVENT_NB_MAX = 0x04 /*!< max number of touch events kind */ |
bcostm | 0:0002c86c2220 | 148 | } TS_TouchEventTypeDef; |
bcostm | 0:0002c86c2220 | 149 | |
bcostm | 0:0002c86c2220 | 150 | /** |
bcostm | 0:0002c86c2220 | 151 | * @} |
bcostm | 0:0002c86c2220 | 152 | */ |
bcostm | 0:0002c86c2220 | 153 | |
bcostm | 0:0002c86c2220 | 154 | /** @defgroup STM32469I-Discovery_TS_Imported_Variables STM32469I Discovery TS Imported Variables |
bcostm | 0:0002c86c2220 | 155 | * @{ |
bcostm | 0:0002c86c2220 | 156 | */ |
bcostm | 0:0002c86c2220 | 157 | /** |
bcostm | 0:0002c86c2220 | 158 | * @brief Table for touchscreen event information display on LCD : |
bcostm | 0:0002c86c2220 | 159 | * table indexed on enum @ref TS_TouchEventTypeDef information |
bcostm | 0:0002c86c2220 | 160 | */ |
bcostm | 0:0002c86c2220 | 161 | extern char * ts_event_string_tab[TOUCH_EVENT_NB_MAX]; |
bcostm | 0:0002c86c2220 | 162 | |
bcostm | 0:0002c86c2220 | 163 | /** |
bcostm | 0:0002c86c2220 | 164 | * @brief Table for touchscreen gesture Id information display on LCD : table indexed |
bcostm | 0:0002c86c2220 | 165 | * on enum @ref TS_GestureIdTypeDef information |
bcostm | 0:0002c86c2220 | 166 | */ |
bcostm | 0:0002c86c2220 | 167 | extern char * ts_gesture_id_string_tab[GEST_ID_NB_MAX]; |
bcostm | 0:0002c86c2220 | 168 | /** |
bcostm | 0:0002c86c2220 | 169 | * @} |
bcostm | 0:0002c86c2220 | 170 | */ |
bcostm | 0:0002c86c2220 | 171 | |
bcostm | 0:0002c86c2220 | 172 | /** @defgroup STM32469I-Discovery_TS_Exported_Functions TS Exported Functions |
bcostm | 0:0002c86c2220 | 173 | * @{ |
bcostm | 0:0002c86c2220 | 174 | */ |
bcostm | 0:0002c86c2220 | 175 | uint8_t BSP_TS_Init(uint16_t ts_SizeX, uint16_t ts_SizeY); |
bcostm | 0:0002c86c2220 | 176 | uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State); |
bcostm | 0:0002c86c2220 | 177 | |
bcostm | 0:0002c86c2220 | 178 | #if (TS_MULTI_TOUCH_SUPPORTED == 1) |
bcostm | 0:0002c86c2220 | 179 | uint8_t BSP_TS_Get_GestureId(TS_StateTypeDef *TS_State); |
bcostm | 0:0002c86c2220 | 180 | uint8_t BSP_TS_ResetTouchData(TS_StateTypeDef *TS_State); |
bcostm | 0:0002c86c2220 | 181 | #endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */ |
bcostm | 0:0002c86c2220 | 182 | |
bcostm | 0:0002c86c2220 | 183 | uint8_t BSP_TS_ITConfig(void); |
bcostm | 0:0002c86c2220 | 184 | |
bcostm | 0:0002c86c2220 | 185 | |
bcostm | 0:0002c86c2220 | 186 | /* These __weak function can be surcharged by application code in case the current settings |
bcostm | 0:0002c86c2220 | 187 | need to be changed for specific (example GPIO allocation) */ |
bcostm | 0:0002c86c2220 | 188 | void BSP_TS_INT_MspInit(void); |
bcostm | 0:0002c86c2220 | 189 | |
bcostm | 0:0002c86c2220 | 190 | /** |
bcostm | 0:0002c86c2220 | 191 | * @} |
bcostm | 0:0002c86c2220 | 192 | */ |
bcostm | 0:0002c86c2220 | 193 | |
bcostm | 0:0002c86c2220 | 194 | /** |
bcostm | 0:0002c86c2220 | 195 | * @} |
bcostm | 0:0002c86c2220 | 196 | */ |
bcostm | 0:0002c86c2220 | 197 | |
bcostm | 0:0002c86c2220 | 198 | /** |
bcostm | 0:0002c86c2220 | 199 | * @} |
bcostm | 0:0002c86c2220 | 200 | */ |
bcostm | 0:0002c86c2220 | 201 | |
bcostm | 0:0002c86c2220 | 202 | /** |
bcostm | 0:0002c86c2220 | 203 | * @} |
bcostm | 0:0002c86c2220 | 204 | */ |
bcostm | 0:0002c86c2220 | 205 | |
bcostm | 0:0002c86c2220 | 206 | |
bcostm | 0:0002c86c2220 | 207 | #ifdef __cplusplus |
bcostm | 0:0002c86c2220 | 208 | } |
bcostm | 0:0002c86c2220 | 209 | #endif |
bcostm | 0:0002c86c2220 | 210 | |
bcostm | 0:0002c86c2220 | 211 | #endif /* __STM32469I_DISCOVERY_TS_H */ |
bcostm | 0:0002c86c2220 | 212 | |
bcostm | 0:0002c86c2220 | 213 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |