diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig index 4a74ad2..fc62cfb 100644 --- a/lvgl_tft/Kconfig +++ b/lvgl_tft/Kconfig @@ -739,6 +739,20 @@ menu "LVGL TFT Display controller" help Use software reset and ignores configured reset pin (some hardware does not use a reset pin). + config LV_DISPLAY_USE_TE_PIN + bool "Enable TE (Tearing effect) pin" + default y + help + Enable the TE pin to control the display. You can disable + it when the display does not need MISO signal to be controlled. + + config LV_DISPLAY_TE_PIN + int "GPIO for TE (Tearing effect) pin" + depends on LV_DISPLAY_USE_TE_PIN + default 38 + help + Configure the display TE pin here. + endmenu # menu will be visible only when LV_PREDEFINED_DISPLAY_NONE is y diff --git a/lvgl_tft/st7789.c b/lvgl_tft/st7789.c index 70af85d..5c7212c 100644 --- a/lvgl_tft/st7789.c +++ b/lvgl_tft/st7789.c @@ -82,6 +82,14 @@ void st7789_init(void) {0xB6, {0x0A, 0x82, 0x27, 0x00}, 4}, {ST7789_SLPOUT, {0}, 0x80}, {ST7789_DISPON, {0}, 0x80}, + #ifdef CONFIG_LV_DISPLAY_USE_TE_PIN + {ST7789_TEON, {0}, 1}, //[BJ] turn on TE + #endif + //----------- + //[BJ] Below I am trying to change refresh rate of the screen so the tearing is not prominent + //{ST7789_FRCTR2,{0x1F},1}, //[BJ] set the refresh rate + {ST7789_FRCTRL1,{0x01, 0x0F, 0x0F},3}, //[BJ] divide the refresh by 2. + // ---------------------------------------- {0, {0}, 0xff}, }; @@ -94,6 +102,11 @@ void st7789_init(void) gpio_set_direction(ST7789_RST, GPIO_MODE_OUTPUT); #endif +#ifdef CONFIG_LV_DISPLAY_USE_TE_PIN + gpio_pad_select_gpio(ST7789_TE); + gpio_set_direction(ST7789_TE, GPIO_MODE_INPUT); +#endif + //Reset the display #if !defined(ST7789_SOFT_RST) gpio_set_level(ST7789_RST, 0); @@ -208,7 +221,7 @@ void st7789_send_data(void * data, uint16_t length) static void st7789_send_color(void * data, size_t length) { - //disp_wait_for_pending_transactions(); [BJ] noticed that commenting this made the display slightly faster. + // disp_wait_for_pending_transactions(); gpio_set_level(ST7789_DC, 1); disp_spi_send_colors(data, length); } diff --git a/lvgl_tft/st7789.h b/lvgl_tft/st7789.h index cacb31b..362f98c 100644 --- a/lvgl_tft/st7789.h +++ b/lvgl_tft/st7789.h @@ -23,6 +23,8 @@ extern "C" #define ST7789_DC CONFIG_LV_DISP_PIN_DC #define ST7789_RST CONFIG_LV_DISP_PIN_RST +#define ST7789_TE CONFIG_LV_DISPLAY_TE_PIN + #if CONFIG_LV_DISP_USE_RST #if CONFIG_LV_DISP_ST7789_SOFT_RESET