BSP files for STM32H747I-Discovery Copy from ST Cube delivery

Dependents:   DISCO_H747I_LCD_demo DISCO_H747I_AUDIO_demo

Committer:
Jerome Coutant
Date:
Wed Nov 06 11:32:01 2019 +0100
Revision:
3:bc403474b366
Parent:
0:146cf26a9bbb
Add PDM lib

Who changed what in which revision?

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