2020-12-17 06:02:55 +00:00
|
|
|
/**
|
|
|
|
* @file touch_driver.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "touch_driver.h"
|
|
|
|
#include "tp_spi.h"
|
|
|
|
|
|
|
|
|
|
|
|
void touch_driver_init(void)
|
|
|
|
{
|
|
|
|
#if defined (CONFIG_LV_TOUCH_CONTROLLER_XPT2046)
|
|
|
|
xpt2046_init();
|
|
|
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_FT6X06)
|
|
|
|
ft6x06_init(FT6236_I2C_SLAVE_ADDR);
|
|
|
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_STMPE610)
|
|
|
|
stmpe610_init();
|
|
|
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_ADCRAW)
|
|
|
|
adcraw_init();
|
|
|
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_FT81X)
|
|
|
|
/* nothing to do */
|
|
|
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_RA8875)
|
|
|
|
ra8875_touch_init();
|
2021-06-11 03:49:56 +00:00
|
|
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_GT911)
|
|
|
|
gt911_init(GT911_I2C_SLAVE_ADDR);
|
2020-12-17 06:02:55 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-06-13 20:06:22 +00:00
|
|
|
#if LVGL_VERSION_MAJOR >= 8
|
|
|
|
void touch_driver_read(lv_indev_drv_t *drv, lv_indev_data_t *data)
|
|
|
|
#else
|
2020-12-17 06:02:55 +00:00
|
|
|
bool touch_driver_read(lv_indev_drv_t *drv, lv_indev_data_t *data)
|
2021-06-13 20:06:22 +00:00
|
|
|
#endif
|
2020-12-17 06:02:55 +00:00
|
|
|
{
|
|
|
|
bool res = false;
|
|
|
|
|
|
|
|
#if defined (CONFIG_LV_TOUCH_CONTROLLER_XPT2046)
|
|
|
|
res = xpt2046_read(drv, data);
|
|
|
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_FT6X06)
|
|
|
|
res = ft6x36_read(drv, data);
|
|
|
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_STMPE610)
|
|
|
|
res = stmpe610_read(drv, data);
|
|
|
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_ADCRAW)
|
|
|
|
res = adcraw_read(drv, data);
|
|
|
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_FT81X)
|
|
|
|
res = FT81x_read(drv, data);
|
|
|
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_RA8875)
|
|
|
|
res = ra8875_touch_read(drv, data);
|
2021-06-11 03:49:56 +00:00
|
|
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_GT911)
|
|
|
|
res = gt911_read(drv, data);
|
2020-12-17 06:02:55 +00:00
|
|
|
#endif
|
|
|
|
|
2021-06-13 20:06:22 +00:00
|
|
|
#if LVGL_VERSION_MAJOR >= 8
|
|
|
|
data->continue_reading = res;
|
|
|
|
#else
|
2020-12-17 06:02:55 +00:00
|
|
|
return res;
|
2021-06-13 20:06:22 +00:00
|
|
|
#endif
|
2020-12-17 06:02:55 +00:00
|
|
|
}
|
|
|
|
|