stm32f469_fw/src/hw/driver/ts.c
bool tsInit(uint16_t x_size, uint16_t y_size)
{
  bool ret = false;

  err_code_t ts_status = OK;
  uint8_t ts_id1, ts_id2 = 0;
  /* Note : i2c_addr is un-initialized here, but is not used at all in init function */
  /* but the prototype of Init() is like that in template and should be respected       */

  /* Initialize the communication channel to sensor (I2C) if necessary */
  /* that is initialization is done only once after a power up         */
  ft6x06_ts_drv.Init(i2c_addr);

  ts_id1 = ft6x06_ts_drv.ReadID(TS_I2C_ADDRESS);

  i2c_addr    = TS_I2C_ADDRESS;

  /* Scan FT6xx6 TouchScreen IC controller ID register by I2C Read       */
  /* Verify this is a FT6206 or FT6336G, otherwise this is an error case */
  if((ts_id1 == FT6206_ID_VALUE) || (ts_id2 == FT6206_ID_VALUE))
  {
    /* Found FT6206 : Initialize the TS driver structure */
    ts_driver = &ft6x06_ts_drv;

    /* Get LCD chosen orientation */
    if(x_size < y_size)
    {
      ts_orientation = TS_SWAP_NONE;
    }
    else
    {
      ts_orientation = TS_SWAP_XY | TS_SWAP_Y;
      //ts_orientation = TS_SWAP_XY | TS_SWAP_X;;
    }

    if(ts_status == OK)
    {
      /* Software reset the TouchScreen */
      ts_driver->Reset(i2c_addr);

      /* Calibrate, Configure and Start the TouchScreen driver */
      ts_driver->Start(i2c_addr);

    } /* of if(ts_status == OK) */
  }
  else
  {
    ts_status = ERR_TS_DEV_NOT_FOUND;
  }

  if (ts_status == OK)
  {
    ret = true;
  }
  return ret;
}
/**
  * @brief  Initializes and configures the touch screen functionalities and
  *         configures all necessary hardware resources (GPIOs, I2C, clocks..).
  * @param  x_size : Maximum X size of the TS area on LCD
  * @param  y_size : Maximum Y size of the TS area on LCD
  * @retval OK if all initializations are OK. Other value if error.
  */
@brief  Initializes and configures the touch screen functionalities and
configures all necessary hardware resources (GPIOs, I2C, clocks..).
@param  x_size : Maximum X size of the TS area on LCD
@param  y_size : Maximum Y size of the TS area on LCD
@retval OK if all initializations are OK. Other value if error.
@brief Initializes and configures the touch screen functionalities and configures all necessary hardware resources ( GPIOs I2C clocks .. ) . @param x_size : Maximum X size of the TS area on LCD @param y_size : Maximum Y size of the TS area on LCD @retval OK if all initializations are OK . Other value if error .
bool tsInit(uint16_t x_size, uint16_t y_size)
{
  bool ret = false;
  err_code_t ts_status = OK;
  uint8_t ts_id1, ts_id2 = 0;
  ft6x06_ts_drv.Init(i2c_addr);
  ts_id1 = ft6x06_ts_drv.ReadID(TS_I2C_ADDRESS);
  i2c_addr    = TS_I2C_ADDRESS;
  if((ts_id1 == FT6206_ID_VALUE) || (ts_id2 == FT6206_ID_VALUE))
  {
    ts_driver = &ft6x06_ts_drv;
    if(x_size < y_size)
    {
      ts_orientation = TS_SWAP_NONE;
    }
    else
    {
      ts_orientation = TS_SWAP_XY | TS_SWAP_Y;
    }
    if(ts_status == OK)
    {
      ts_driver->Reset(i2c_addr);
      ts_driver->Start(i2c_addr);
    } 
  }
  else
  {
    ts_status = ERR_TS_DEV_NOT_FOUND;
  }
  if (ts_status == OK)
  {
    ret = true;
  }
  return ret;
}
bool tsInit ( uint16_t x_size , uint16_t y_size ) { bool ret = false ; err_code_t ts_status = OK ; uint8_t ts_id1 , ts_id2 = 0 ; ft6x06_ts_drv . Init ( i2c_addr ) ; ts_id1 = ft6x06_ts_drv . ReadID ( TS_I2C_ADDRESS ) ; i2c_addr = TS_I2C_ADDRESS ; if ( ( ts_id1 == FT6206_ID_VALUE ) || ( ts_id2 == FT6206_ID_VALUE ) ) { ts_driver = & ft6x06_ts_drv ; if ( x_size < y_size ) { ts_orientation = TS_SWAP_NONE ; } else { ts_orientation = TS_SWAP_XY | TS_SWAP_Y ; } if ( ts_status == OK ) { ts_driver -> Reset ( i2c_addr ) ; ts_driver -> Start ( i2c_addr ) ; } } else { ts_status = ERR_TS_DEV_NOT_FOUND ; } if ( ts_status == OK ) { ret = true ; } return ret ; }
@brief  Initializes and configures the touch screen functionalities and
         configures all necessary hardware resources (GPIOs, I2C, clocks..).
@brief Initializes and configures the touch screen functionalities and configures all necessary hardware resources ( GPIOs I2C clocks .. ) .
/* Note : i2c_addr is un-initialized here, but is not used at all in init function */ /* but the prototype of Init() is like that in template and should be respected       */ /* Initialize the communication channel to sensor (I2C) if necessary */ /* that is initialization is done only once after a power up         */ /* Scan FT6xx6 TouchScreen IC controller ID register by I2C Read       */ /* Verify this is a FT6206 or FT6336G, otherwise this is an error case */ /* Found FT6206 : Initialize the TS driver structure */ /* Get LCD chosen orientation */ //ts_orientation = TS_SWAP_XY | TS_SWAP_X;; /* Software reset the TouchScreen */ /* Calibrate, Configure and Start the TouchScreen driver */ /* of if(ts_status == OK) */