ST / BSP_DISCO_L4R9I

Dependents:   DISCO_L4R9I-LCD-demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32l4r9i_discovery_ts.h Source File

stm32l4r9i_discovery_ts.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4r9i_discovery_ts.h
00004   * @author  MCD Application Team
00005   * @brief   This file contains the common defines and functions prototypes for
00006   *          the stm32l4r9i_discovery_ts.c driver.
00007   ******************************************************************************
00008   * @attention
00009   *
00010   * <h2><center>&copy; Copyright (c) 2017 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 __STM32L4R9I_DISCOVERY_TS_H
00023 #define __STM32L4R9I_DISCOVERY_TS_H
00024 
00025 #ifdef __cplusplus
00026  extern "C" {
00027 #endif
00028 
00029 /* Includes ------------------------------------------------------------------*/
00030 #include "stm32l4r9i_discovery.h"
00031 #include "stm32l4r9i_discovery_lcd.h"
00032 #include "stm32l4r9i_discovery_io.h"
00033 
00034 /* Include TouchScreen component driver */
00035 #include "../Components/ft3x67/ft3x67.h"
00036 
00037 /** @addtogroup BSP
00038   * @{
00039   */
00040 
00041 /** @addtogroup STM32L4R9I_DISCOVERY
00042   * @{
00043   */
00044 
00045 /** @defgroup STM32L4R9I_DISCOVERY_TS STM32L4R9I_DISCOVERY TS
00046   * @{
00047   */
00048 
00049  /** @defgroup STM32L4R9I_DISCOVERY_TS_Exported_Constants Exported Constants
00050    * @{
00051    */
00052 /** @brief With FT3X67 : maximum 2 touches detected simultaneously
00053   */
00054 #define TS_MAX_NB_TOUCH                 ((uint32_t) FT3X67_MAX_DETECTABLE_TOUCH)
00055 
00056 #define TS_NO_IRQ_PENDING               ((uint8_t) 0)
00057 #define TS_IRQ_PENDING                  ((uint8_t) 1)
00058 
00059 #define TS_SWAP_NONE                    ((uint8_t) 0x01)
00060 #define TS_SWAP_X                       ((uint8_t) 0x02)
00061 #define TS_SWAP_Y                       ((uint8_t) 0x04)
00062 #define TS_SWAP_XY                      ((uint8_t) 0x08)
00063 
00064 #define TS_ORIENTATION_PORTRAIT         ((uint8_t) 0)
00065 #define TS_ORIENTATION_LANDSCAPE        ((uint8_t) 1)
00066 
00067 /**
00068   * @}
00069   */
00070 
00071 /** @defgroup STM32L4R9I_DISCOVERY_TS_Exported_Types  Exported Types
00072   * @{
00073   */
00074 /**
00075 *  @brief TS_StateTypeDef
00076 *  Define TS State structure
00077 */
00078 typedef struct
00079 {
00080   uint8_t  touchDetected;                 /*!< Total number of active touches detected at last scan */
00081   uint16_t touchX[TS_MAX_NB_TOUCH];       /*!< Touch X[0], X[1] coordinates on 12 bits */
00082   uint16_t touchY[TS_MAX_NB_TOUCH];       /*!< Touch Y[0], Y[1] coordinates on 12 bits */
00083   uint8_t  touchWeight[TS_MAX_NB_TOUCH];  /*!< Touch_Weight[0], Touch_Weight[1] : weight property of touches */
00084   uint8_t  touchEventId[TS_MAX_NB_TOUCH]; /*!< Touch_EventId[0], Touch_EventId[1] : take value of type @ref TS_TouchEventTypeDef */
00085   uint8_t  touchArea[TS_MAX_NB_TOUCH];    /*!< Touch_Area[0], Touch_Area[1] : touch area of each touch */
00086   uint32_t gestureId;                     /*!< type of gesture detected : take value of type @ref TS_GestureIdTypeDef */
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_SINGLE_CLICK = 0x07, /*!< Gesture Single Click */
00117   GEST_ID_DOUBLE_CLICK = 0x08, /*!< Gesture Double Click */
00118   GEST_ID_NB_MAX       = 0x09 /*!< max number of gesture id */
00119 } TS_GestureIdTypeDef;
00120 
00121 /**
00122  *  @brief TS_TouchEventTypeDef
00123  *  Define Possible touch events kind as returned values
00124  *  by touch screen IC Driver.
00125  */
00126 typedef enum
00127 {
00128   TOUCH_EVENT_NO_EVT        = 0x00, /*!< Touch Event : undetermined */
00129   TOUCH_EVENT_PRESS_DOWN    = 0x01, /*!< Touch Event Press Down */
00130   TOUCH_EVENT_LIFT_UP       = 0x02, /*!< Touch Event Lift Up */
00131   TOUCH_EVENT_CONTACT       = 0x03, /*!< Touch Event Contact */
00132   TOUCH_EVENT_NB_MAX        = 0x04  /*!< max number of touch events kind */
00133 } TS_TouchEventTypeDef;
00134 
00135 /**
00136   * @}
00137   */
00138 
00139 /** @defgroup STM32L4R9I_DISCOVERY_TS_Exported_Functions Exported Functions
00140   * @{
00141   */
00142 
00143 uint8_t BSP_TS_Init(uint16_t ts_SizeX, uint16_t ts_SizeY);
00144 uint8_t BSP_TS_DeInit(void);
00145 
00146 uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State);
00147 uint8_t BSP_TS_GestureConfig(FunctionalState State);
00148 uint8_t BSP_TS_Get_GestureId(TS_StateTypeDef *TS_State);
00149 uint8_t BSP_TS_ResetTouchData(TS_StateTypeDef *TS_State);
00150 
00151 uint8_t BSP_TS_ITConfig(void);
00152 uint8_t BSP_TS_ITDisable(void);
00153 uint8_t BSP_TS_ITGetStatus(void);
00154 void    BSP_TS_ITClear(void);
00155 
00156 /**
00157   * @}
00158   */
00159 
00160 /**
00161   * @}
00162   */
00163 
00164 /**
00165   * @}
00166   */
00167 
00168 /**
00169   * @}
00170   */
00171 
00172 
00173 #ifdef __cplusplus
00174 }
00175 #endif
00176 
00177 #endif /* __STM32L4R9I_DISCOVERY_TS_H */
00178 
00179 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/