BSP driver for DISCO_L496AG
Dependents: DISCO_L496AG-LCD-prova_1 DISCO_L496AG-LCD-prova_2 DISCO_L496AG-LCD-demo DISCO_L496AG-SRAM-demo
Drivers/BSP/STM32L496G-Discovery/stm32l496g_discovery_ts.h@2:106c7b82e064, 2019-11-20 (annotated)
- Committer:
- Jerome Coutant
- Date:
- Wed Nov 20 16:48:24 2019 +0100
- Revision:
- 2:106c7b82e064
- Parent:
- 0:d83f1c8ca282
Update BSP files with CubeL4 V1.14.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:d83f1c8ca282 | 1 | /** |
bcostm | 0:d83f1c8ca282 | 2 | ****************************************************************************** |
bcostm | 0:d83f1c8ca282 | 3 | * @file stm32l496g_discovery_ts.h |
bcostm | 0:d83f1c8ca282 | 4 | * @author MCD Application Team |
bcostm | 0:d83f1c8ca282 | 5 | * @brief This file contains the common defines and functions prototypes for |
bcostm | 0:d83f1c8ca282 | 6 | * the stm32l496g_discovery_ts.c driver. |
bcostm | 0:d83f1c8ca282 | 7 | ****************************************************************************** |
bcostm | 0:d83f1c8ca282 | 8 | * @attention |
bcostm | 0:d83f1c8ca282 | 9 | * |
Jerome Coutant
2:106c7b82e064
|
10
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
|
Jerome Coutant
2:106c7b82e064
|
11
|
* All rights reserved.</center></h2>
|
|
bcostm | 0:d83f1c8ca282 | 12 | * |
Jerome Coutant
2:106c7b82e064
|
13
|
* This software component is licensed by ST under BSD 3-Clause license,
|
|
Jerome Coutant
2:106c7b82e064
|
14
|
* the "License"; You may not use this file except in compliance with the
|
|
Jerome Coutant
2:106c7b82e064
|
15
|
* License. You may obtain a copy of the License at:
|
|
Jerome Coutant
2:106c7b82e064
|
16
|
* opensource.org/licenses/BSD-3-Clause
|
|
bcostm | 0:d83f1c8ca282 | 17 | * |
bcostm | 0:d83f1c8ca282 | 18 | ****************************************************************************** |
bcostm | 0:d83f1c8ca282 | 19 | */ |
bcostm | 0:d83f1c8ca282 | 20 | |
bcostm | 0:d83f1c8ca282 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bcostm | 0:d83f1c8ca282 | 22 | #ifndef __STM32L496G_DISCOVERY_TS_H |
bcostm | 0:d83f1c8ca282 | 23 | #define __STM32L496G_DISCOVERY_TS_H |
bcostm | 0:d83f1c8ca282 | 24 | |
bcostm | 0:d83f1c8ca282 | 25 | #ifdef __cplusplus |
bcostm | 0:d83f1c8ca282 | 26 | extern "C" { |
bcostm | 0:d83f1c8ca282 | 27 | #endif |
bcostm | 0:d83f1c8ca282 | 28 | |
bcostm | 0:d83f1c8ca282 | 29 | /* Includes ------------------------------------------------------------------*/ |
bcostm | 0:d83f1c8ca282 | 30 | #include "stm32l496g_discovery.h" |
bcostm | 0:d83f1c8ca282 | 31 | #include "stm32l496g_discovery_lcd.h" |
bcostm | 0:d83f1c8ca282 | 32 | |
bcostm | 0:d83f1c8ca282 | 33 | /* Include TouchScreen component driver */ |
bcostm | 0:d83f1c8ca282 | 34 | #include "../Components/ft6x06/ft6x06.h" |
bcostm | 0:d83f1c8ca282 | 35 | |
bcostm | 0:d83f1c8ca282 | 36 | /** @addtogroup BSP |
bcostm | 0:d83f1c8ca282 | 37 | * @{ |
bcostm | 0:d83f1c8ca282 | 38 | */ |
bcostm | 0:d83f1c8ca282 | 39 | |
bcostm | 0:d83f1c8ca282 | 40 | /** @addtogroup STM32L496G-DISCOVERY |
bcostm | 0:d83f1c8ca282 | 41 | * @{ |
bcostm | 0:d83f1c8ca282 | 42 | */ |
bcostm | 0:d83f1c8ca282 | 43 | |
bcostm | 0:d83f1c8ca282 | 44 | /** @defgroup STM32L496G-DISCOVERY_TS STM32L496G-DISCOVERY TS |
bcostm | 0:d83f1c8ca282 | 45 | * @{ |
bcostm | 0:d83f1c8ca282 | 46 | */ |
bcostm | 0:d83f1c8ca282 | 47 | |
bcostm | 0:d83f1c8ca282 | 48 | /** @defgroup STM32L496G-DISCOVERY_TS_Exported_Constants TS Exported Constants |
bcostm | 0:d83f1c8ca282 | 49 | * @{ |
bcostm | 0:d83f1c8ca282 | 50 | */ |
bcostm | 0:d83f1c8ca282 | 51 | /** @brief With FT6206 : maximum 2 touches detected simultaneously |
bcostm | 0:d83f1c8ca282 | 52 | */ |
bcostm | 0:d83f1c8ca282 | 53 | #define TS_MAX_NB_TOUCH ((uint32_t) FT6206_MAX_DETECTABLE_TOUCH) |
bcostm | 0:d83f1c8ca282 | 54 | |
bcostm | 0:d83f1c8ca282 | 55 | #define TS_NO_IRQ_PENDING ((uint8_t) 0) |
bcostm | 0:d83f1c8ca282 | 56 | #define TS_IRQ_PENDING ((uint8_t) 1) |
bcostm | 0:d83f1c8ca282 | 57 | |
bcostm | 0:d83f1c8ca282 | 58 | #define TS_SWAP_NONE ((uint8_t) 0x01) |
bcostm | 0:d83f1c8ca282 | 59 | #define TS_SWAP_X ((uint8_t) 0x02) |
bcostm | 0:d83f1c8ca282 | 60 | #define TS_SWAP_Y ((uint8_t) 0x04) |
bcostm | 0:d83f1c8ca282 | 61 | #define TS_SWAP_XY ((uint8_t) 0x08) |
bcostm | 0:d83f1c8ca282 | 62 | |
bcostm | 0:d83f1c8ca282 | 63 | #define TS_ORIENTATION_PORTRAIT ((uint8_t) 0) |
bcostm | 0:d83f1c8ca282 | 64 | #define TS_ORIENTATION_LANDSCAPE ((uint8_t) 1) |
bcostm | 0:d83f1c8ca282 | 65 | #define TS_ORIENTATION_UNDEFINED ((uint8_t) 2) |
bcostm | 0:d83f1c8ca282 | 66 | /** |
bcostm | 0:d83f1c8ca282 | 67 | * @} |
bcostm | 0:d83f1c8ca282 | 68 | */ |
bcostm | 0:d83f1c8ca282 | 69 | |
bcostm | 0:d83f1c8ca282 | 70 | /** @defgroup STM32L496G-DISCOVERY_TS_Exported_Types TS Exported Types |
bcostm | 0:d83f1c8ca282 | 71 | * @{ |
bcostm | 0:d83f1c8ca282 | 72 | */ |
bcostm | 0:d83f1c8ca282 | 73 | /** |
bcostm | 0:d83f1c8ca282 | 74 | * @brief TS_StateTypeDef |
bcostm | 0:d83f1c8ca282 | 75 | * Define TS State structure |
bcostm | 0:d83f1c8ca282 | 76 | */ |
bcostm | 0:d83f1c8ca282 | 77 | typedef struct |
bcostm | 0:d83f1c8ca282 | 78 | { |
bcostm | 0:d83f1c8ca282 | 79 | uint8_t touchDetected; /*!< Total number of active touches detected at last scan */ |
bcostm | 0:d83f1c8ca282 | 80 | uint16_t touchX[TS_MAX_NB_TOUCH]; /*!< Touch X[0], X[1] coordinates on 12 bits */ |
bcostm | 0:d83f1c8ca282 | 81 | uint16_t touchY[TS_MAX_NB_TOUCH]; /*!< Touch Y[0], Y[1] coordinates on 12 bits */ |
bcostm | 0:d83f1c8ca282 | 82 | |
bcostm | 0:d83f1c8ca282 | 83 | #if (TS_MULTI_TOUCH_SUPPORTED == 1) |
bcostm | 0:d83f1c8ca282 | 84 | uint8_t touchWeight[TS_MAX_NB_TOUCH]; /*!< Touch_Weight[0], Touch_Weight[1] : weight property of touches */ |
bcostm | 0:d83f1c8ca282 | 85 | uint8_t touchEventId[TS_MAX_NB_TOUCH]; /*!< Touch_EventId[0], Touch_EventId[1] : take value of type @ref TS_TouchEventTypeDef */ |
bcostm | 0:d83f1c8ca282 | 86 | uint8_t touchArea[TS_MAX_NB_TOUCH]; /*!< Touch_Area[0], Touch_Area[1] : touch area of each touch */ |
bcostm | 0:d83f1c8ca282 | 87 | uint32_t gestureId; /*!< type of gesture detected : take value of type @ref TS_GestureIdTypeDef */ |
bcostm | 0:d83f1c8ca282 | 88 | #endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */ |
bcostm | 0:d83f1c8ca282 | 89 | |
bcostm | 0:d83f1c8ca282 | 90 | } TS_StateTypeDef; |
bcostm | 0:d83f1c8ca282 | 91 | |
bcostm | 0:d83f1c8ca282 | 92 | /** |
bcostm | 0:d83f1c8ca282 | 93 | * @brief TS_StatusTypeDef |
bcostm | 0:d83f1c8ca282 | 94 | * Define BSP_TS_xxx() functions possible return value, |
bcostm | 0:d83f1c8ca282 | 95 | * when status is returned by those functions. |
bcostm | 0:d83f1c8ca282 | 96 | */ |
bcostm | 0:d83f1c8ca282 | 97 | typedef enum |
bcostm | 0:d83f1c8ca282 | 98 | { |
bcostm | 0:d83f1c8ca282 | 99 | TS_OK = 0x00, /*!< Touch Ok */ |
bcostm | 0:d83f1c8ca282 | 100 | TS_ERROR = 0x01, /*!< Touch Error */ |
bcostm | 0:d83f1c8ca282 | 101 | TS_TIMEOUT = 0x02, /*!< Touch Timeout */ |
bcostm | 0:d83f1c8ca282 | 102 | TS_DEVICE_NOT_FOUND = 0x03 /*!< Touchscreen device not found */ |
bcostm | 0:d83f1c8ca282 | 103 | } TS_StatusTypeDef; |
bcostm | 0:d83f1c8ca282 | 104 | |
bcostm | 0:d83f1c8ca282 | 105 | /** |
bcostm | 0:d83f1c8ca282 | 106 | * @brief TS_GestureIdTypeDef |
bcostm | 0:d83f1c8ca282 | 107 | * Define Possible managed gesture identification values returned by touch screen |
bcostm | 0:d83f1c8ca282 | 108 | * driver. |
bcostm | 0:d83f1c8ca282 | 109 | */ |
bcostm | 0:d83f1c8ca282 | 110 | typedef enum |
bcostm | 0:d83f1c8ca282 | 111 | { |
bcostm | 0:d83f1c8ca282 | 112 | GEST_ID_NO_GESTURE = 0x00, /*!< Gesture not defined / recognized */ |
bcostm | 0:d83f1c8ca282 | 113 | GEST_ID_MOVE_UP = 0x01, /*!< Gesture Move Up */ |
bcostm | 0:d83f1c8ca282 | 114 | GEST_ID_MOVE_RIGHT = 0x02, /*!< Gesture Move Right */ |
bcostm | 0:d83f1c8ca282 | 115 | GEST_ID_MOVE_DOWN = 0x03, /*!< Gesture Move Down */ |
bcostm | 0:d83f1c8ca282 | 116 | GEST_ID_MOVE_LEFT = 0x04, /*!< Gesture Move Left */ |
bcostm | 0:d83f1c8ca282 | 117 | GEST_ID_ZOOM_IN = 0x05, /*!< Gesture Zoom In */ |
bcostm | 0:d83f1c8ca282 | 118 | GEST_ID_ZOOM_OUT = 0x06, /*!< Gesture Zoom Out */ |
bcostm | 0:d83f1c8ca282 | 119 | GEST_ID_NB_MAX = 0x07 /*!< max number of gesture id */ |
bcostm | 0:d83f1c8ca282 | 120 | } TS_GestureIdTypeDef; |
bcostm | 0:d83f1c8ca282 | 121 | |
bcostm | 0:d83f1c8ca282 | 122 | /** |
bcostm | 0:d83f1c8ca282 | 123 | * @brief TS_TouchEventTypeDef |
bcostm | 0:d83f1c8ca282 | 124 | * Define Possible touch events kind as returned values |
bcostm | 0:d83f1c8ca282 | 125 | * by touch screen IC Driver. |
bcostm | 0:d83f1c8ca282 | 126 | */ |
bcostm | 0:d83f1c8ca282 | 127 | typedef enum |
bcostm | 0:d83f1c8ca282 | 128 | { |
bcostm | 0:d83f1c8ca282 | 129 | TOUCH_EVENT_NO_EVT = 0x00, /*!< Touch Event : undetermined */ |
bcostm | 0:d83f1c8ca282 | 130 | TOUCH_EVENT_PRESS_DOWN = 0x01, /*!< Touch Event Press Down */ |
bcostm | 0:d83f1c8ca282 | 131 | TOUCH_EVENT_LIFT_UP = 0x02, /*!< Touch Event Lift Up */ |
bcostm | 0:d83f1c8ca282 | 132 | TOUCH_EVENT_CONTACT = 0x03, /*!< Touch Event Contact */ |
bcostm | 0:d83f1c8ca282 | 133 | TOUCH_EVENT_NB_MAX = 0x04 /*!< max number of touch events kind */ |
bcostm | 0:d83f1c8ca282 | 134 | } TS_TouchEventTypeDef; |
bcostm | 0:d83f1c8ca282 | 135 | |
bcostm | 0:d83f1c8ca282 | 136 | /** |
bcostm | 0:d83f1c8ca282 | 137 | * @} |
bcostm | 0:d83f1c8ca282 | 138 | */ |
bcostm | 0:d83f1c8ca282 | 139 | |
bcostm | 0:d83f1c8ca282 | 140 | /** @defgroup STM32L496G-DISCOVERY_TS_Imported_Variables STM32L496G DISCOVERY TS Imported Variables |
bcostm | 0:d83f1c8ca282 | 141 | * @{ |
bcostm | 0:d83f1c8ca282 | 142 | */ |
bcostm | 0:d83f1c8ca282 | 143 | /** |
bcostm | 0:d83f1c8ca282 | 144 | * @brief Table for touchscreen event information display on LCD : |
bcostm | 0:d83f1c8ca282 | 145 | * table indexed on enum @ref TS_TouchEventTypeDef information |
bcostm | 0:d83f1c8ca282 | 146 | */ |
bcostm | 0:d83f1c8ca282 | 147 | extern char *ts_event_string_tab[TOUCH_EVENT_NB_MAX]; |
bcostm | 0:d83f1c8ca282 | 148 | |
bcostm | 0:d83f1c8ca282 | 149 | /** |
bcostm | 0:d83f1c8ca282 | 150 | * @brief Table for touchscreen gesture Id information display on LCD : table indexed |
bcostm | 0:d83f1c8ca282 | 151 | * on enum @ref TS_GestureIdTypeDef information |
bcostm | 0:d83f1c8ca282 | 152 | */ |
bcostm | 0:d83f1c8ca282 | 153 | extern char *ts_gesture_id_string_tab[GEST_ID_NB_MAX]; |
bcostm | 0:d83f1c8ca282 | 154 | /** |
bcostm | 0:d83f1c8ca282 | 155 | * @} |
bcostm | 0:d83f1c8ca282 | 156 | */ |
bcostm | 0:d83f1c8ca282 | 157 | |
bcostm | 0:d83f1c8ca282 | 158 | /** @defgroup STM32L496G-DISCOVERY_TS_Exported_Functions TS Exported Functions |
bcostm | 0:d83f1c8ca282 | 159 | * @{ |
bcostm | 0:d83f1c8ca282 | 160 | */ |
bcostm | 0:d83f1c8ca282 | 161 | uint8_t BSP_TS_Init(uint16_t ts_SizeX, uint16_t ts_SizeY); |
bcostm | 0:d83f1c8ca282 | 162 | uint8_t BSP_TS_InitEx(uint16_t ts_SizeX, uint16_t ts_SizeY, uint8_t orientation); |
bcostm | 0:d83f1c8ca282 | 163 | uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State); |
bcostm | 0:d83f1c8ca282 | 164 | uint8_t BSP_TS_GetOrientation(void); |
bcostm | 0:d83f1c8ca282 | 165 | |
bcostm | 0:d83f1c8ca282 | 166 | #if (TS_MULTI_TOUCH_SUPPORTED == 1) |
bcostm | 0:d83f1c8ca282 | 167 | uint8_t BSP_TS_Get_GestureId(TS_StateTypeDef *TS_State); |
bcostm | 0:d83f1c8ca282 | 168 | uint8_t BSP_TS_ResetTouchData(TS_StateTypeDef *TS_State); |
bcostm | 0:d83f1c8ca282 | 169 | #endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */ |
bcostm | 0:d83f1c8ca282 | 170 | |
bcostm | 0:d83f1c8ca282 | 171 | uint8_t BSP_TS_ITConfig(void); |
bcostm | 0:d83f1c8ca282 | 172 | uint8_t BSP_TS_ITDeConfig(void); |
bcostm | 0:d83f1c8ca282 | 173 | |
bcostm | 0:d83f1c8ca282 | 174 | /* These __weak function can be surcharged by application code in case the current settings |
bcostm | 0:d83f1c8ca282 | 175 | need to be changed for specific (example GPIO allocation) */ |
bcostm | 0:d83f1c8ca282 | 176 | void BSP_TS_INT_MspInit(void); |
bcostm | 0:d83f1c8ca282 | 177 | void BSP_TS_INT_MspDeInit(void); |
bcostm | 0:d83f1c8ca282 | 178 | |
bcostm | 0:d83f1c8ca282 | 179 | |
bcostm | 0:d83f1c8ca282 | 180 | /** |
bcostm | 0:d83f1c8ca282 | 181 | * @} |
bcostm | 0:d83f1c8ca282 | 182 | */ |
bcostm | 0:d83f1c8ca282 | 183 | |
bcostm | 0:d83f1c8ca282 | 184 | /** |
bcostm | 0:d83f1c8ca282 | 185 | * @} |
bcostm | 0:d83f1c8ca282 | 186 | */ |
bcostm | 0:d83f1c8ca282 | 187 | |
bcostm | 0:d83f1c8ca282 | 188 | /** |
bcostm | 0:d83f1c8ca282 | 189 | * @} |
bcostm | 0:d83f1c8ca282 | 190 | */ |
bcostm | 0:d83f1c8ca282 | 191 | |
bcostm | 0:d83f1c8ca282 | 192 | /** |
bcostm | 0:d83f1c8ca282 | 193 | * @} |
bcostm | 0:d83f1c8ca282 | 194 | */ |
bcostm | 0:d83f1c8ca282 | 195 | |
bcostm | 0:d83f1c8ca282 | 196 | |
bcostm | 0:d83f1c8ca282 | 197 | #ifdef __cplusplus |
bcostm | 0:d83f1c8ca282 | 198 | } |
bcostm | 0:d83f1c8ca282 | 199 | #endif |
bcostm | 0:d83f1c8ca282 | 200 | |
bcostm | 0:d83f1c8ca282 | 201 | #endif /* __STM32L496G_DISCOVERY_TS_H */ |
bcostm | 0:d83f1c8ca282 | 202 | |
bcostm | 0:d83f1c8ca282 | 203 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |