Merge pull request #34 from cranial-smoke/feature/st7789_soft_reset

Adds soft reset option to ST7789 driver
This commit is contained in:
Carlos Diaz 2021-02-13 18:51:10 -06:00 committed by GitHub
commit 6b08c3fcce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View file

@ -735,6 +735,19 @@ menu "LVGL TFT Display controller"
endmenu 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 will be visible only when LV_PREDEFINED_DISPLAY_NONE is y
menu "Display Pin Assignments" menu "Display Pin Assignments"
visible if LV_PREDEFINED_DISPLAY_NONE || LV_PREDEFINED_DISPLAY_RPI_MPI3501 || LV_PREDEFINED_PINS_TKOALA visible if LV_PREDEFINED_DISPLAY_NONE || LV_PREDEFINED_DISPLAY_RPI_MPI3501 || LV_PREDEFINED_PINS_TKOALA
@ -885,7 +898,7 @@ menu "LVGL TFT Display controller"
Configure the display DC pin here. Configure the display DC pin here.
config LV_DISP_PIN_RST config LV_DISP_PIN_RST
int "GPIO for Reset" if LV_TFT_DISPLAY_PROTOCOL_SPI int "GPIO for Reset" if LV_TFT_DISPLAY_PROTOCOL_SPI && !LV_DISP_ST7789_SOFT_RESET
range 0 39 if IDF_TARGET_ESP32 range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2 range 0 43 if IDF_TARGET_ESP32S2

View file

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