diff --git a/lvgl_helpers.c b/lvgl_helpers.c index b611e9f..237267d 100644 --- a/lvgl_helpers.c +++ b/lvgl_helpers.c @@ -147,9 +147,7 @@ void lvgl_driver_init(void) touch_driver_init(); #elif defined (CONFIG_LV_TOUCH_DRIVER_PROTOCOL_I2C) - // Why initializing this when I said is only CONFIG_LV_TOUCH_DRIVER_DISPLAY ESP_LOGI(TAG, "Initializing I2C master for touch"); - lvgl_i2c_driver_init(TOUCH_I2C_PORT, TOUCH_I2C_SDA, TOUCH_I2C_SCL, TOUCH_I2C_SPEED_HZ); diff --git a/lvgl_touch/l58.cpp b/lvgl_touch/l58.cpp index 875fe74..de4329d 100644 --- a/lvgl_touch/l58.cpp +++ b/lvgl_touch/l58.cpp @@ -25,21 +25,22 @@ #include #endif #include "l58.h" -#include "tp_i2c.h" #include "../lvgl_i2c_conf.h" - +// Cale touch implementation +#include "L58Touch.h" +L58Touch Touch(CONFIG_LV_TOUCH_INT); #define TAG "L58" - +TPoint point; /** * @brief Initialize for FT6x36 communication via I2C * @param dev_addr: Device address on communication Bus (I2C slave address of FT6X36). * @retval None */ -void l58_init(uint16_t dev_addr) { - ESP_LOGI(TAG, "l58_init()"); - +void l58_init() { + ESP_LOGI(TAG, "l58_init() Touch initialized"); + Touch.begin(960, 540); } /** @@ -49,7 +50,13 @@ void l58_init(uint16_t dev_addr) { * @retval Always false */ bool l58_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { - //printf("Touch event %d\n", gpio_get_level(CONFIG_LV_TOUCH_INT)); // Working - + point = Touch.loop(); + data->point.x = point.x; + data->point.y = point.y; + if (point.event == 3) { + data->state = LV_INDEV_STATE_PR; + } else { + data->state = LV_INDEV_STATE_REL; + } return false; } diff --git a/lvgl_touch/l58.h b/lvgl_touch/l58.h index 4d5897e..89725b8 100644 --- a/lvgl_touch/l58.h +++ b/lvgl_touch/l58.h @@ -39,10 +39,9 @@ extern "C" { /** * @brief Initialize for FT6x36 communication via I2C - * @param dev_addr: Device address on communication Bus (I2C slave address of FT6X36). * @retval None */ -void l58_init(uint16_t dev_addr); +void l58_init(); /** * @brief Get the touch screen X and Y positions values. Ignores multi touch diff --git a/lvgl_touch/touch_driver.c b/lvgl_touch/touch_driver.c index d22c1d6..4508810 100644 --- a/lvgl_touch/touch_driver.c +++ b/lvgl_touch/touch_driver.c @@ -6,7 +6,7 @@ #include "tp_spi.h" #include "tp_i2c.h" // Is not being included in CMakeLists.txt (Research why) -#include "l58.cpp" +#include "l58.h" void touch_driver_init(void) { @@ -15,7 +15,7 @@ void touch_driver_init(void) #elif defined (CONFIG_LV_TOUCH_CONTROLLER_FT6X06) ft6x06_init(FT6236_I2C_SLAVE_ADDR); #elif defined (CONFIG_LV_TOUCH_CONTROLLER_L58) - // Do nothing for now + l58_init(); #elif defined (CONFIG_LV_TOUCH_CONTROLLER_STMPE610) stmpe610_init(); #elif defined (CONFIG_LV_TOUCH_CONTROLLER_ADCRAW)