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 ft5336.c Source File

ft5336.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    ft5336.c
00004   * @author  MCD Application Team
00005   * @brief   This file provides a set of functions needed to manage the FT5336
00006   *          touch screen devices.
00007   ******************************************************************************
00008   * @attention
00009   *
00010   * <h2><center>&copy; COPYRIGHT(c) 2015 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 /* Includes ------------------------------------------------------------------*/
00038 #include "ft5336.h"
00039 
00040 /** @addtogroup BSP
00041   * @{
00042   */
00043 
00044 /** @addtogroup Component
00045   * @{
00046   */
00047 
00048 /** @defgroup FT5336
00049   * @{
00050   */
00051 
00052 /* Private typedef -----------------------------------------------------------*/
00053 
00054 /** @defgroup FT5336_Private_Types_Definitions
00055   * @{
00056   */
00057 
00058 /* Private define ------------------------------------------------------------*/
00059 
00060 /** @defgroup FT5336_Private_Defines
00061   * @{
00062   */
00063 
00064 /* Private macro -------------------------------------------------------------*/
00065 
00066 /** @defgroup FT5336_Private_Macros
00067   * @{
00068   */
00069 
00070 /* Private variables ---------------------------------------------------------*/
00071 
00072 /** @defgroup FT5336_Private_Variables
00073   * @{
00074   */
00075 
00076 /* Touch screen driver structure initialization */
00077 TS_DrvTypeDef ft5336_ts_drv =
00078 {
00079   ft5336_Init,
00080   ft5336_ReadID,
00081   ft5336_Reset,
00082 
00083   ft5336_TS_Start,
00084   ft5336_TS_DetectTouch,
00085   ft5336_TS_GetXY,
00086 
00087   ft5336_TS_EnableIT,
00088   ft5336_TS_ClearIT,
00089   ft5336_TS_ITStatus,
00090   ft5336_TS_DisableIT
00091 
00092 };
00093 
00094 /* Global ft5336 handle */
00095 static ft5336_handle_TypeDef ft5336_handle = { FT5336_I2C_NOT_INITIALIZED, 0, 0};
00096 
00097 /**
00098   * @}
00099   */
00100 
00101 /** @defgroup ft5336_Private_Function_Prototypes
00102   * @{
00103   */
00104 
00105 /* Private functions prototypes-----------------------------------------------*/
00106 
00107 /**
00108   * @brief  Return the status of I2C was initialized or not.
00109   * @param  None.
00110   * @retval : I2C initialization status.
00111   */
00112 static uint8_t ft5336_Get_I2C_InitializedStatus(void);
00113 
00114 /**
00115   * @brief  I2C initialize if needed.
00116   * @param  None.
00117   * @retval : None.
00118   */
00119 static void ft5336_I2C_InitializeIfRequired(void);
00120 
00121 /**
00122   * @brief  Basic static configuration of TouchScreen
00123   * @param  DeviceAddr: FT5336 Device address for communication on I2C Bus.
00124   * @retval Status FT5336_STATUS_OK or FT5336_STATUS_NOT_OK.
00125   */
00126 static uint32_t ft5336_TS_Configure(uint16_t DeviceAddr);
00127 
00128 /** @defgroup ft5336_Private_Functions
00129   * @{
00130   */
00131 
00132 /** @defgroup ft5336_Public_Function_Body
00133   * @{
00134   */
00135 
00136 /* Public functions bodies-----------------------------------------------*/
00137 
00138 
00139 /**
00140   * @brief  Initialize the ft5336 communication bus
00141   *         from MCU to FT5336 : ie I2C channel initialization (if required).
00142   * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT5336).
00143   * @retval None
00144   */
00145 void ft5336_Init(uint16_t DeviceAddr)
00146 {
00147   /* Wait at least 200ms after power up before accessing registers
00148    * Trsi timing (Time of starting to report point after resetting) from FT5336GQQ datasheet */
00149   TS_IO_Delay(200);
00150 
00151   /* Initialize I2C link if needed */
00152   ft5336_I2C_InitializeIfRequired();
00153 }
00154 
00155 /**
00156   * @brief  Software Reset the ft5336.
00157   *         @note : Not applicable to FT5336.
00158   * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT5336).
00159   * @retval None
00160   */
00161 void ft5336_Reset(uint16_t DeviceAddr)
00162 {
00163   /* Do nothing */
00164   /* No software reset sequence available in FT5336 IC */
00165 }
00166 
00167 /**
00168   * @brief  Read the ft5336 device ID, pre initialize I2C in case of need to be
00169   *         able to read the FT5336 device ID, and verify this is a FT5336.
00170   * @param  DeviceAddr: I2C FT5336 Slave address.
00171   * @retval The Device ID (two bytes).
00172   */
00173 uint16_t ft5336_ReadID(uint16_t DeviceAddr)
00174 {
00175   volatile uint8_t ucReadId = 0;
00176   uint8_t nbReadAttempts = 0;
00177   uint8_t bFoundDevice = 0; /* Device not found by default */
00178 
00179   /* Initialize I2C link if needed */
00180   ft5336_I2C_InitializeIfRequired();
00181 
00182   /* At maximum 4 attempts to read ID : exit at first finding of the searched device ID */
00183   for(nbReadAttempts = 0; ((nbReadAttempts < 3) && !(bFoundDevice)); nbReadAttempts++)
00184   {
00185     /* Read register FT5336_CHIP_ID_REG as DeviceID detection */
00186     ucReadId = TS_IO_Read(DeviceAddr, FT5336_CHIP_ID_REG);
00187 
00188     /* Found the searched device ID ? */
00189     if(ucReadId == FT5336_ID_VALUE)
00190     {
00191       /* Set device as found */
00192       bFoundDevice = 1;
00193     }
00194   }
00195 
00196   /* Return the device ID value */
00197   return (ucReadId);
00198 }
00199 
00200 /**
00201   * @brief  Configures the touch Screen IC device to start detecting touches
00202   * @param  DeviceAddr: Device address on communication Bus (I2C slave address).
00203   * @retval None.
00204   */
00205 void ft5336_TS_Start(uint16_t DeviceAddr)
00206 {
00207   /* Minimum static configuration of FT5336 */
00208   FT5336_ASSERT(ft5336_TS_Configure(DeviceAddr));
00209 
00210   /* By default set FT5336 IC in Polling mode : no INT generation on FT5336 for new touch available */
00211   /* Note TS_INT is active low                                                                      */
00212   ft5336_TS_DisableIT(DeviceAddr);
00213 }
00214 
00215 /**
00216   * @brief  Return if there is touches detected or not.
00217   *         Try to detect new touches and forget the old ones (reset internal global
00218   *         variables).
00219   * @param  DeviceAddr: Device address on communication Bus.
00220   * @retval : Number of active touches detected (can be 0, 1 or 2).
00221   */
00222 uint8_t ft5336_TS_DetectTouch(uint16_t DeviceAddr)
00223 {
00224   volatile uint8_t nbTouch = 0;
00225 
00226   /* Read register FT5336_TD_STAT_REG to check number of touches detection */
00227   nbTouch = TS_IO_Read(DeviceAddr, FT5336_TD_STAT_REG);
00228   nbTouch &= FT5336_TD_STAT_MASK;
00229 
00230   if(nbTouch > FT5336_MAX_DETECTABLE_TOUCH)
00231   {
00232     /* If invalid number of touch detected, set it to zero */
00233     nbTouch = 0;
00234   }
00235 
00236   /* Update ft5336 driver internal global : current number of active touches */
00237   ft5336_handle.currActiveTouchNb = nbTouch;
00238 
00239   /* Reset current active touch index on which to work on */
00240   ft5336_handle.currActiveTouchIdx = 0;
00241 
00242   return(nbTouch);
00243 }
00244 
00245 /**
00246   * @brief  Get the touch screen X and Y positions values
00247   *         Manage multi touch thanks to touch Index global
00248   *         variable 'ft5336_handle.currActiveTouchIdx'.
00249   * @param  DeviceAddr: Device address on communication Bus.
00250   * @param  X: Pointer to X position value
00251   * @param  Y: Pointer to Y position value
00252   * @retval None.
00253   */
00254 void ft5336_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
00255 {
00256   volatile uint8_t ucReadData = 0;
00257   static uint16_t coord;
00258   uint8_t regAddressXLow = 0;
00259   uint8_t regAddressXHigh = 0;
00260   uint8_t regAddressYLow = 0;
00261   uint8_t regAddressYHigh = 0;
00262 
00263   if(ft5336_handle.currActiveTouchIdx < ft5336_handle.currActiveTouchNb)
00264   {
00265     switch(ft5336_handle.currActiveTouchIdx)
00266     {
00267     case 0 :
00268       regAddressXLow  = FT5336_P1_XL_REG;
00269       regAddressXHigh = FT5336_P1_XH_REG;
00270       regAddressYLow  = FT5336_P1_YL_REG;
00271       regAddressYHigh = FT5336_P1_YH_REG;
00272       break;
00273 
00274     case 1 :
00275       regAddressXLow  = FT5336_P2_XL_REG;
00276       regAddressXHigh = FT5336_P2_XH_REG;
00277       regAddressYLow  = FT5336_P2_YL_REG;
00278       regAddressYHigh = FT5336_P2_YH_REG;
00279       break;
00280 
00281     case 2 :
00282       regAddressXLow  = FT5336_P3_XL_REG;
00283       regAddressXHigh = FT5336_P3_XH_REG;
00284       regAddressYLow  = FT5336_P3_YL_REG;
00285       regAddressYHigh = FT5336_P3_YH_REG;
00286       break;
00287 
00288     case 3 :
00289       regAddressXLow  = FT5336_P4_XL_REG;
00290       regAddressXHigh = FT5336_P4_XH_REG;
00291       regAddressYLow  = FT5336_P4_YL_REG;
00292       regAddressYHigh = FT5336_P4_YH_REG;
00293       break;
00294 
00295     case 4 :
00296       regAddressXLow  = FT5336_P5_XL_REG;
00297       regAddressXHigh = FT5336_P5_XH_REG;
00298       regAddressYLow  = FT5336_P5_YL_REG;
00299       regAddressYHigh = FT5336_P5_YH_REG;
00300       break;
00301 
00302     case 5 :
00303       regAddressXLow  = FT5336_P6_XL_REG;
00304       regAddressXHigh = FT5336_P6_XH_REG;
00305       regAddressYLow  = FT5336_P6_YL_REG;
00306       regAddressYHigh = FT5336_P6_YH_REG;
00307       break;
00308 
00309     case 6 :
00310       regAddressXLow  = FT5336_P7_XL_REG;
00311       regAddressXHigh = FT5336_P7_XH_REG;
00312       regAddressYLow  = FT5336_P7_YL_REG;
00313       regAddressYHigh = FT5336_P7_YH_REG;
00314       break;
00315 
00316     case 7 :
00317       regAddressXLow  = FT5336_P8_XL_REG;
00318       regAddressXHigh = FT5336_P8_XH_REG;
00319       regAddressYLow  = FT5336_P8_YL_REG;
00320       regAddressYHigh = FT5336_P8_YH_REG;
00321       break;
00322 
00323     case 8 :
00324       regAddressXLow  = FT5336_P9_XL_REG;
00325       regAddressXHigh = FT5336_P9_XH_REG;
00326       regAddressYLow  = FT5336_P9_YL_REG;
00327       regAddressYHigh = FT5336_P9_YH_REG;
00328       break;
00329 
00330     case 9 :
00331       regAddressXLow  = FT5336_P10_XL_REG;
00332       regAddressXHigh = FT5336_P10_XH_REG;
00333       regAddressYLow  = FT5336_P10_YL_REG;
00334       regAddressYHigh = FT5336_P10_YH_REG;
00335       break;
00336 
00337     default :
00338       break;
00339 
00340     } /* end switch(ft5336_handle.currActiveTouchIdx) */
00341 
00342     /* Read low part of X position */
00343     ucReadData = TS_IO_Read(DeviceAddr, regAddressXLow);
00344     coord = (ucReadData & FT5336_TOUCH_POS_LSB_MASK) >> FT5336_TOUCH_POS_LSB_SHIFT;
00345 
00346     /* Read high part of X position */
00347     ucReadData = TS_IO_Read(DeviceAddr, regAddressXHigh);
00348     coord |= ((ucReadData & FT5336_TOUCH_POS_MSB_MASK) >> FT5336_TOUCH_POS_MSB_SHIFT) << 8;
00349 
00350     /* Send back ready X position to caller */
00351     *X = coord;
00352 
00353     /* Read low part of Y position */
00354     ucReadData = TS_IO_Read(DeviceAddr, regAddressYLow);
00355     coord = (ucReadData & FT5336_TOUCH_POS_LSB_MASK) >> FT5336_TOUCH_POS_LSB_SHIFT;
00356 
00357     /* Read high part of Y position */
00358     ucReadData = TS_IO_Read(DeviceAddr, regAddressYHigh);
00359     coord |= ((ucReadData & FT5336_TOUCH_POS_MSB_MASK) >> FT5336_TOUCH_POS_MSB_SHIFT) << 8;
00360 
00361     /* Send back ready Y position to caller */
00362     *Y = coord;
00363 
00364     ft5336_handle.currActiveTouchIdx++; /* next call will work on next touch */
00365 
00366   } /* of if(ft5336_handle.currActiveTouchIdx < ft5336_handle.currActiveTouchNb) */
00367 }
00368 
00369 /**
00370   * @brief  Configure the FT5336 device to generate IT on given INT pin
00371   *         connected to MCU as EXTI.
00372   * @param  DeviceAddr: Device address on communication Bus (Slave I2C address of FT5336).
00373   * @retval None
00374   */
00375 void ft5336_TS_EnableIT(uint16_t DeviceAddr)
00376 {
00377    uint8_t regValue = 0;
00378    regValue = (FT5336_G_MODE_INTERRUPT_TRIGGER & (FT5336_G_MODE_INTERRUPT_MASK >> FT5336_G_MODE_INTERRUPT_SHIFT)) << FT5336_G_MODE_INTERRUPT_SHIFT;
00379 
00380    /* Set interrupt trigger mode in FT5336_GMODE_REG */
00381    TS_IO_Write(DeviceAddr, FT5336_GMODE_REG, regValue);
00382 }
00383 
00384 /**
00385   * @brief  Configure the FT5336 device to stop generating IT on the given INT pin
00386   *         connected to MCU as EXTI.
00387   * @param  DeviceAddr: Device address on communication Bus (Slave I2C address of FT5336).
00388   * @retval None
00389   */
00390 void ft5336_TS_DisableIT(uint16_t DeviceAddr)
00391 {
00392   uint8_t regValue = 0;
00393   regValue = (FT5336_G_MODE_INTERRUPT_POLLING & (FT5336_G_MODE_INTERRUPT_MASK >> FT5336_G_MODE_INTERRUPT_SHIFT)) << FT5336_G_MODE_INTERRUPT_SHIFT;
00394 
00395   /* Set interrupt polling mode in FT5336_GMODE_REG */
00396   TS_IO_Write(DeviceAddr, FT5336_GMODE_REG, regValue);
00397 }
00398 
00399 /**
00400   * @brief  Get IT status from FT5336 interrupt status registers
00401   *         Should be called Following an EXTI coming to the MCU to know the detailed
00402   *         reason of the interrupt.
00403   *         @note : This feature is not applicable to FT5336.
00404   * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT5336).
00405   * @retval TS interrupts status : always return 0 here
00406   */
00407 uint8_t ft5336_TS_ITStatus(uint16_t DeviceAddr)
00408 {
00409   /* Always return 0 as feature not applicable to FT5336 */
00410   return 0;
00411 }
00412 
00413 /**
00414   * @brief  Clear IT status in FT5336 interrupt status clear registers
00415   *         Should be called Following an EXTI coming to the MCU.
00416   *         @note : This feature is not applicable to FT5336.
00417   * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT5336).
00418   * @retval None
00419   */
00420 void ft5336_TS_ClearIT(uint16_t DeviceAddr)
00421 {
00422   /* Nothing to be done here for FT5336 */
00423 }
00424 
00425 /**** NEW FEATURES enabled when Multi-touch support is enabled ****/
00426 
00427 #if (TS_MULTI_TOUCH_SUPPORTED == 1)
00428 
00429 /**
00430   * @brief  Get the last touch gesture identification (zoom, move up/down...).
00431   * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT5336).
00432   * @param  pGestureId : Pointer to get last touch gesture Identification.
00433   * @retval None.
00434   */
00435 void ft5336_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId)
00436 {
00437   volatile uint8_t ucReadData = 0;
00438 
00439   ucReadData = TS_IO_Read(DeviceAddr, FT5336_GEST_ID_REG);
00440 
00441   * pGestureId = ucReadData;
00442 }
00443 
00444 /**
00445   * @brief  Get the touch detailed informations on touch number 'touchIdx' (0..1)
00446   *         This touch detailed information contains :
00447   *         - weight that was applied to this touch
00448   *         - sub-area of the touch in the touch panel
00449   *         - event of linked to the touch (press down, lift up, ...)
00450   * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT5336).
00451   * @param  touchIdx : Passed index of the touch (0..1) on which we want to get the
00452   *                    detailed information.
00453   * @param  pWeight : Pointer to to get the weight information of 'touchIdx'.
00454   * @param  pArea   : Pointer to to get the sub-area information of 'touchIdx'.
00455   * @param  pEvent  : Pointer to to get the event information of 'touchIdx'.
00456 
00457   * @retval None.
00458   */
00459 void ft5336_TS_GetTouchInfo(uint16_t   DeviceAddr,
00460                             uint32_t   touchIdx,
00461                             uint32_t * pWeight,
00462                             uint32_t * pArea,
00463                             uint32_t * pEvent)
00464 {
00465   volatile uint8_t ucReadData = 0;
00466   uint8_t regAddressXHigh = 0;
00467   uint8_t regAddressPWeight = 0;
00468   uint8_t regAddressPMisc = 0;
00469 
00470   if(touchIdx < ft5336_handle.currActiveTouchNb)
00471   {
00472     switch(touchIdx)
00473     {
00474     case 0 :
00475       regAddressXHigh   = FT5336_P1_XH_REG;
00476       regAddressPWeight = FT5336_P1_WEIGHT_REG;
00477       regAddressPMisc   = FT5336_P1_MISC_REG;
00478       break;
00479 
00480     case 1 :
00481       regAddressXHigh   = FT5336_P2_XH_REG;
00482       regAddressPWeight = FT5336_P2_WEIGHT_REG;
00483       regAddressPMisc   = FT5336_P2_MISC_REG;
00484       break;
00485 
00486     case 2 :
00487       regAddressXHigh   = FT5336_P3_XH_REG;
00488       regAddressPWeight = FT5336_P3_WEIGHT_REG;
00489       regAddressPMisc   = FT5336_P3_MISC_REG;
00490       break;
00491 
00492     case 3 :
00493       regAddressXHigh   = FT5336_P4_XH_REG;
00494       regAddressPWeight = FT5336_P4_WEIGHT_REG;
00495       regAddressPMisc   = FT5336_P4_MISC_REG;
00496       break;
00497 
00498     case 4 :
00499       regAddressXHigh   = FT5336_P5_XH_REG;
00500       regAddressPWeight = FT5336_P5_WEIGHT_REG;
00501       regAddressPMisc   = FT5336_P5_MISC_REG;
00502       break;
00503 
00504     case 5 :
00505       regAddressXHigh   = FT5336_P6_XH_REG;
00506       regAddressPWeight = FT5336_P6_WEIGHT_REG;
00507       regAddressPMisc   = FT5336_P6_MISC_REG;
00508       break;
00509 
00510     case 6 :
00511       regAddressXHigh   = FT5336_P7_XH_REG;
00512       regAddressPWeight = FT5336_P7_WEIGHT_REG;
00513       regAddressPMisc   = FT5336_P7_MISC_REG;
00514       break;
00515 
00516     case 7 :
00517       regAddressXHigh   = FT5336_P8_XH_REG;
00518       regAddressPWeight = FT5336_P8_WEIGHT_REG;
00519       regAddressPMisc   = FT5336_P8_MISC_REG;
00520       break;
00521 
00522     case 8 :
00523       regAddressXHigh   = FT5336_P9_XH_REG;
00524       regAddressPWeight = FT5336_P9_WEIGHT_REG;
00525       regAddressPMisc   = FT5336_P9_MISC_REG;
00526       break;
00527 
00528     case 9 :
00529       regAddressXHigh   = FT5336_P10_XH_REG;
00530       regAddressPWeight = FT5336_P10_WEIGHT_REG;
00531       regAddressPMisc   = FT5336_P10_MISC_REG;
00532       break;
00533 
00534     default :
00535       break;
00536 
00537     } /* end switch(touchIdx) */
00538 
00539     /* Read Event Id of touch index */
00540     ucReadData = TS_IO_Read(DeviceAddr, regAddressXHigh);
00541     * pEvent = (ucReadData & FT5336_TOUCH_EVT_FLAG_MASK) >> FT5336_TOUCH_EVT_FLAG_SHIFT;
00542 
00543     /* Read weight of touch index */
00544     ucReadData = TS_IO_Read(DeviceAddr, regAddressPWeight);
00545     * pWeight = (ucReadData & FT5336_TOUCH_WEIGHT_MASK) >> FT5336_TOUCH_WEIGHT_SHIFT;
00546 
00547     /* Read area of touch index */
00548     ucReadData = TS_IO_Read(DeviceAddr, regAddressPMisc);
00549     * pArea = (ucReadData & FT5336_TOUCH_AREA_MASK) >> FT5336_TOUCH_AREA_SHIFT;
00550 
00551   } /* of if(touchIdx < ft5336_handle.currActiveTouchNb) */
00552 }
00553 
00554 #endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */
00555 
00556 /** @defgroup ft5336_Static_Function_Body
00557   * @{
00558   */
00559 
00560 /* Static functions bodies-----------------------------------------------*/
00561 
00562 
00563 /**
00564   * @brief  Return the status of I2C was initialized or not.
00565   * @param  None.
00566   * @retval : I2C initialization status.
00567   */
00568 static uint8_t ft5336_Get_I2C_InitializedStatus(void)
00569 {
00570   return(ft5336_handle.i2cInitialized);
00571 }
00572 
00573 /**
00574   * @brief  I2C initialize if needed.
00575   * @param  None.
00576   * @retval : None.
00577   */
00578 static void ft5336_I2C_InitializeIfRequired(void)
00579 {
00580   if(ft5336_Get_I2C_InitializedStatus() == FT5336_I2C_NOT_INITIALIZED)
00581   {
00582     /* Initialize TS IO BUS layer (I2C) */
00583     TS_IO_Init();
00584 
00585     /* Set state to initialized */
00586     ft5336_handle.i2cInitialized = FT5336_I2C_INITIALIZED;
00587   }
00588 }
00589 
00590 /**
00591   * @brief  Basic static configuration of TouchScreen
00592   * @param  DeviceAddr: FT5336 Device address for communication on I2C Bus.
00593   * @retval Status FT5336_STATUS_OK or FT5336_STATUS_NOT_OK.
00594   */
00595 static uint32_t ft5336_TS_Configure(uint16_t DeviceAddr)
00596 {
00597   uint32_t status = FT5336_STATUS_OK;
00598 
00599   /* Nothing special to be done for FT5336 */
00600 
00601   return(status);
00602 }
00603 
00604 /**
00605   * @}
00606   */
00607 
00608 /**
00609   * @}
00610   */
00611 
00612 /**
00613   * @}
00614   */
00615 
00616 /**
00617   * @}
00618   */
00619 
00620 /**
00621   * @}
00622   */
00623 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/