/* Read the ft5336 device ID, pre initialize I2C in case of need to be able to read the FT5336 device ID, and verify this is a FT5336.  */
uint16_t ft5336_ReadID(uint16_t DeviceAddr)
/* Read the ft5336 device ID, pre initialize I2C in case of need to be able to read the FT5336 device ID, and verify this is a FT5336.  */
uint16_t ft5336_ReadID(uint16_t DeviceAddr)
{
  volatile uint8_t ucReadId = 0;
  uint8_t nbReadAttempts = 0;
  uint8_t bFoundDevice = 0;
  ft5336_I2C_InitializeIfRequired();
  for(nbReadAttempts = 0; ((nbReadAttempts < 3) && !(bFoundDevice)); nbReadAttempts++)
  {
    ucReadId = TS_IO_Read(DeviceAddr, FT5336_CHIP_ID_REG);
    if(ucReadId == FT5336_ID_VALUE)
    {
      bFoundDevice = 1;
    }
  }
  return (ucReadId);
}