STM32746G-Discovery board drivers V1.0.0

Dependents:   F746_SD_GraphicEqualizer_ren0620

Fork of BSP_DISCO_F746NG by ST

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