added support for TE pin on the st7789 driver

This commit is contained in:
Bassam 2022-11-03 22:51:25 +02:00
parent a4128e1d41
commit 24cabb1523
3 changed files with 30 additions and 1 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -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