BSP files for STM32H747I-Discovery Copy from ST Cube delivery
Dependents: DISCO_H747I_LCD_demo DISCO_H747I_AUDIO_demo
stm32h747i_discovery_ts.h
00001 /** 00002 ****************************************************************************** 00003 * @file stm32h747i_discovery_ts.h 00004 * @author MCD Application Team 00005 * @brief This file contains the common defines and functions prototypes for 00006 * the stm32h747i_discovery_ts.c driver. 00007 ****************************************************************************** 00008 * @attention 00009 * 00010 * <h2><center>© Copyright (c) 2019 STMicroelectronics. 00011 * All rights reserved.</center></h2> 00012 * 00013 * This software component is licensed by ST under BSD 3-Clause license, 00014 * the "License"; You may not use this file except in compliance with the 00015 * License. You may obtain a copy of the License at: 00016 * opensource.org/licenses/BSD-3-Clause 00017 * 00018 ****************************************************************************** 00019 */ 00020 00021 /* Define to prevent recursive inclusion -------------------------------------*/ 00022 #ifndef __STM32H747I_DISCOVERY_TS_H 00023 #define __STM32H747I_DISCOVERY_TS_H 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00029 /* Includes ------------------------------------------------------------------*/ 00030 #include "stm32h747i_discovery.h" 00031 #include "stm32h747i_discovery_lcd.h" 00032 00033 /* Include TouchScreen component driver */ 00034 #include "../Components/ft6x06/ft6x06.h" 00035 00036 /** @addtogroup BSP 00037 * @{ 00038 */ 00039 00040 /** @addtogroup STM32H747I_DISCOVERY 00041 * @{ 00042 */ 00043 00044 /** @addtogroup STM32H747I_DISCOVERY_TS 00045 * @{ 00046 */ 00047 00048 /** @defgroup STM32H747I_DISCOVERY_TS_Exported_Constants Exported Constants 00049 * @{ 00050 */ 00051 /** @brief With FT6206 : maximum 2 touches detected simultaneously 00052 */ 00053 #define TS_MAX_NB_TOUCH ((uint32_t) FT6206_MAX_DETECTABLE_TOUCH) 00054 00055 #define TS_NO_IRQ_PENDING ((uint8_t) 0) 00056 #define TS_IRQ_PENDING ((uint8_t) 1) 00057 00058 #define TS_SWAP_NONE ((uint8_t) 0x01) 00059 #define TS_SWAP_X ((uint8_t) 0x02) 00060 #define TS_SWAP_Y ((uint8_t) 0x04) 00061 #define TS_SWAP_XY ((uint8_t) 0x08) 00062 00063 /** 00064 * @} 00065 */ 00066 00067 /** @defgroup STM32H747I_DISCOVERY_TS_Exported_Types Exported Types 00068 * @{ 00069 */ 00070 /** 00071 * @brief TS_StateTypeDef 00072 * Define TS State structure 00073 */ 00074 typedef struct 00075 { 00076 uint8_t touchDetected; /*!< Total number of active touches detected at last scan */ 00077 uint16_t touchX[TS_MAX_NB_TOUCH]; /*!< Touch X[0], X[1] coordinates on 12 bits */ 00078 uint16_t touchY[TS_MAX_NB_TOUCH]; /*!< Touch Y[0], Y[1] coordinates on 12 bits */ 00079 00080 #if (TS_MULTI_TOUCH_SUPPORTED == 1) 00081 uint8_t touchWeight[TS_MAX_NB_TOUCH]; /*!< Touch_Weight[0], Touch_Weight[1] : weight property of touches */ 00082 uint8_t touchEventId[TS_MAX_NB_TOUCH]; /*!< Touch_EventId[0], Touch_EventId[1] : take value of type @ref TS_TouchEventTypeDef */ 00083 uint8_t touchArea[TS_MAX_NB_TOUCH]; /*!< Touch_Area[0], Touch_Area[1] : touch area of each touch */ 00084 uint32_t gestureId; /*!< type of gesture detected : take value of type @ref TS_GestureIdTypeDef */ 00085 #endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */ 00086 00087 } TS_StateTypeDef; 00088 00089 /** 00090 * @brief TS_StatusTypeDef 00091 * Define BSP_TS_xxx() functions possible return value, 00092 * when status is returned by those functions. 00093 */ 00094 typedef enum 00095 { 00096 TS_OK = 0x00, /*!< Touch Ok */ 00097 TS_ERROR = 0x01, /*!< Touch Error */ 00098 TS_TIMEOUT = 0x02, /*!< Touch Timeout */ 00099 TS_DEVICE_NOT_FOUND = 0x03 /*!< Touchscreen device not found */ 00100 } TS_StatusTypeDef; 00101 00102 /** 00103 * @brief TS_GestureIdTypeDef 00104 * Define Possible managed gesture identification values returned by touch screen 00105 * driver. 00106 */ 00107 typedef enum 00108 { 00109 GEST_ID_NO_GESTURE = 0x00, /*!< Gesture not defined / recognized */ 00110 GEST_ID_MOVE_UP = 0x01, /*!< Gesture Move Up */ 00111 GEST_ID_MOVE_RIGHT = 0x02, /*!< Gesture Move Right */ 00112 GEST_ID_MOVE_DOWN = 0x03, /*!< Gesture Move Down */ 00113 GEST_ID_MOVE_LEFT = 0x04, /*!< Gesture Move Left */ 00114 GEST_ID_ZOOM_IN = 0x05, /*!< Gesture Zoom In */ 00115 GEST_ID_ZOOM_OUT = 0x06, /*!< Gesture Zoom Out */ 00116 GEST_ID_NB_MAX = 0x07 /*!< max number of gesture id */ 00117 } TS_GestureIdTypeDef; 00118 00119 /** 00120 * @brief TS_TouchEventTypeDef 00121 * Define Possible touch events kind as returned values 00122 * by touch screen IC Driver. 00123 */ 00124 typedef enum 00125 { 00126 TOUCH_EVENT_NO_EVT = 0x00, /*!< Touch Event : undetermined */ 00127 TOUCH_EVENT_PRESS_DOWN = 0x01, /*!< Touch Event Press Down */ 00128 TOUCH_EVENT_LIFT_UP = 0x02, /*!< Touch Event Lift Up */ 00129 TOUCH_EVENT_CONTACT = 0x03, /*!< Touch Event Contact */ 00130 TOUCH_EVENT_NB_MAX = 0x04 /*!< max number of touch events kind */ 00131 } TS_TouchEventTypeDef; 00132 00133 /** 00134 * @} 00135 */ 00136 00137 /** @defgroup STM32H747I_DISCOVERY_TS_Imported_Variables Imported Variables 00138 * @{ 00139 */ 00140 /** 00141 * @brief Table for touchscreen event information display on LCD : 00142 * table indexed on enum @ref TS_TouchEventTypeDef information 00143 */ 00144 extern char * ts_event_string_tab[TOUCH_EVENT_NB_MAX]; 00145 00146 /** 00147 * @brief Table for touchscreen gesture Id information display on LCD : table indexed 00148 * on enum @ref TS_GestureIdTypeDef information 00149 */ 00150 extern char * ts_gesture_id_string_tab[GEST_ID_NB_MAX]; 00151 /** 00152 * @} 00153 */ 00154 00155 /** @addtogroup STM32H747I_DISCOVERY_TS_Exported_Functions 00156 * @{ 00157 */ 00158 uint8_t BSP_TS_Init(uint16_t ts_SizeX, uint16_t ts_SizeY); 00159 uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State); 00160 00161 #if (TS_MULTI_TOUCH_SUPPORTED == 1) 00162 uint8_t BSP_TS_Get_GestureId(TS_StateTypeDef *TS_State); 00163 uint8_t BSP_TS_ResetTouchData(TS_StateTypeDef *TS_State); 00164 #endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */ 00165 00166 uint8_t BSP_TS_ITConfig(void); 00167 00168 /* These __weak function can be surcharged by application code in case the current settings 00169 need to be changed for specific (example GPIO allocation) */ 00170 void BSP_TS_INT_MspInit(void); 00171 00172 /** 00173 * @} 00174 */ 00175 00176 /** 00177 * @} 00178 */ 00179 00180 /** 00181 * @} 00182 */ 00183 00184 /** 00185 * @} 00186 */ 00187 00188 00189 #ifdef __cplusplus 00190 } 00191 #endif 00192 00193 #endif /* __STM32H747I_DISCOVERY_TS_H */ 00194 00195 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 18:45:41 by 1.7.2