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