STM32F469NI Discovery board drivers

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

Committer:
Jerome Coutant
Date:
Tue May 16 10:50:26 2017 +0200
Revision:
2:123b894b49dd
Child:
3:3cdfcc4f7c9d
STM32Cube_FW_BSP_DISCO_F469NI

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