From a0e933c7e65b599c615edd9cfc53e952d9a27764 Mon Sep 17 00:00:00 2001 From: Kevin Sidwar Date: Fri, 30 Jul 2021 15:29:18 -0600 Subject: [PATCH 01/13] Fix orientation config define --- lvgl_tft/Kconfig | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig index 593b948..e45db6a 100644 --- a/lvgl_tft/Kconfig +++ b/lvgl_tft/Kconfig @@ -195,24 +195,24 @@ menu "LVGL TFT Display controller" # Used in display init function to send display orientation commands choice DISPLAY_ORIENTATION prompt "Display orientation" - default DISPLAY_ORIENTATION_PORTRAIT if !LV_TFT_DISPLAY_CONTROLLER_SSD1306 - default DISPLAY_ORIENTATION_LANDSCAPE if LV_TFT_DISPLAY_CONTROLLER_SSD1306 - config DISPLAY_ORIENTATION_PORTRAIT + default LV_DISPLAY_ORIENTATION_PORTRAIT if !LV_TFT_DISPLAY_CONTROLLER_SSD1306 + default LV_DISPLAY_ORIENTATION_LANDSCAPE if LV_TFT_DISPLAY_CONTROLLER_SSD1306 + config LV_DISPLAY_ORIENTATION_PORTRAIT bool "Portrait" if !LV_TFT_DISPLAY_CONTROLLER_SSD1306 - config DISPLAY_ORIENTATION_PORTRAIT_INVERTED + config LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED bool "Portrait inverted" if !LV_TFT_DISPLAY_CONTROLLER_SSD1306 - config DISPLAY_ORIENTATION_LANDSCAPE + config LV_DISPLAY_ORIENTATION_LANDSCAPE bool "Landscape" - config DISPLAY_ORIENTATION_LANDSCAPE_INVERTED + config LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED bool "Landscape inverted" endchoice config LV_DISPLAY_ORIENTATION int - default 0 if DISPLAY_ORIENTATION_PORTRAIT - default 1 if DISPLAY_ORIENTATION_PORTRAIT_INVERTED - default 2 if DISPLAY_ORIENTATION_LANDSCAPE - default 3 if DISPLAY_ORIENTATION_LANDSCAPE_INVERTED + default 0 if LV_DISPLAY_ORIENTATION_PORTRAIT + default 1 if LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED + default 2 if LV_DISPLAY_ORIENTATION_LANDSCAPE + default 3 if LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED config LV_TFT_DISPLAY_OFFSETS bool From ee36378f54a957fe025cfbfd7e67c2f8bbd01696 Mon Sep 17 00:00:00 2001 From: Kevin Sidwar Date: Thu, 12 Aug 2021 23:48:23 -0600 Subject: [PATCH 02/13] Change config naming for ssd1306 to use LV_ prefix --- lvgl_tft/Kconfig | 8 ++++---- lvgl_tft/ssd1306.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig index e45db6a..62b7f3a 100644 --- a/lvgl_tft/Kconfig +++ b/lvgl_tft/Kconfig @@ -222,15 +222,15 @@ menu "LVGL TFT Display controller" config LV_TFT_DISPLAY_X_OFFSET depends on LV_TFT_DISPLAY_OFFSETS int "X offset" - default 40 if LV_PREDEFINED_DISPLAY_TTGO && (DISPLAY_ORIENTATION_LANDSCAPE || DISPLAY_ORIENTATION_LANDSCAPE_INVERTED) - default 53 if LV_PREDEFINED_DISPLAY_TTGO && (DISPLAY_ORIENTATION_PORTRAIT || DISPLAY_ORIENTATION_PORTRAIT_INVERTED) + default 40 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_LANDSCAPE || LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED) + default 53 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_PORTRAIT || LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED) default 0 config LV_TFT_DISPLAY_Y_OFFSET depends on LV_TFT_DISPLAY_OFFSETS int "Y offset" - default 53 if LV_PREDEFINED_DISPLAY_TTGO && (DISPLAY_ORIENTATION_LANDSCAPE || DISPLAY_ORIENTATION_LANDSCAPE_INVERTED) - default 40 if LV_PREDEFINED_DISPLAY_TTGO && (DISPLAY_ORIENTATION_PORTRAIT || DISPLAY_ORIENTATION_PORTRAIT_INVERTED) + default 53 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_LANDSCAPE || LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED) + default 40 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_PORTRAIT || LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED) default 0 diff --git a/lvgl_tft/ssd1306.c b/lvgl_tft/ssd1306.c index 5953d44..c845eac 100644 --- a/lvgl_tft/ssd1306.c +++ b/lvgl_tft/ssd1306.c @@ -99,10 +99,10 @@ void ssd1306_init(void) uint8_t orientation_1 = 0; uint8_t orientation_2 = 0; -#if defined (CONFIG_DISPLAY_ORIENTATION_LANDSCAPE) +#if defined (CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE) orientation_1 = OLED_CMD_SET_SEGMENT_REMAP; orientation_2 = OLED_CMD_SET_COM_SCAN_MODE_REMAP; -#elif defined (CONFIG_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED) +#elif defined (CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED) orientation_1 = 0xA0; orientation_2 = OLED_CMD_SET_COM_SCAN_MODE_NORMAL; #else From 171cd5391533a34994efeae590f53183bb2cf510 Mon Sep 17 00:00:00 2001 From: chenghongyao <1253146300@qq.com> Date: Sun, 15 Aug 2021 12:52:34 +0800 Subject: [PATCH 03/13] fix data length overflow --- lvgl_tft/st7789.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lvgl_tft/st7789.c b/lvgl_tft/st7789.c index 962eb44..3e47a59 100644 --- a/lvgl_tft/st7789.c +++ b/lvgl_tft/st7789.c @@ -35,7 +35,7 @@ typedef struct { **********************/ static void st7789_set_orientation(uint8_t orientation); -static void st7789_send_color(void *data, uint16_t length); +static void st7789_send_color(void *data, size_t length); /********************** * STATIC VARIABLES @@ -167,7 +167,7 @@ void st7789_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo /*Memory write*/ st7789_send_cmd(ST7789_RAMWR); - uint32_t size = lv_area_get_width(area) * lv_area_get_height(area); + size_t size = (size_t)lv_area_get_width(area) * (size_t)lv_area_get_height(area); st7789_send_color((void*)color_map, size * 2); @@ -190,7 +190,7 @@ void st7789_send_data(void * data, uint16_t length) disp_spi_send_data(data, length); } -static void st7789_send_color(void * data, uint16_t length) +static void st7789_send_color(void * data, size_t length) { disp_wait_for_pending_transactions(); gpio_set_level(ST7789_DC, 1); From 88628042e6d09be9fb6fd323e765b4c4038968c2 Mon Sep 17 00:00:00 2001 From: C47D Date: Tue, 28 Sep 2021 20:51:36 -0500 Subject: [PATCH 04/13] FT6X36: Fix coordinates invesion The coordinates need to be swapped before inveting them when swapping is enabled. Suggested in #118 by @wreyford --- lvgl_touch/ft6x36.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lvgl_touch/ft6x36.c b/lvgl_touch/ft6x36.c index 9e34845..fcef596 100644 --- a/lvgl_touch/ft6x36.c +++ b/lvgl_touch/ft6x36.c @@ -118,16 +118,16 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { last_x = ((data_buf[1] & FT6X36_MSB_MASK) << 8) | (data_buf[2] & FT6X36_LSB_MASK); last_y = ((data_buf[3] & FT6X36_MSB_MASK) << 8) | (data_buf[4] & FT6X36_LSB_MASK); +#if CONFIG_LV_FT6X36_SWAPXY + int16_t swap_buf = last_x; + last_x = last_y; + last_y = swap_buf; +#endif #if CONFIG_LV_FT6X36_INVERT_X last_x = LV_HOR_RES - last_x; #endif #if CONFIG_LV_FT6X36_INVERT_Y last_y = LV_VER_RES - last_y; -#endif -#if CONFIG_LV_FT6X36_SWAPXY - int16_t swap_buf = last_x; - last_x = last_y; - last_y = swap_buf; #endif data->point.x = last_x; data->point.y = last_y; From 83eba9b04cc212a01051e6839fe31455ae58499b Mon Sep 17 00:00:00 2001 From: Rop Gonggrijp Date: Fri, 15 Oct 2021 15:37:36 +0200 Subject: [PATCH 05/13] Fixes potential ESP-IDF config editor crash (#115) --- lvgl_i2c/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lvgl_i2c/Kconfig b/lvgl_i2c/Kconfig index 4011bcf..48df924 100644 --- a/lvgl_i2c/Kconfig +++ b/lvgl_i2c/Kconfig @@ -6,8 +6,10 @@ menu "I2C Port 0" if I2C_MANAGER_0_ENABLED config I2C_MANAGER_0_SDA int "SDA (GPIO pin)" + default 0 config I2C_MANAGER_0_SCL int "SCL (GPIO pin)" + default 0 config I2C_MANAGER_0_FREQ_HZ int "Frequency (Hz)" default 400000 From db3d00e3744a5884c60ba8a8c13239bdd29194d2 Mon Sep 17 00:00:00 2001 From: Rop Gonggrijp Date: Fri, 15 Oct 2021 15:38:16 +0200 Subject: [PATCH 06/13] Addresses confusion: I2C manager component install only when others need I2C too. See #115 --- lvgl_i2c/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lvgl_i2c/README.md b/lvgl_i2c/README.md index fb74e27..90f3728 100644 --- a/lvgl_i2c/README.md +++ b/lvgl_i2c/README.md @@ -8,9 +8,11 @@ ### I2C Manager support -`lvgl_esp32_drivers` integrates [I2C Manager](https://github.com/ropg/i2c_manager), which is used in case you select a touch sensor or screen that uses the I2C bus. If you're just using LVGL you don't need to do anything special. +`lvgl_esp32_drivers` integrates [I2C Manager](https://github.com/ropg/i2c_manager), which is used in case you select a touch sensor or screen that uses the I2C bus. -I2C Manager can help if you are in a situation where you want to avoid "bus conflicts" on the I2C bus. Suppose you use LVGL with a touch sensor that uses I2C, and your device also has another I2C device that needs to be read frequently, such as a 3D-accelerometer. ESP-IDF is not inherently "thread-safe". So if you read that from another task than the one LVGL uses to read the touch data, you need some kind of mechanism to keep these communications from interfering. +I2C Manager is also available as a separate ESP-IDF component and can help if you are in a situation where you want to avoid "bus conflicts" on the I2C bus. **If in your application nothing outside of LVGL needs to talk to the I2C bus, you can stop reading here.** + +Suppose you use LVGL with a touch sensor that uses I2C, and your device also has another I2C device that needs to be read frequently, such as a 3D-accelerometer. ESP-IDF is not inherently "thread-safe". So if you read that from another task than the one LVGL uses to read the touch data, you need some kind of mechanism to keep these communications from interfering. If you have (or write) a driver for that 3D-accelerometer that can use I2C Manager (or the I2C HAL and i2cdev abstraction layers that I2C Manager is compatible with) then put I2C Manager in your components directory by cloning the repository from below and in your main program do: From bd445ea30ad78b4311f7b5138fd12fad4e2e5c24 Mon Sep 17 00:00:00 2001 From: Rashed Talukder <> Date: Tue, 19 Oct 2021 17:27:27 -0700 Subject: [PATCH 07/13] Add touch input values to a FreeRTOS queue --- lvgl_touch/ft6x36.c | 55 ++++++++++++++++++++++++++++----------------- lvgl_touch/ft6x36.h | 11 +++++++++ 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/lvgl_touch/ft6x36.c b/lvgl_touch/ft6x36.c index fcef596..a12752a 100644 --- a/lvgl_touch/ft6x36.c +++ b/lvgl_touch/ft6x36.c @@ -29,16 +29,17 @@ #include "lvgl_i2c/i2c_manager.h" #define TAG "FT6X36" +#define FT6X36_TOUCH_QUEUE_ELEMENTS 1 -ft6x36_status_t ft6x36_status; -uint8_t current_dev_addr; // set during init +static ft6x36_status_t ft6x36_status; +static uint8_t current_dev_addr; // set during init +static ft6x36_touch_t touch_inputs = { -1, -1, LV_INDEV_STATE_REL }; // -1 coordinates to designate it was never touched -esp_err_t ft6x06_i2c_read8(uint8_t slave_addr, uint8_t register_addr, uint8_t *data_buf) { +static esp_err_t ft6x06_i2c_read8(uint8_t slave_addr, uint8_t register_addr, uint8_t *data_buf) { return lvgl_i2c_read(CONFIG_LV_I2C_TOUCH_PORT, slave_addr, register_addr, data_buf, 1); } - /** * @brief Read the FT6x36 gesture ID. Initialize first! * @param dev_addr: I2C FT6x36 Slave address. @@ -84,7 +85,14 @@ void ft6x06_init(uint16_t dev_addr) { ft6x06_i2c_read8(dev_addr, FT6X36_RELEASECODE_REG, &data_buf); ESP_LOGI(TAG, "\tRelease code: 0x%02x", data_buf); - + + ft6x36_touch_queue_handle = xQueueCreate( FT6X36_TOUCH_QUEUE_ELEMENTS, sizeof( ft6x36_touch_t )); + if( ft6x36_touch_queue_handle == NULL ) + { + ESP_LOGE( TAG, "\tError creating touch input FreeRTOS queue" ); + return; + } + xQueueSend( ft6x36_touch_queue_handle, &touch_inputs, 0 ); } /** @@ -99,8 +107,6 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { return 0x00; } uint8_t data_buf[5]; // 1 byte status, 2 bytes X, 2 bytes Y - static int16_t last_x = 0; // 12bit pixel value - static int16_t last_y = 0; // 12bit pixel value esp_err_t ret = lvgl_i2c_read(CONFIG_LV_I2C_TOUCH_PORT, current_dev_addr, FT6X36_TD_STAT_REG, &data_buf[0], 5); if (ret != ESP_OK) { @@ -109,29 +115,38 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { uint8_t touch_pnt_cnt = data_buf[0]; // Number of detected touch points if (ret != ESP_OK || touch_pnt_cnt != 1) { // ignore no touch & multi touch - data->point.x = last_x; - data->point.y = last_y; - data->state = LV_INDEV_STATE_REL; + if ( touch_inputs.current_state != LV_INDEV_STATE_REL) + { + touch_inputs.current_state = LV_INDEV_STATE_REL; + xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs ); + } + data->point.x = touch_inputs.last_x; + data->point.y = touch_inputs.last_y; + data->state = touch_inputs.current_state; return false; } - last_x = ((data_buf[1] & FT6X36_MSB_MASK) << 8) | (data_buf[2] & FT6X36_LSB_MASK); - last_y = ((data_buf[3] & FT6X36_MSB_MASK) << 8) | (data_buf[4] & FT6X36_LSB_MASK); + touch_inputs.current_state = LV_INDEV_STATE_PR; + touch_inputs.last_x = ((data_buf[1] & FT6X36_MSB_MASK) << 8) | (data_buf[2] & FT6X36_LSB_MASK); + touch_inputs.last_y = ((data_buf[3] & FT6X36_MSB_MASK) << 8) | (data_buf[4] & FT6X36_LSB_MASK); #if CONFIG_LV_FT6X36_SWAPXY - int16_t swap_buf = last_x; - last_x = last_y; - last_y = swap_buf; + int16_t swap_buf = touch_inputs.last_x; + touch_inputs.last_x = touch_inputs.last_y; + touch_inputs.last_y = swap_buf; #endif #if CONFIG_LV_FT6X36_INVERT_X - last_x = LV_HOR_RES - last_x; + touch_inputs.last_x = LV_HOR_RES - touch_inputs.last_x; #endif #if CONFIG_LV_FT6X36_INVERT_Y - last_y = LV_VER_RES - last_y; + touch_inputs.last_y = LV_VER_RES - touch_inputs.last_y; #endif - data->point.x = last_x; - data->point.y = last_y; - data->state = LV_INDEV_STATE_PR; + data->point.x = touch_inputs.last_x; + data->point.y = touch_inputs.last_y; + data->state = touch_inputs.current_state; ESP_LOGD(TAG, "X=%u Y=%u", data->point.x, data->point.y); + + xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs ); + return false; } diff --git a/lvgl_touch/ft6x36.h b/lvgl_touch/ft6x36.h index ace2997..90f1507 100644 --- a/lvgl_touch/ft6x36.h +++ b/lvgl_touch/ft6x36.h @@ -23,6 +23,8 @@ #include #include +#include "freertos/FreeRTOS.h" +#include "freertos/queue.h" #ifdef LV_LVGL_H_INCLUDE_SIMPLE #include "lvgl.h" #else @@ -145,6 +147,15 @@ typedef struct { bool inited; } ft6x36_status_t; +typedef struct +{ + int16_t last_x; + int16_t last_y; + lv_indev_state_t current_state; +} ft6x36_touch_t; + +QueueHandle_t ft6x36_touch_queue_handle; + /** * @brief Initialize for FT6x36 communication via I2C * @param dev_addr: Device address on communication Bus (I2C slave address of FT6X36). From a56b80b362dbee31c40b98a475e8664f3d5da449 Mon Sep 17 00:00:00 2001 From: Rashed Talukder <> Date: Mon, 25 Oct 2021 11:53:26 -0700 Subject: [PATCH 08/13] Add kconfig symbol for optional coordinates queue --- lvgl_touch/Kconfig | 7 +++++++ lvgl_touch/ft6x36.c | 6 ++++++ lvgl_touch/ft6x36.h | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lvgl_touch/Kconfig b/lvgl_touch/Kconfig index de4d17b..b9908aa 100644 --- a/lvgl_touch/Kconfig +++ b/lvgl_touch/Kconfig @@ -201,6 +201,13 @@ menu "LVGL Touch controller" prompt "Invert Y coordinate value." default n + config LV_FT6X36_COORDINATES_QUEUE + bool + prompt "Send coordinates to FreeRTOS queue." + default n + help + Receive from the FreeRTOS queue using the handle 'ft6x36_touch_queue_handle'. + endmenu menu "Touchpanel (STMPE610) Pin Assignments" diff --git a/lvgl_touch/ft6x36.c b/lvgl_touch/ft6x36.c index a12752a..b0466e0 100644 --- a/lvgl_touch/ft6x36.c +++ b/lvgl_touch/ft6x36.c @@ -86,6 +86,7 @@ void ft6x06_init(uint16_t dev_addr) { ft6x06_i2c_read8(dev_addr, FT6X36_RELEASECODE_REG, &data_buf); ESP_LOGI(TAG, "\tRelease code: 0x%02x", data_buf); +#if CONFIG_LV_FT6X36_COORDINATES_QUEUE ft6x36_touch_queue_handle = xQueueCreate( FT6X36_TOUCH_QUEUE_ELEMENTS, sizeof( ft6x36_touch_t )); if( ft6x36_touch_queue_handle == NULL ) { @@ -93,6 +94,7 @@ void ft6x06_init(uint16_t dev_addr) { return; } xQueueSend( ft6x36_touch_queue_handle, &touch_inputs, 0 ); +#endif } /** @@ -118,7 +120,9 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { if ( touch_inputs.current_state != LV_INDEV_STATE_REL) { touch_inputs.current_state = LV_INDEV_STATE_REL; +#if CONFIG_LV_FT6X36_COORDINATES_QUEUE xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs ); +#endif } data->point.x = touch_inputs.last_x; data->point.y = touch_inputs.last_y; @@ -146,7 +150,9 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { data->state = touch_inputs.current_state; ESP_LOGD(TAG, "X=%u Y=%u", data->point.x, data->point.y); +#if CONFIG_LV_FT6X36_COORDINATES_QUEUE xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs ); +#endif return false; } diff --git a/lvgl_touch/ft6x36.h b/lvgl_touch/ft6x36.h index 90f1507..5152da5 100644 --- a/lvgl_touch/ft6x36.h +++ b/lvgl_touch/ft6x36.h @@ -154,8 +154,9 @@ typedef struct lv_indev_state_t current_state; } ft6x36_touch_t; +#if CONFIG_LV_FT6X36_COORDINATES_QUEUE QueueHandle_t ft6x36_touch_queue_handle; - +#endif /** * @brief Initialize for FT6x36 communication via I2C * @param dev_addr: Device address on communication Bus (I2C slave address of FT6X36). From 37548ad50fd95f742f1b1e8fa291d001a5f54252 Mon Sep 17 00:00:00 2001 From: Rashed Talukder <> Date: Wed, 27 Oct 2021 09:20:57 -0700 Subject: [PATCH 09/13] Extern the queue handle and add definition in source file. Add macro condition for dependencies. --- lvgl_touch/ft6x36.c | 6 ++++-- lvgl_touch/ft6x36.h | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lvgl_touch/ft6x36.c b/lvgl_touch/ft6x36.c index b0466e0..dae736c 100644 --- a/lvgl_touch/ft6x36.c +++ b/lvgl_touch/ft6x36.c @@ -25,7 +25,6 @@ #include #endif #include "ft6x36.h" - #include "lvgl_i2c/i2c_manager.h" #define TAG "FT6X36" @@ -35,6 +34,9 @@ static ft6x36_status_t ft6x36_status; static uint8_t current_dev_addr; // set during init static ft6x36_touch_t touch_inputs = { -1, -1, LV_INDEV_STATE_REL }; // -1 coordinates to designate it was never touched +#if CONFIG_LV_FT6X36_COORDINATES_QUEUE +QueueHandle_t ft6x36_touch_queue_handle; +#endif static esp_err_t ft6x06_i2c_read8(uint8_t slave_addr, uint8_t register_addr, uint8_t *data_buf) { return lvgl_i2c_read(CONFIG_LV_I2C_TOUCH_PORT, slave_addr, register_addr, data_buf, 1); @@ -87,7 +89,7 @@ void ft6x06_init(uint16_t dev_addr) { ESP_LOGI(TAG, "\tRelease code: 0x%02x", data_buf); #if CONFIG_LV_FT6X36_COORDINATES_QUEUE - ft6x36_touch_queue_handle = xQueueCreate( FT6X36_TOUCH_QUEUE_ELEMENTS, sizeof( ft6x36_touch_t )); + ft6x36_touch_queue_handle = xQueueCreate( FT6X36_TOUCH_QUEUE_ELEMENTS, sizeof( ft6x36_touch_t ) ); if( ft6x36_touch_queue_handle == NULL ) { ESP_LOGE( TAG, "\tError creating touch input FreeRTOS queue" ); diff --git a/lvgl_touch/ft6x36.h b/lvgl_touch/ft6x36.h index 5152da5..c4074dc 100644 --- a/lvgl_touch/ft6x36.h +++ b/lvgl_touch/ft6x36.h @@ -23,8 +23,10 @@ #include #include +#if CONFIG_LV_FT6X36_COORDINATES_QUEUE #include "freertos/FreeRTOS.h" #include "freertos/queue.h" +#endif #ifdef LV_LVGL_H_INCLUDE_SIMPLE #include "lvgl.h" #else @@ -155,7 +157,7 @@ typedef struct } ft6x36_touch_t; #if CONFIG_LV_FT6X36_COORDINATES_QUEUE -QueueHandle_t ft6x36_touch_queue_handle; +extern QueueHandle_t ft6x36_touch_queue_handle; #endif /** * @brief Initialize for FT6x36 communication via I2C From 37a4d3a4e6c7b3313c14c4adb7532f3da06fefff Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Sun, 14 Nov 2021 19:15:09 +0100 Subject: [PATCH 10/13] Add PCD8544 driver --- CMakeLists.txt | 2 + lvgl_helpers.h | 2 + lvgl_spi_conf.h | 2 + lvgl_tft/Kconfig | 9 +++ lvgl_tft/disp_driver.c | 8 +++ lvgl_tft/disp_driver.h | 2 + lvgl_tft/pcd8544.c | 146 +++++++++++++++++++++++++++++++++++++++++ lvgl_tft/pcd8544.h | 57 ++++++++++++++++ 8 files changed, 228 insertions(+) create mode 100644 lvgl_tft/pcd8544.c create mode 100644 lvgl_tft/pcd8544.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 78870dd..407802a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,8 @@ elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01) list(APPEND SOURCES "lvgl_tft/GC9A01.c") elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C) list(APPEND SOURCES "lvgl_tft/ili9163c.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544) + list(APPEND SOURCES "lvgl_tft/pcd8544.c") else() message(WARNING "LVGL ESP32 drivers: Display controller not defined.") endif() diff --git a/lvgl_helpers.h b/lvgl_helpers.h index 5fd6f09..c010174 100644 --- a/lvgl_helpers.h +++ b/lvgl_helpers.h @@ -76,6 +76,8 @@ extern "C" { #define DISP_BUF_SIZE ((LV_VER_RES_MAX * LV_VER_RES_MAX) / 8) // 2888 bytes #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) +#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544) +#define DISP_BUF_SIZE (LV_HOR_RES_MAX * (LV_VER_RES_MAX / 8)) #else #error "No display controller selected" #endif diff --git a/lvgl_spi_conf.h b/lvgl_spi_conf.h index 240090d..2c62c94 100644 --- a/lvgl_spi_conf.h +++ b/lvgl_spi_conf.h @@ -166,6 +166,8 @@ extern "C" { #define SPI_TFT_CLOCK_SPEED_HZ (40 * 1000 * 1000) #elif defined(CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X) #define SPI_TFT_CLOCK_SPEED_HZ (32*1000*1000) +#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544) +#define SPI_TFT_CLOCK_SPEED_HZ (4*1000*1000) #else #define SPI_TFT_CLOCK_SPEED_HZ (40*1000*1000) #endif diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig index 140c173..b700894 100644 --- a/lvgl_tft/Kconfig +++ b/lvgl_tft/Kconfig @@ -174,6 +174,10 @@ menu "LVGL TFT Display controller" help ILI9163C display controller. + config LV_TFT_DISPLAY_CONTROLLER_PCD8544 + bool + help + PCD8544 display controller (Nokia 3110/5110) # Display controller communication protocol # # This symbols define the communication protocol used by the @@ -340,6 +344,11 @@ menu "LVGL TFT Display controller" bool "ILI9163C" select LV_TFT_DISPLAY_CONTROLLER_ILI9163C select LV_TFT_DISPLAY_PROTOCOL_SPI + config LV_TFT_DISPLAY_USER_CONTROLLER_PCD8544 + bool "PCD8544" + select LV_TFT_DISPLAY_CONTROLLER_PCD8544 + select LV_TFT_DISPLAY_PROTOCOL_SPI + select LV_TFT_DISPLAY_MONOCHROME endchoice config CUSTOM_DISPLAY_BUFFER_SIZE diff --git a/lvgl_tft/disp_driver.c b/lvgl_tft/disp_driver.c index f62a947..153ca31 100644 --- a/lvgl_tft/disp_driver.c +++ b/lvgl_tft/disp_driver.c @@ -43,6 +43,8 @@ void *disp_driver_init(void) uc8151d_init(); #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C ili9163c_init(); +#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544 + pcd8544_init(); #endif // We still use menuconfig for these settings @@ -107,6 +109,8 @@ void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * uc8151d_lv_fb_flush(drv, area, color_map); #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C ili9163c_flush(drv, area, color_map); +#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544 + pcd8544_flush(drv, area, color_map); #endif } @@ -122,6 +126,8 @@ void disp_driver_rounder(lv_disp_drv_t * disp_drv, lv_area_t * area) jd79653a_lv_rounder_cb(disp_drv, area); #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D uc8151d_lv_rounder_cb(disp_drv, area); +#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544 + pcd8544_rounder(disp_drv, area); #endif } @@ -138,5 +144,7 @@ void disp_driver_set_px(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_ jd79653a_lv_set_fb_cb(disp_drv, buf, buf_w, x, y, color, opa); #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D uc8151d_lv_set_fb_cb(disp_drv, buf, buf_w, x, y, color, opa); +#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544 + pcd8544_set_px_cb(disp_drv, buf, buf_w, x, y, color, opa); #endif } diff --git a/lvgl_tft/disp_driver.h b/lvgl_tft/disp_driver.h index 8c70fda..2f5bcdf 100644 --- a/lvgl_tft/disp_driver.h +++ b/lvgl_tft/disp_driver.h @@ -52,6 +52,8 @@ extern "C" { #include "uc8151d.h" #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C #include "ili9163c.h" +#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544 +#include "pcd8544.h" #endif /********************* diff --git a/lvgl_tft/pcd8544.c b/lvgl_tft/pcd8544.c new file mode 100644 index 0000000..b2a7bed --- /dev/null +++ b/lvgl_tft/pcd8544.c @@ -0,0 +1,146 @@ +/** + * @file pcd8544.c + * + * Roughly based on: + * https://github.com/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library + * https://github.com/olikraus/u8g2 + */ + +#include "disp_spi.h" +#include "driver/gpio.h" + +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "pcd8544.h" + +#define TAG "lv_pcd8544" + +/********************** + * MACROS + **********************/ + +#define BIT_SET(a,b) ((a) |= (1U<<(b))) +#define BIT_CLEAR(a,b) ((a) &= ~(1U<<(b))) + +/********************** + * STATIC FUNCTIONS + **********************/ + +static void pcd8544_send_cmd(uint8_t cmd) +{ + disp_wait_for_pending_transactions(); + gpio_set_level(PCD8544_DC, 0); /*Command mode*/ + disp_spi_send_data(&cmd, 1); +} + +static void pcd8544_send_data(void * data, uint16_t length) +{ + disp_wait_for_pending_transactions(); + gpio_set_level(PCD8544_DC, 1); /*Data mode*/ + disp_spi_send_data(data, length); +} + +static void pcd8544_send_colors(void * data, uint16_t length) +{ + gpio_set_level(PCD8544_DC, 1); /*Data mode*/ + disp_spi_send_colors(data, length); +} + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +void pcd8544_init(void){ + + // TODO: orientation + + // Initialize non-SPI GPIOs + gpio_pad_select_gpio(PCD8544_DC); + gpio_set_direction(PCD8544_DC, GPIO_MODE_OUTPUT); + gpio_pad_select_gpio(PCD8544_RST); + gpio_set_direction(PCD8544_RST, GPIO_MODE_OUTPUT); + + // Reset the display + gpio_set_level(PCD8544_RST, 0); + vTaskDelay(100 / portTICK_RATE_MS); + gpio_set_level(PCD8544_RST, 1); + vTaskDelay(100 / portTICK_RATE_MS); + + pcd8544_send_cmd(0x21); /* activate chip (PD=0), horizontal increment (V=0), enter extended command set (H=1) */ + pcd8544_send_cmd(0x06); /* temp. control: b10 = 2 */ + pcd8544_send_cmd(0x13); /* bias system 1:48 */ + pcd8544_send_cmd(0xc0); /* medium Vop = Contrast 0x40 = 64 */ + + pcd8544_send_cmd(0x20); /* activate chip (PD=0), horizontal increment (V=0), enter extended command set (H=0) */ + pcd8544_send_cmd(0x0c); /* display mode normal */ +} + +void pcd8544_set_contrast (uint8_t contrast){ + if (contrast > 0x7f){ + contrast = 0x7f; + } + pcd8544_send_cmd(0x21); /* activate chip (PD=0), horizontal increment (V=0), enter extended command set (H=1) */ + pcd8544_send_cmd(0x80 | contrast); /* medium Vop = Contrast */ +} + +void pcd8544_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area){ + uint8_t hor_max = disp_drv->hor_res; + uint8_t ver_max = disp_drv->ver_res; + + area->x1 = 0; + area->y1 = 0; + area->x2 = hor_max - 1; + area->y2 = ver_max - 1; +} + +void pcd8544_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, + lv_color_t color, lv_opa_t opa){ + + uint8_t set = (color.full == 0) && (LV_OPA_TRANSP != opa); + + uint16_t byte_index = x + (( y>>3 ) * buf_w); + uint8_t bit_index = y & 0x7; + + if (set) { + BIT_SET(buf[byte_index], bit_index); + } else { + BIT_CLEAR(buf[byte_index], bit_index); + } +} + +void pcd8544_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_map){ + + pcd8544_send_cmd(0x20); /* activate chip (PD=0), horizontal increment (V=0), enter extended command set (H=0) */ + + uint8_t * buf = (uint8_t *) color_map; + + if ((area->x1 == 0) && (area->y1 == 0) && (area->x2 == (disp_drv->hor_res - 1)) && (area->y2 == (disp_drv->ver_res - 1))){ + + // optimize flush of complete frame buffer in a single SPI transaction + + pcd8544_send_cmd(0x40); /* set Y address */ + pcd8544_send_cmd(0x80); /* set X address */ + pcd8544_send_colors(buf, disp_drv->hor_res * disp_drv->ver_res / 8); + + } else { + + // send horizontal tiles + + uint16_t bank_start = area->y1 / 8; + uint16_t bank_end = area->y2 / 8; + + uint16_t bank; + uint16_t cols_to_update = area->x2 - area->x1 + 1; + for (bank = bank_start ; bank <= bank_end ; bank++ ){ + pcd8544_send_cmd(0x40 | bank ); /* set Y address */ + pcd8544_send_cmd(0x80 | area->x1 ); /* set X address */ + uint16_t offset = bank * disp_drv->hor_res + area->x1; + pcd8544_send_data(&buf[offset], cols_to_update); + } + + lv_disp_flush_ready(disp_drv); + + } +} diff --git a/lvgl_tft/pcd8544.h b/lvgl_tft/pcd8544.h new file mode 100644 index 0000000..b9357fe --- /dev/null +++ b/lvgl_tft/pcd8544.h @@ -0,0 +1,57 @@ + +/** + * @file pcd8544.h + * + */ + +#ifndef PCD8544_H +#define PCD8544_H + +#ifdef __cplusplus +extern "C" { +#endif + + /********************* + * INCLUDES + *********************/ +#include + +#ifdef LV_LVGL_H_INCLUDE_SIMPLE +#include "lvgl.h" +#else +#include "lvgl/lvgl.h" +#endif + + /********************* + * DEFINES + *********************/ + +#define PCD8544_DC CONFIG_LV_DISP_PIN_DC +#define PCD8544_RST CONFIG_LV_DISP_PIN_RST +#define PCD8544_BCKL CONFIG_LV_DISP_PIN_BCKL + + /********************** + * TYPEDEFS + **********************/ + + /********************** + * GLOBAL PROTOTYPES + **********************/ + + void pcd8544_init(void); + void pcd8544_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map); + void pcd8544_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area); + void pcd8544_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, + lv_color_t color, lv_opa_t opa); + void pcd8544_set_contrast(uint8_t contrast); + + /********************** + * MACROS + **********************/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*PCD8544_H*/ From f3f6ba6470860b8cc05f182d0f4d02a8357a5f4a Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 18 Nov 2021 08:58:04 +0100 Subject: [PATCH 11/13] Added PCD8544 to readme, addressed PR comments --- README.md | 1 + lvgl_tft/pcd8544.c | 8 +++++--- lvgl_tft/pcd8544.h | 42 +++++++++++++++++++++--------------------- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index a664636..522c0e1 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ swap of RGB565 color on the LVGL configuration menuconfig (it's not handled auto | RA8875 | TFT | SPI | 16: RGB565 | Yes | | SH1107 | Monochrome | SPI | 1: 1byte per pixel | No | | SSD1306 | Monochrome | I2C | 1: 1byte per pixel | No | +| PCD8544 | Monochrome | SPI | 1: 1byte per pixel | No | | IL3820 | e-Paper | SPI | 1: 1byte per pixel | No | | UC8151D/ GoodDisplay GDEW0154M10 DES | e-Paper | SPI | 1: 1byte per pixel | No | | FitiPower JD79653A/ GoodDisplay GDEW0154M09 | e-Paper | SPI | 1: 1byte per pixel | No | diff --git a/lvgl_tft/pcd8544.c b/lvgl_tft/pcd8544.c index b2a7bed..49d067e 100644 --- a/lvgl_tft/pcd8544.c +++ b/lvgl_tft/pcd8544.c @@ -116,9 +116,12 @@ void pcd8544_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t uint8_t * buf = (uint8_t *) color_map; + // Check if the whole frame buffer can be sent in a single SPI transaction + if ((area->x1 == 0) && (area->y1 == 0) && (area->x2 == (disp_drv->hor_res - 1)) && (area->y2 == (disp_drv->ver_res - 1))){ - // optimize flush of complete frame buffer in a single SPI transaction + // send complete frame buffer at once. + // NOTE: disp_spi_send_colors triggers lv_disp_flush_ready pcd8544_send_cmd(0x40); /* set Y address */ pcd8544_send_cmd(0x80); /* set X address */ @@ -134,13 +137,12 @@ void pcd8544_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t uint16_t bank; uint16_t cols_to_update = area->x2 - area->x1 + 1; for (bank = bank_start ; bank <= bank_end ; bank++ ){ - pcd8544_send_cmd(0x40 | bank ); /* set Y address */ + pcd8544_send_cmd(0x40 | bank ); /* set Y address */ pcd8544_send_cmd(0x80 | area->x1 ); /* set X address */ uint16_t offset = bank * disp_drv->hor_res + area->x1; pcd8544_send_data(&buf[offset], cols_to_update); } lv_disp_flush_ready(disp_drv); - } } diff --git a/lvgl_tft/pcd8544.h b/lvgl_tft/pcd8544.h index b9357fe..24fcc71 100644 --- a/lvgl_tft/pcd8544.h +++ b/lvgl_tft/pcd8544.h @@ -11,9 +11,9 @@ extern "C" { #endif - /********************* - * INCLUDES - *********************/ +/********************* + * INCLUDES + *********************/ #include #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -22,32 +22,32 @@ extern "C" { #include "lvgl/lvgl.h" #endif - /********************* - * DEFINES - *********************/ +/********************* + * DEFINES + *********************/ #define PCD8544_DC CONFIG_LV_DISP_PIN_DC #define PCD8544_RST CONFIG_LV_DISP_PIN_RST #define PCD8544_BCKL CONFIG_LV_DISP_PIN_BCKL - /********************** - * TYPEDEFS - **********************/ +/********************** + * TYPEDEFS + **********************/ - /********************** - * GLOBAL PROTOTYPES - **********************/ +/********************** + * GLOBAL PROTOTYPES + **********************/ - void pcd8544_init(void); - void pcd8544_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map); - void pcd8544_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area); - void pcd8544_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, - lv_color_t color, lv_opa_t opa); - void pcd8544_set_contrast(uint8_t contrast); +void pcd8544_init(void); +void pcd8544_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map); +void pcd8544_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area); +void pcd8544_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, + lv_color_t color, lv_opa_t opa); +void pcd8544_set_contrast(uint8_t contrast); - /********************** - * MACROS - **********************/ +/********************** + * MACROS + **********************/ #ifdef __cplusplus From 31a5733c8d49f3885ce282cb1c534133fcf72240 Mon Sep 17 00:00:00 2001 From: arktrin Date: Sun, 5 Dec 2021 17:01:36 +0300 Subject: [PATCH 12/13] Fix SPI configuration for ESP32-C3 and ESP32-S2 ESP32-C3 and ESP32-S2 do not have VSPI or HSPI --- lvgl_spi_conf.h | 6 ++---- lvgl_tft/Kconfig | 6 ++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lvgl_spi_conf.h b/lvgl_spi_conf.h index 2c62c94..f3d4a3d 100644 --- a/lvgl_spi_conf.h +++ b/lvgl_spi_conf.h @@ -65,15 +65,13 @@ extern "C" { #define ENABLE_TOUCH_INPUT CONFIG_LV_ENABLE_TOUCH #if defined (CONFIG_LV_TFT_DISPLAY_SPI_HSPI) -#if defined (CONFIG_IDF_TARGET_ESP32C3) -#define TFT_SPI_HOST SPI2_HOST -#else #define TFT_SPI_HOST HSPI_HOST -#endif #elif defined (CONFIG_LV_TFT_DISPLAY_SPI_VSPI) #define TFT_SPI_HOST VSPI_HOST #elif defined (CONFIG_LV_TFT_DISPLAY_SPI_FSPI) #define TFT_SPI_HOST FSPI_HOST +#elif defined (CONFIG_LV_TFT_DISPLAY_SPI2) +#define TFT_SPI_HOST SPI2_HOST #endif #if defined (CONFIG_LV_TFT_DISPLAY_SPI_HALF_DUPLEX) diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig index b700894..6ccf055 100644 --- a/lvgl_tft/Kconfig +++ b/lvgl_tft/Kconfig @@ -476,11 +476,13 @@ menu "LVGL TFT Display controller" Select the SPI Bus the TFT Display is attached to. config LV_TFT_DISPLAY_SPI_HSPI - bool "HSPI" + bool "HSPI" if IDF_TARGET_ESP32 config LV_TFT_DISPLAY_SPI_VSPI - bool "VSPI" if !IDF_TARGET_ESP32S2 + bool "VSPI" if IDF_TARGET_ESP32 config LV_TFT_DISPLAY_SPI_FSPI bool "FSPI" if IDF_TARGET_ESP32S2 + config LV_TFT_DISPLAY_SPI2 + bool "SPI2" if IDF_TARGET_ESP32C3 endchoice choice From 23ee5be93bbfa823acfea2bae686c38d6379b35e Mon Sep 17 00:00:00 2001 From: arktrin Date: Mon, 13 Dec 2021 14:31:09 +0300 Subject: [PATCH 13/13] replace all specific SPI names with SPIx_HOST --- lvgl_spi_conf.h | 14 ++++++-------- lvgl_tft/Kconfig | 17 +++++++---------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/lvgl_spi_conf.h b/lvgl_spi_conf.h index f3d4a3d..cab94d7 100644 --- a/lvgl_spi_conf.h +++ b/lvgl_spi_conf.h @@ -64,14 +64,12 @@ extern "C" { #define ENABLE_TOUCH_INPUT CONFIG_LV_ENABLE_TOUCH -#if defined (CONFIG_LV_TFT_DISPLAY_SPI_HSPI) -#define TFT_SPI_HOST HSPI_HOST -#elif defined (CONFIG_LV_TFT_DISPLAY_SPI_VSPI) -#define TFT_SPI_HOST VSPI_HOST -#elif defined (CONFIG_LV_TFT_DISPLAY_SPI_FSPI) -#define TFT_SPI_HOST FSPI_HOST -#elif defined (CONFIG_LV_TFT_DISPLAY_SPI2) -#define TFT_SPI_HOST SPI2_HOST +#if defined (CONFIG_LV_TFT_DISPLAY_SPI1_HOST) +#define TFT_SPI_HOST SPI1_HOST +#elif defined (CONFIG_LV_TFT_DISPLAY_SPI2_HOST) +#define TFT_SPI_HOST SPI2_HOST +#elif defined (CONFIG_LV_TFT_DISPLAY_SPI3_HOST) +#define TFT_SPI_HOST SPI3_HOST #endif #if defined (CONFIG_LV_TFT_DISPLAY_SPI_HALF_DUPLEX) diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig index 6ccf055..b55f1f1 100644 --- a/lvgl_tft/Kconfig +++ b/lvgl_tft/Kconfig @@ -469,20 +469,17 @@ menu "LVGL TFT Display controller" choice prompt "TFT SPI Bus." if LV_TFT_DISPLAY_PROTOCOL_SPI - default LV_TFT_DISPLAY_SPI_VSPI if LV_PREDEFINED_DISPLAY_TTGO && \ + default LV_TFT_DISPLAY_SPI3_HOST if LV_PREDEFINED_DISPLAY_TTGO && \ !IDF_TARGET_ESP32S2 - default LV_TFT_DISPLAY_SPI_FSPI if IDF_TARGET_ESP32S2 help Select the SPI Bus the TFT Display is attached to. - config LV_TFT_DISPLAY_SPI_HSPI - bool "HSPI" if IDF_TARGET_ESP32 - config LV_TFT_DISPLAY_SPI_VSPI - bool "VSPI" if IDF_TARGET_ESP32 - config LV_TFT_DISPLAY_SPI_FSPI - bool "FSPI" if IDF_TARGET_ESP32S2 - config LV_TFT_DISPLAY_SPI2 - bool "SPI2" if IDF_TARGET_ESP32C3 + config LV_TFT_DISPLAY_SPI1_HOST + bool "SPI1_HOST" + config LV_TFT_DISPLAY_SPI2_HOST + bool "SPI2_HOST" + config LV_TFT_DISPLAY_SPI3_HOST + bool "SPI3_HOST" endchoice choice