Adds soft reset option to ST7789 driver

This commit is contained in:
cranial-smoke 2021-02-10 17:50:51 -05:00
parent 19a943c015
commit 260cf74e1b
2 changed files with 20 additions and 0 deletions

View file

@ -734,6 +734,19 @@ menu "LVGL TFT Display controller"
endmenu
# menu will be visible only when LV_PREDEFINED_DISPLAY_NONE is y
menu "Display ST7789 Configuration"
visible if LV_TFT_DISPLAY_CONTROLLER_ST7789
config LV_DISP_ST7789_SOFT_RESET
bool "Soft reset - use software reset instead of reset pin"
depends on LV_TFT_DISPLAY_CONTROLLER_ST7789
default n
help
Use software reset and ignores configured reset pin (some hardware does not use a reset pin).
endmenu
# menu will be visible only when LV_PREDEFINED_DISPLAY_NONE is y
menu "Display Pin Assignments"
visible if LV_PREDEFINED_DISPLAY_NONE || LV_PREDEFINED_DISPLAY_RPI_MPI3501 || LV_PREDEFINED_PINS_TKOALA

View file

@ -84,8 +84,11 @@ void st7789_init(void)
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(ST7789_DC);
gpio_set_direction(ST7789_DC, GPIO_MODE_OUTPUT);
#if !defined(CONFIG_LV_DISP_ST7789_SOFT_RESET)
gpio_pad_select_gpio(ST7789_RST);
gpio_set_direction(ST7789_RST, GPIO_MODE_OUTPUT);
#endif
#if ST7789_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ST7789_BCKL);
@ -93,10 +96,14 @@ void st7789_init(void)
#endif
//Reset the display
#if !defined(CONFIG_LV_DISP_ST7789_SOFT_RESET)
gpio_set_level(ST7789_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ST7789_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS);
#else
st7789_send_cmd(ST7789_SWRESET);
#endif
printf("ST7789 initialization.\n");