STM32746G-Discovery board drivers V1.0.0

Dependents:   DISCO-F746NG_LCDTS_CC3000_NTP DISCO-F746NG_ROPE_WIFI F746_SpectralAnalysis_NoPhoto ecte433 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32746g_discovery_ts.h Source File

stm32746g_discovery_ts.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32746g_discovery_ts.h
00004   * @author  MCD Application Team
00005   * @brief   This file contains the common defines and functions prototypes for
00006   *          the stm32746g_discovery_ts.c driver.
00007   ******************************************************************************
00008   * @attention
00009   *
00010   * <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM32746G_DISCOVERY_TS_H
00039 #define __STM32746G_DISCOVERY_TS_H
00040 
00041 #ifdef __cplusplus
00042  extern "C" {
00043 #endif   
00044    
00045 /* Includes ------------------------------------------------------------------*/
00046 #include "stm32746g_discovery.h"
00047 /* Include touch screen FT5336 component Driver */
00048 #include "../Components/ft5336/ft5336.h"
00049    
00050 /** @addtogroup BSP
00051   * @{
00052   */ 
00053 
00054 /** @addtogroup STM32746G_DISCOVERY
00055   * @{
00056   */
00057     
00058 /** @addtogroup STM32746G_DISCOVERY_TS
00059   * @{
00060   */
00061 
00062  /** @defgroup STM32746G_DISCOVERY_TS_Exported_Constants STM32746G_DISCOVERY_TS Exported Constants
00063    * @{
00064    */
00065 
00066 /** @brief With FT5336 : maximum 5 touches detected simultaneously
00067   */
00068 #define TS_MAX_NB_TOUCH                 ((uint32_t) FT5336_MAX_DETECTABLE_TOUCH)
00069 
00070 #define TS_NO_IRQ_PENDING               ((uint8_t) 0)
00071 #define TS_IRQ_PENDING                  ((uint8_t) 1)
00072 
00073 #define TS_SWAP_NONE                    ((uint8_t) 0x01)
00074 #define TS_SWAP_X                       ((uint8_t) 0x02)
00075 #define TS_SWAP_Y                       ((uint8_t) 0x04)
00076 #define TS_SWAP_XY                      ((uint8_t) 0x08)
00077 
00078 /**
00079   * @}
00080   */
00081 
00082 /** @defgroup STM32746G_DISCOVERY_TS_Exported_Types  STM32746G_DISCOVERY_TS Exported Types
00083   * @{
00084   */
00085 /**
00086 *  @brief TS_StateTypeDef
00087 *  Define TS State structure
00088 */
00089 typedef struct
00090 {
00091   uint8_t  touchDetected;                /*!< Total number of active touches detected at last scan */
00092   uint16_t touchX[TS_MAX_NB_TOUCH];      /*!< Touch X[0], X[1] coordinates on 12 bits */
00093   uint16_t touchY[TS_MAX_NB_TOUCH];      /*!< Touch Y[0], Y[1] coordinates on 12 bits */
00094 
00095 #if (TS_MULTI_TOUCH_SUPPORTED == 1)
00096   uint8_t  touchWeight[TS_MAX_NB_TOUCH]; /*!< Touch_Weight[0], Touch_Weight[1] : weight property of touches */
00097   uint8_t  touchEventId[TS_MAX_NB_TOUCH];     /*!< Touch_EventId[0], Touch_EventId[1] : take value of type @ref TS_TouchEventTypeDef */
00098   uint8_t  touchArea[TS_MAX_NB_TOUCH];   /*!< Touch_Area[0], Touch_Area[1] : touch area of each touch */
00099   uint32_t gestureId; /*!< type of gesture detected : take value of type @ref TS_GestureIdTypeDef */
00100 #endif  /* TS_MULTI_TOUCH_SUPPORTED == 1 */
00101 
00102 } TS_StateTypeDef;
00103 
00104 /**
00105   * @}
00106   */ 
00107 
00108 /** @defgroup STM32746G_DISCOVERY_TS_Exported_Constants STM32746G_DISCOVERY_TS Exported Constants
00109   * @{
00110   */
00111 
00112 typedef enum 
00113 {
00114   TS_OK                = 0x00, /*!< Touch Ok */
00115   TS_ERROR             = 0x01, /*!< Touch Error */
00116   TS_TIMEOUT           = 0x02, /*!< Touch Timeout */
00117   TS_DEVICE_NOT_FOUND  = 0x03  /*!< Touchscreen device not found */
00118 }TS_StatusTypeDef;
00119 
00120 /**
00121  *  @brief TS_GestureIdTypeDef
00122  *  Define Possible managed gesture identification values returned by touch screen
00123  *  driver.
00124  */
00125 typedef enum
00126 {
00127   GEST_ID_NO_GESTURE = 0x00, /*!< Gesture not defined / recognized */
00128   GEST_ID_MOVE_UP    = 0x01, /*!< Gesture Move Up */
00129   GEST_ID_MOVE_RIGHT = 0x02, /*!< Gesture Move Right */
00130   GEST_ID_MOVE_DOWN  = 0x03, /*!< Gesture Move Down */
00131   GEST_ID_MOVE_LEFT  = 0x04, /*!< Gesture Move Left */
00132   GEST_ID_ZOOM_IN    = 0x05, /*!< Gesture Zoom In */
00133   GEST_ID_ZOOM_OUT   = 0x06, /*!< Gesture Zoom Out */
00134   GEST_ID_NB_MAX     = 0x07  /*!< max number of gesture id */
00135 
00136 } TS_GestureIdTypeDef;
00137 
00138 /**
00139  *  @brief TS_TouchEventTypeDef
00140  *  Define Possible touch events kind as returned values
00141  *  by touch screen IC Driver.
00142  */
00143 typedef enum
00144 {
00145   TOUCH_EVENT_NO_EVT        = 0x00, /*!< Touch Event : undetermined */
00146   TOUCH_EVENT_PRESS_DOWN    = 0x01, /*!< Touch Event Press Down */
00147   TOUCH_EVENT_LIFT_UP       = 0x02, /*!< Touch Event Lift Up */
00148   TOUCH_EVENT_CONTACT       = 0x03, /*!< Touch Event Contact */
00149   TOUCH_EVENT_NB_MAX        = 0x04  /*!< max number of touch events kind */
00150 
00151 } TS_TouchEventTypeDef;
00152 /**
00153   * @}
00154   */ 
00155 
00156 /** @defgroup STM32746G_DISCOVERY_TS_Imported_Variables STM32746G_DISCOVERY_TS Imported Variables
00157   * @{
00158   */ 
00159 /**
00160  *  @brief Table for touchscreen event information display on LCD :
00161  *  table indexed on enum @ref TS_TouchEventTypeDef information
00162  */
00163 extern char * ts_event_string_tab[TOUCH_EVENT_NB_MAX];
00164 
00165 /**
00166  *  @brief Table for touchscreen gesture Id information display on LCD : table indexed
00167  *  on enum @ref TS_GestureIdTypeDef information
00168  */
00169 extern char * ts_gesture_id_string_tab[GEST_ID_NB_MAX];
00170 /**
00171   * @}
00172   */ 
00173 
00174 /** @addtogroup STM32746G_DISCOVERY_TS_Exported_Functions
00175   * @{
00176   */
00177 uint8_t BSP_TS_Init(uint16_t ts_SizeX, uint16_t ts_SizeY);
00178 uint8_t BSP_TS_DeInit(void);
00179 uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State);
00180 
00181 #if (TS_MULTI_TOUCH_SUPPORTED == 1)
00182 uint8_t BSP_TS_Get_GestureId(TS_StateTypeDef *TS_State);
00183 #endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */
00184 
00185 uint8_t BSP_TS_ITConfig(void);
00186 uint8_t BSP_TS_ITGetStatus(void);
00187 void    BSP_TS_ITClear(void);
00188 uint8_t BSP_TS_ResetTouchData(TS_StateTypeDef *TS_State);
00189 /**
00190   * @}
00191   */ 
00192 
00193 /**
00194   * @}
00195   */
00196 
00197 /**
00198   * @}
00199   */ 
00200 
00201 /**
00202   * @}
00203   */
00204 
00205 
00206 #ifdef __cplusplus
00207 }
00208 #endif
00209 
00210 #endif /* __STM32746G_DISCOVERY_TS_H */
00211 
00212 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/