STM32F469NI Discovery board drivers

Dependents:   DISCO-F469NI_LCDTS_GUI_demo Configurable_Robots DISCO-F469NI_LCD_demo DISCO-F469NI_SD_demo ... more

Committer:
aa6164
Date:
Wed Jun 09 12:45:23 2021 +0000
Revision:
4:27609b3a44ed
Parent:
3:3cdfcc4f7c9d
Updated wait_ms() to thread_sleep_for() for Mbed OS 6+

Who changed what in which revision?

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