STM32L4R9I-Discovery BSP User Manual: stm32l4r9i_discovery_ts.h Source File

STM32L4R9I-Discovery BSP

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</center></h2>
00011   *
00012   * Redistribution and use in source and binary forms, with or without modification,
00013   * are permitted provided that the following conditions are met:
00014   *   1. Redistributions of source code must retain the above copyright notice,
00015   *      this list of conditions and the following disclaimer.
00016   *   2. Redistributions in binary form must reproduce the above copyright notice,
00017   *      this list of conditions and the following disclaimer in the documentation
00018   *      and/or other materials provided with the distribution.
00019   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00020   *      may be used to endorse or promote products derived from this software
00021   *      without specific prior written permission.
00022   *
00023   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00026   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00027   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00028   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00029   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033   *
00034   ******************************************************************************
00035   */
00036 
00037 /* Define to prevent recursive inclusion -------------------------------------*/
00038 #ifndef __STM32L4R9I_DISCOVERY_TS_H
00039 #define __STM32L4R9I_DISCOVERY_TS_H
00040 
00041 #ifdef __cplusplus
00042  extern "C" {
00043 #endif
00044 
00045 /* Includes ------------------------------------------------------------------*/
00046 #include "stm32l4r9i_discovery.h"
00047 #include "stm32l4r9i_discovery_lcd.h"
00048 #include "stm32l4r9i_discovery_io.h"
00049 
00050 /* Include TouchScreen component driver */
00051 #include "../Components/ft3x67/ft3x67.h"
00052 
00053 /** @addtogroup BSP
00054   * @{
00055   */
00056 
00057 /** @addtogroup STM32L4R9I_DISCOVERY
00058   * @{
00059   */
00060 
00061 /** @defgroup STM32L4R9I_DISCOVERY_TS STM32L4R9I_DISCOVERY TS
00062   * @{
00063   */
00064 
00065  /** @defgroup STM32L4R9I_DISCOVERY_TS_Exported_Constants Exported Constants
00066    * @{
00067    */
00068 /** @brief With FT3X67 : maximum 2 touches detected simultaneously
00069   */
00070 #define TS_MAX_NB_TOUCH                 ((uint32_t) FT3X67_MAX_DETECTABLE_TOUCH)
00071 
00072 #define TS_NO_IRQ_PENDING               ((uint8_t) 0)
00073 #define TS_IRQ_PENDING                  ((uint8_t) 1)
00074 
00075 #define TS_SWAP_NONE                    ((uint8_t) 0x01)
00076 #define TS_SWAP_X                       ((uint8_t) 0x02)
00077 #define TS_SWAP_Y                       ((uint8_t) 0x04)
00078 #define TS_SWAP_XY                      ((uint8_t) 0x08)
00079 
00080 #define TS_ORIENTATION_PORTRAIT         ((uint8_t) 0)
00081 #define TS_ORIENTATION_LANDSCAPE        ((uint8_t) 1)
00082 
00083 /**
00084   * @}
00085   */
00086 
00087 /** @defgroup STM32L4R9I_DISCOVERY_TS_Exported_Types  Exported Types
00088   * @{
00089   */
00090 /**
00091 *  @brief TS_StateTypeDef
00092 *  Define TS State structure
00093 */
00094 typedef struct
00095 {
00096   uint8_t  touchDetected;                 /*!< Total number of active touches detected at last scan */
00097   uint16_t touchX[TS_MAX_NB_TOUCH];       /*!< Touch X[0], X[1] coordinates on 12 bits */
00098   uint16_t touchY[TS_MAX_NB_TOUCH];       /*!< Touch Y[0], Y[1] coordinates on 12 bits */
00099   uint8_t  touchWeight[TS_MAX_NB_TOUCH];  /*!< Touch_Weight[0], Touch_Weight[1] : weight property of touches */
00100   uint8_t  touchEventId[TS_MAX_NB_TOUCH]; /*!< Touch_EventId[0], Touch_EventId[1] : take value of type @ref TS_TouchEventTypeDef */
00101   uint8_t  touchArea[TS_MAX_NB_TOUCH];    /*!< Touch_Area[0], Touch_Area[1] : touch area of each touch */
00102   uint32_t gestureId;                     /*!< type of gesture detected : take value of type @ref TS_GestureIdTypeDef */
00103 } TS_StateTypeDef;
00104 
00105 /**
00106  *  @brief TS_StatusTypeDef
00107  *  Define BSP_TS_xxx() functions possible return value,
00108  *  when status is returned by those functions.
00109  */
00110 typedef enum
00111 {
00112   TS_OK                = 0x00, /*!< Touch Ok */
00113   TS_ERROR             = 0x01, /*!< Touch Error */
00114   TS_TIMEOUT           = 0x02, /*!< Touch Timeout */
00115   TS_DEVICE_NOT_FOUND  = 0x03  /*!< Touchscreen device not found */
00116 } TS_StatusTypeDef;
00117 
00118 /**
00119  *  @brief TS_GestureIdTypeDef
00120  *  Define Possible managed gesture identification values returned by touch screen
00121  *  driver.
00122  */
00123 typedef enum
00124 {
00125   GEST_ID_NO_GESTURE   = 0x00, /*!< Gesture not defined / recognized */
00126   GEST_ID_MOVE_UP      = 0x01, /*!< Gesture Move Up */
00127   GEST_ID_MOVE_RIGHT   = 0x02, /*!< Gesture Move Right */
00128   GEST_ID_MOVE_DOWN    = 0x03, /*!< Gesture Move Down */
00129   GEST_ID_MOVE_LEFT    = 0x04, /*!< Gesture Move Left */
00130   GEST_ID_ZOOM_IN      = 0x05, /*!< Gesture Zoom In */
00131   GEST_ID_ZOOM_OUT     = 0x06, /*!< Gesture Zoom Out */
00132   GEST_ID_SINGLE_CLICK = 0x07, /*!< Gesture Single Click */
00133   GEST_ID_DOUBLE_CLICK = 0x08, /*!< Gesture Double Click */
00134   GEST_ID_NB_MAX       = 0x09 /*!< max number of gesture id */
00135 } TS_GestureIdTypeDef;
00136 
00137 /**
00138  *  @brief TS_TouchEventTypeDef
00139  *  Define Possible touch events kind as returned values
00140  *  by touch screen IC Driver.
00141  */
00142 typedef enum
00143 {
00144   TOUCH_EVENT_NO_EVT        = 0x00, /*!< Touch Event : undetermined */
00145   TOUCH_EVENT_PRESS_DOWN    = 0x01, /*!< Touch Event Press Down */
00146   TOUCH_EVENT_LIFT_UP       = 0x02, /*!< Touch Event Lift Up */
00147   TOUCH_EVENT_CONTACT       = 0x03, /*!< Touch Event Contact */
00148   TOUCH_EVENT_NB_MAX        = 0x04  /*!< max number of touch events kind */
00149 } TS_TouchEventTypeDef;
00150 
00151 /**
00152   * @}
00153   */
00154 
00155 /** @defgroup STM32L4R9I_DISCOVERY_TS_Exported_Functions Exported Functions
00156   * @{
00157   */
00158 
00159 uint8_t BSP_TS_Init(uint16_t ts_SizeX, uint16_t ts_SizeY);
00160 uint8_t BSP_TS_DeInit(void);
00161 
00162 uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State);
00163 uint8_t BSP_TS_GestureConfig(FunctionalState State);
00164 uint8_t BSP_TS_Get_GestureId(TS_StateTypeDef *TS_State);
00165 uint8_t BSP_TS_ResetTouchData(TS_StateTypeDef *TS_State);
00166 
00167 uint8_t BSP_TS_ITConfig(void);
00168 uint8_t BSP_TS_ITDisable(void);
00169 uint8_t BSP_TS_ITGetStatus(void);
00170 void    BSP_TS_ITClear(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 /* __STM32L4R9I_DISCOVERY_TS_H */
00194 
00195 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Fri Oct 13 2017 02:37:42 for STM32L4R9I-Discovery BSP User Manual by   doxygen 1.7.6.1