59 #define FT6x06_MAX_INSTANCE 2 101 static uint8_t ft6x06_GetInstance(uint16_t DeviceAddr);
103 #if (TS_AUTO_CALIBRATION_SUPPORTED == 1) 109 static uint32_t ft6x06_TS_Calibration(uint16_t DeviceAddr);
117 static uint32_t ft6x06_TS_Configure(uint16_t DeviceAddr);
139 instance = ft6x06_GetInstance(DeviceAddr);
145 empty = ft6x06_GetInstance(0);
150 ft6x06[empty] = DeviceAddr;
194 #if (TS_AUTO_CALIBRATION_SUPPORTED == 1) 197 ft6x06_TS_Calibration(DeviceAddr);
200 ft6x06_TS_Configure(DeviceAddr);
216 volatile uint8_t nbTouch = 0;
248 uint8_t regAddress = 0;
287 uint8_t regValue = 0;
302 uint8_t regValue = 0;
337 #if (TS_MULTI_TOUCH_SUPPORTED == 1) 345 void ft6x06_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId)
347 volatile uint8_t ucReadData = 0;
351 * pGestureId = ucReadData;
369 void ft6x06_TS_GetTouchInfo(uint16_t DeviceAddr,
375 uint8_t regAddress = 0;
410 #if (TS_AUTO_CALIBRATION_SUPPORTED == 1) 416 static uint32_t ft6x06_TS_Calibration(uint16_t DeviceAddr)
418 uint32_t nbAttempt = 0;
419 volatile uint8_t ucReadData;
420 volatile uint8_t regValue;
422 uint8_t bEndCalibration = 0;
445 for (nbAttempt=0; ((nbAttempt < 100) && (!bEndCalibration)) ; nbAttempt++)
448 ucReadData = (ucReadData & (FT6206_DEV_MODE_MASK << FT6206_DEV_MODE_SHIFT)) >>
FT6206_DEV_MODE_SHIFT;
469 static uint32_t ft6x06_TS_Configure(uint16_t DeviceAddr)
484 static uint8_t ft6x06_GetInstance(uint16_t DeviceAddr)
491 if(
ft6x06[idx] == DeviceAddr)
#define FT6206_DEV_MODE_WORKING
#define FT6206_TOUCH_EVT_FLAG_SHIFT
#define FT6206_TD_STAT_REG
void ft6x06_TS_ClearIT(uint16_t DeviceAddr)
Clear IT status in FT6206 interrupt status clear registers Should be called Following an EXTI coming ...
#define FT6206_P2_WEIGHT_REG
#define FT6206_TOUCH_AREA_SHIFT
#define FT6206_G_MODE_INTERRUPT_SHIFT
uint8_t ft6x06_TS_DetectTouch(uint16_t DeviceAddr)
Return if there is touches detected or not. Try to detect new touches and forget the old ones (reset ...
#define FT6206_TD_STAT_MASK
uint8_t ft6x06_TS_ITStatus(uint16_t DeviceAddr)
Get IT status from FT6206 interrupt status registers Should be called Following an EXTI coming to the...
#define FT6206_G_MODE_INTERRUPT_MASK
#define FT6206_DEV_MODE_FACTORY
#define FT6206_G_MODE_INTERRUPT_TRIGGER
void TS_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value)
Writes a single data.
uint8_t currActiveTouchIdx
#define FT6206_P1_WEIGHT_REG
#define FT6206_DEV_MODE_MASK
#define FT6206_GEST_ID_REG
uint8_t currActiveTouchNb
#define FT6206_STATUS_NOT_OK
This file contains all the functions prototypes for the ft6x06.c IO expander driver.
void ft6x06_TS_DisableIT(uint16_t DeviceAddr)
Configure the FT6206 device to stop generating IT on the given INT pin connected to MCU as EXTI...
#define FT6206_TOUCH_EVT_FLAG_MASK
#define FT6206_I2C_NOT_INITIALIZED
void ft6x06_TS_EnableIT(uint16_t DeviceAddr)
Configure the FT6206 device to generate IT on given INT pin connected to MCU as EXTI.
uint8_t ft6x06[FT6x06_MAX_INSTANCE]
void ft6x06_Init(uint16_t DeviceAddr)
Initialize the ft6x06 communication bus from MCU to FT6206 : ie I2C channel initialization (if requir...
#define FT6x06_MAX_INSTANCE
uint16_t ft6x06_ReadID(uint16_t DeviceAddr)
Read the ft6x06 device ID, pre initialize I2C in case of need to be able to read the FT6206 device ID...
uint8_t TS_IO_Read(uint8_t Addr, uint8_t Reg)
Reads a single data.
#define FT6206_G_MODE_INTERRUPT_POLLING
#define FT6206_CHIP_ID_REG
void ft6x06_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
Get the touch screen X and Y positions values Manage multi touch thanks to touch Index global variabl...
#define FT6206_TOUCH_WEIGHT_SHIFT
uint16_t TS_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length)
Reads multiple data with I2C communication channel from TouchScreen.
void TS_IO_Delay(uint32_t Delay)
Delay function used in TouchScreen low level driver.
#define FT6206_DEV_MODE_SHIFT
void ft6x06_TS_Start(uint16_t DeviceAddr)
Configures the touch Screen IC device to start detecting touches It goes through an internal calibrat...
#define FT6206_TOUCH_WEIGHT_MASK
TS_DrvTypeDef ft6x06_ts_drv
#define FT6206_TOUCH_AREA_MASK
void ft6x06_Reset(uint16_t DeviceAddr)
Software Reset the ft6x06.
#define FT6206_MAX_DETECTABLE_TOUCH
void TS_IO_Init(void)
Initializes Touchscreen low level.
#define FT6206_DEV_MODE_REG
: Definitions for FT6206 I2C register addresses on 8 bit