LV_DISP_USE_RST

Allows to not allocate a GPIO for display reset: some may have that pin tied or attached to a Power management IC.

Supersedes PR from @usedbytes doing same but only for IL9341, this is for all supported displays.
This commit is contained in:
Rop Gonggrijp 2021-04-28 11:04:53 +02:00
parent 147cacc0af
commit 7b571a7fc7
29 changed files with 136 additions and 35 deletions

View file

@ -144,7 +144,7 @@ void DELAY_MS(uint16_t ms)
vTaskDelay(ms / portTICK_PERIOD_MS);
}
#if EVE_USE_PDN
void EVE_pdn_set(void)
{
gpio_set_level(EVE_PDN, 0); /* Power-Down low */
@ -155,7 +155,7 @@ void EVE_pdn_clear(void)
{
gpio_set_level(EVE_PDN, 1); /* Power-Down high */
}
#endif
void spi_acquire()
{
@ -841,11 +841,13 @@ uint8_t EVE_init(void)
uint8_t chipid = 0;
uint16_t timeout = 0;
#if EVE_USE_PDN
EVE_pdn_set();
DELAY_MS(6); /* minimum time for power-down is 5ms */
EVE_pdn_clear();
DELAY_MS(21); /* minimum time to allow from rising PD_N to first access is 20ms */
#endif
/* EVE_cmdWrite(EVE_CORERST,0); */ /* reset, only required for warm-start if PowerDown line is not used */

View file

@ -39,8 +39,12 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#define BLOCK_TRANSFER_SIZE 3840 // block transfer size when write data to CMD buffer
void DELAY_MS(uint16_t ms);
#if EVE_USE_PDN
void EVE_pdn_set(void);
void EVE_pdn_clear(void);
#endif
void spi_acquire();
void spi_release();

View file

@ -44,11 +44,12 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#include "FT81x.h"
#define EVE_CLK DISP_SPI_CLK // orange
#define EVE_MISO DISP_SPI_MISO // yellow
#define EVE_MOSI DISP_SPI_MOSI // green
#define EVE_CS DISP_SPI_CS // blue
#define EVE_PDN CONFIG_LV_DISP_PIN_RST // grey
#define EVE_CLK DISP_SPI_CLK // orange
#define EVE_MISO DISP_SPI_MISO // yellow
#define EVE_MOSI DISP_SPI_MOSI // green
#define EVE_CS DISP_SPI_CS // blue
#define EVE_PDN CONFIG_LV_DISP_PIN_RST // grey
#define EVE_USE_PDN CONFIG_LV_DISP_USE_RST
#define SPI_TRANSER_SIZE (DISP_BUF_SIZE * (LV_COLOR_DEPTH / 8))

View file

@ -262,9 +262,15 @@ void TFT_bitmap_display(void)
void FT81x_init(void)
{
#if EVE_USE_PDN
gpio_pad_select_gpio(EVE_PDN);
#endif
gpio_set_level(EVE_CS, 1);
#if EVE_USE_PDN
gpio_set_direction(EVE_PDN, GPIO_MODE_OUTPUT);
#endif
spi_acquire();

View file

@ -124,18 +124,24 @@ void GC9A01_init(void)
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(GC9A01_DC);
gpio_set_direction(GC9A01_DC, GPIO_MODE_OUTPUT);
#if GC9A01_USE_RST
gpio_pad_select_gpio(GC9A01_RST);
gpio_set_direction(GC9A01_RST, GPIO_MODE_OUTPUT);
#endif
#if GC9A01_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(GC9A01_BCKL);
gpio_set_direction(GC9A01_BCKL, GPIO_MODE_OUTPUT);
#endif
#if GC9A01_USE_RST
//Reset the display
gpio_set_level(GC9A01_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(GC9A01_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "Initialization.");

View file

@ -25,9 +25,10 @@ extern "C" {
/*********************
* DEFINES
*********************/
#define GC9A01_DC CONFIG_LV_DISP_PIN_DC
#define GC9A01_RST CONFIG_LV_DISP_PIN_RST
#define GC9A01_BCKL CONFIG_LV_DISP_PIN_BCKL
#define GC9A01_DC CONFIG_LV_DISP_PIN_DC
#define GC9A01_RST CONFIG_LV_DISP_PIN_RST
#define GC9A01_USE_RST CONFIG_LV_DISP_USE_RST
#define GC9A01_BCKL CONFIG_LV_DISP_PIN_BCKL
#define GC9A01_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL

View file

@ -900,8 +900,21 @@ menu "LVGL TFT Display controller"
help
Configure the display DC pin here.
config LV_DISP_USE_RST
bool "Use a GPIO for resetting the display" if LV_TFT_DISPLAY_PROTOCOL_SPI
default y
help
Enable display reset control. Set this if the reset pin of the
display is connected to the host. If this is not set, then it is
the user's responsibility to ensure that the display is reset
before initialisation.
You may want to disable this option because the reset pin is not
connected, or is connected to an external component such as the
power management IC.
config LV_DISP_PIN_RST
int "GPIO for Reset" if LV_TFT_DISPLAY_PROTOCOL_SPI && !LV_DISP_ST7789_SOFT_RESET
depends on LV_DISP_USE_RST
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2

View file

@ -162,19 +162,24 @@ void hx8357_init(void)
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(HX8357_DC);
gpio_set_direction(HX8357_DC, GPIO_MODE_OUTPUT);
#if HX8357_USE_RST
gpio_pad_select_gpio(HX8357_RST);
gpio_set_direction(HX8357_RST, GPIO_MODE_OUTPUT);
#endif
#if HX8357_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(HX8357_BCKL);
gpio_set_direction(HX8357_BCKL, GPIO_MODE_OUTPUT);
#endif
#if HX8357_USE_RST
//Reset the display
gpio_set_level(HX8357_RST, 0);
vTaskDelay(10 / portTICK_RATE_MS);
gpio_set_level(HX8357_RST, 1);
vTaskDelay(120 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "Initialization.");

View file

@ -35,9 +35,10 @@ extern "C" {
/*********************
* DEFINES
*********************/
#define HX8357_DC CONFIG_LV_DISP_PIN_DC
#define HX8357_RST CONFIG_LV_DISP_PIN_RST
#define HX8357_BCKL CONFIG_LV_DISP_PIN_BCKL
#define HX8357_DC CONFIG_LV_DISP_PIN_DC
#define HX8357_RST CONFIG_LV_DISP_PIN_RST
#define HX8357_USE_RST CONFIG_LV_DISP_USE_RST
#define HX8357_BCKL CONFIG_LV_DISP_PIN_BCKL
#define HX8357_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
#define HX8357_INVERT_COLORS CONFIG_LV_INVERT_COLORS

View file

@ -198,16 +198,22 @@ void il3820_init(void)
/* Initialize non-SPI GPIOs */
gpio_pad_select_gpio(IL3820_DC_PIN);
gpio_set_direction(IL3820_DC_PIN, GPIO_MODE_OUTPUT);
#if IL3820_USE_RST
gpio_pad_select_gpio(IL3820_RST_PIN);
gpio_set_direction(IL3820_RST_PIN, GPIO_MODE_OUTPUT);
#endif
gpio_pad_select_gpio(IL3820_BUSY_PIN);
gpio_set_direction(IL3820_BUSY_PIN, GPIO_MODE_INPUT);
#if IL3820_USE_RST
/* Harware reset */
gpio_set_level( IL3820_RST_PIN, 0);
vTaskDelay(IL3820_RESET_DELAY / portTICK_RATE_MS);
gpio_set_level( IL3820_RST_PIN, 1);
vTaskDelay(IL3820_RESET_DELAY / portTICK_RATE_MS);
#endif
/* Software reset */
il3820_write_cmd(IL3820_CMD_SW_RESET, NULL, 0);

View file

@ -28,6 +28,7 @@ extern "C"
#define IL3820_DC_PIN CONFIG_LV_DISP_PIN_DC
#define IL3820_RST_PIN CONFIG_LV_DISP_PIN_RST
#define IL3820_USE_RST CONFIG_LV_DISP_USE_RST
#define IL3820_BUSY_PIN CONFIG_LV_DISP_PIN_BUSY
#define IL3820_BUSY_LEVEL 1

View file

@ -93,18 +93,23 @@ void ili9341_init(void)
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(ILI9341_DC);
gpio_set_direction(ILI9341_DC, GPIO_MODE_OUTPUT);
#if ILI9341_USE_RST
gpio_pad_select_gpio(ILI9341_RST);
gpio_set_direction(ILI9341_RST, GPIO_MODE_OUTPUT);
#endif
#if ILI9341_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ILI9341_BCKL);
gpio_set_direction(ILI9341_BCKL, GPIO_MODE_OUTPUT);
#endif
#if ILI9341_USE_RST
//Reset the display
gpio_set_level(ILI9341_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ILI9341_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "Initialization.");

View file

@ -25,9 +25,10 @@ extern "C" {
/*********************
* DEFINES
*********************/
#define ILI9341_DC CONFIG_LV_DISP_PIN_DC
#define ILI9341_RST CONFIG_LV_DISP_PIN_RST
#define ILI9341_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9341_DC CONFIG_LV_DISP_PIN_DC
#define ILI9341_USE_RST CONFIG_LV_DISP_USE_RST
#define ILI9341_RST CONFIG_LV_DISP_PIN_RST
#define ILI9341_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9341_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL

View file

@ -76,19 +76,24 @@ void ili9481_init(void)
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(ILI9481_DC);
gpio_set_direction(ILI9481_DC, GPIO_MODE_OUTPUT);
#if ILI9481_USE_RST
gpio_pad_select_gpio(ILI9481_RST);
gpio_set_direction(ILI9481_RST, GPIO_MODE_OUTPUT);
#endif
#if ILI9481_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ILI9481_BCKL);
gpio_set_direction(ILI9481_BCKL, GPIO_MODE_OUTPUT);
#endif
#if ILI9481_USE_RST
//Reset the display
gpio_set_level(ILI9481_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ILI9481_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "ILI9481 initialization.");

View file

@ -25,9 +25,10 @@ extern "C" {
/*********************
* DEFINES
*********************/
#define ILI9481_DC CONFIG_LV_DISP_PIN_DC
#define ILI9481_RST CONFIG_LV_DISP_PIN_RST
#define ILI9481_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9481_DC CONFIG_LV_DISP_PIN_DC
#define ILI9481_RST CONFIG_LV_DISP_PIN_RST
#define ILI9481_USE_RST CONFIG_LV_DISP_USE_RST
#define ILI9481_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9481_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
#define ILI9481_INVERT_COLORS CONFIG_LV_INVERT_COLORS

View file

@ -78,19 +78,24 @@ void ili9486_init(void)
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(ILI9486_DC);
gpio_set_direction(ILI9486_DC, GPIO_MODE_OUTPUT);
#if ILI9486_USE_RST
gpio_pad_select_gpio(ILI9486_RST);
gpio_set_direction(ILI9486_RST, GPIO_MODE_OUTPUT);
#endif
#if ILI9486_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ILI9486_BCKL);
gpio_set_direction(ILI9486_BCKL, GPIO_MODE_OUTPUT);
#endif
#if ILI9486_USE_RST
//Reset the display
gpio_set_level(ILI9486_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ILI9486_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "ILI9486 Initialization.");

View file

@ -25,9 +25,10 @@ extern "C" {
/*********************
* DEFINES
*********************/
#define ILI9486_DC CONFIG_LV_DISP_PIN_DC
#define ILI9486_RST CONFIG_LV_DISP_PIN_RST
#define ILI9486_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9486_DC CONFIG_LV_DISP_PIN_DC
#define ILI9486_RST CONFIG_LV_DISP_PIN_RST
#define ILI9486_USE_RST CONFIG_LV_DISP_USE_RST
#define ILI9486_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9486_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL

View file

@ -78,19 +78,24 @@ void ili9488_init(void)
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(ILI9488_DC);
gpio_set_direction(ILI9488_DC, GPIO_MODE_OUTPUT);
#if ILI9488_USE_RST
gpio_pad_select_gpio(ILI9488_RST);
gpio_set_direction(ILI9488_RST, GPIO_MODE_OUTPUT);
#endif
#if ILI9488_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ILI9488_BCKL);
gpio_set_direction(ILI9488_BCKL, GPIO_MODE_OUTPUT);
#endif
#if ILI9488_USE_RST
//Reset the display
gpio_set_level(ILI9488_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ILI9488_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "ILI9488 initialization.");

View file

@ -25,9 +25,10 @@ extern "C" {
/*********************
* DEFINES
*********************/
#define ILI9488_DC CONFIG_LV_DISP_PIN_DC
#define ILI9488_RST CONFIG_LV_DISP_PIN_RST
#define ILI9488_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9488_DC CONFIG_LV_DISP_PIN_DC
#define ILI9488_RST CONFIG_LV_DISP_PIN_RST
#define ILI9488_USE_RST CONFIG_LV_DISP_USE_RST
#define ILI9488_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9488_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL

View file

@ -159,18 +159,24 @@ void ra8875_init(void)
#endif
// Initialize non-SPI GPIOs
#if RA8875_USE_RST
gpio_pad_select_gpio(RA8875_RST);
gpio_set_direction(RA8875_RST, GPIO_MODE_OUTPUT);
#endif
#ifdef CONFIG_LV_DISP_PIN_BCKL
gpio_pad_select_gpio(CONFIG_LV_DISP_PIN_BCKL);
gpio_set_direction(CONFIG_LV_DISP_PIN_BCKL, GPIO_MODE_OUTPUT);
#endif
#if RA8875_USE_RST
// Reset the RA8875
gpio_set_level(RA8875_RST, 0);
vTaskDelay(DIV_ROUND_UP(100, portTICK_RATE_MS));
gpio_set_level(RA8875_RST, 1);
vTaskDelay(DIV_ROUND_UP(100, portTICK_RATE_MS));
#endif
// Initalize RA8875 clocks (SPI must be decelerated before initializing clocks)
disp_spi_change_device_speed(SPI_CLOCK_SPEED_SLOW_HZ);

View file

@ -24,7 +24,8 @@ extern "C" {
/*********************
* DEFINES
*********************/
#define RA8875_RST CONFIG_LV_DISP_PIN_RST
#define RA8875_RST CONFIG_LV_DISP_PIN_RST
#define RA8875_USE_RST CONFIG_LV_DISP_USE_RST
// System & Configuration Registers
#define RA8875_REG_PWRR (0x01) // Power and Display Control Register (PWRR)

View file

@ -94,6 +94,8 @@ void sh1107_init(void)
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(SH1107_DC);
gpio_set_direction(SH1107_DC, GPIO_MODE_OUTPUT);
#if SH1107_USE_RST
gpio_pad_select_gpio(SH1107_RST);
gpio_set_direction(SH1107_RST, GPIO_MODE_OUTPUT);
@ -102,6 +104,7 @@ void sh1107_init(void)
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(SH1107_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS);
#endif
//Send all the commands
uint16_t cmd = 0;

View file

@ -25,8 +25,9 @@ extern "C" {
/*********************
* DEFINES
*********************/
#define SH1107_DC CONFIG_LV_DISP_PIN_DC
#define SH1107_RST CONFIG_LV_DISP_PIN_RST
#define SH1107_DC CONFIG_LV_DISP_PIN_DC
#define SH1107_RST CONFIG_LV_DISP_PIN_RST
#define SH1107_USE_RST CONFIG_LV_DISP_USE_RST
/**********************
* TYPEDEFS

View file

@ -99,6 +99,8 @@ void st7735s_init(void)
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(ST7735S_DC);
gpio_set_direction(ST7735S_DC, GPIO_MODE_OUTPUT);
#if ST7735S_USE_RST
gpio_pad_select_gpio(ST7735S_RST);
gpio_set_direction(ST7735S_RST, GPIO_MODE_OUTPUT);
@ -107,6 +109,7 @@ void st7735s_init(void)
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ST7735S_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "ST7735S initialization.");

View file

@ -25,8 +25,9 @@ extern "C" {
*********************/
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#define ST7735S_DC CONFIG_LV_DISP_PIN_DC
#define ST7735S_RST CONFIG_LV_DISP_PIN_RST
#define ST7735S_DC CONFIG_LV_DISP_PIN_DC
#define ST7735S_RST CONFIG_LV_DISP_PIN_RST
#define ST7735S_USE_RST CONFIG_LV_DISP_USE_RST
#define AXP192_SDA CONFIG_LV_AXP192_PIN_SDA
#define AXP192_SCL CONFIG_LV_AXP192_PIN_SCL

View file

@ -91,7 +91,7 @@ void st7789_init(void)
gpio_pad_select_gpio(ST7789_DC);
gpio_set_direction(ST7789_DC, GPIO_MODE_OUTPUT);
#if !defined(CONFIG_LV_DISP_ST7789_SOFT_RESET)
#if !defined(ST7789_SOFT_RST)
gpio_pad_select_gpio(ST7789_RST);
gpio_set_direction(ST7789_RST, GPIO_MODE_OUTPUT);
#endif
@ -102,7 +102,7 @@ void st7789_init(void)
#endif
//Reset the display
#if !defined(CONFIG_LV_DISP_ST7789_SOFT_RESET)
#if !defined(ST7789_SOFT_RST)
gpio_set_level(ST7789_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ST7789_RST, 1);

View file

@ -25,6 +25,15 @@ extern "C"
#define ST7789_RST CONFIG_LV_DISP_PIN_RST
#define ST7789_BCKL CONFIG_LV_DISP_PIN_BCKL
#if CONFIG_LV_DISP_USE_RST
#if CONFIG_LV_DISP_ST7789_SOFT_RESET
#define ST7789_SOFT_RST
#endif
#else
#define ST7789_SOFT_RST
#endif
#define ST7789_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
#define ST7789_INVERT_COLORS CONFIG_LV_INVERT_COLORS

View file

@ -94,18 +94,24 @@ void st7796s_init(void)
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(ST7796S_DC);
gpio_set_direction(ST7796S_DC, GPIO_MODE_OUTPUT);
#if ST7796S_USE_RST
gpio_pad_select_gpio(ST7796S_RST);
gpio_set_direction(ST7796S_RST, GPIO_MODE_OUTPUT);
#endif
#if ST7796S_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ST7796S_BCKL);
gpio_set_direction(ST7796S_BCKL, GPIO_MODE_OUTPUT);
#endif
#if ST7796S_USE_RST
//Reset the display
gpio_set_level(ST7796S_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ST7796S_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "Initialization.");

View file

@ -26,9 +26,10 @@ extern "C"
/*********************
* DEFINES
*********************/
#define ST7796S_DC CONFIG_LV_DISP_PIN_DC
#define ST7796S_RST CONFIG_LV_DISP_PIN_RST
#define ST7796S_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ST7796S_DC CONFIG_LV_DISP_PIN_DC
#define ST7796S_RST CONFIG_LV_DISP_PIN_RST
#define ST7796S_USE_RST CONFIG_LV_DISP_USE_RST
#define ST7796S_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ST7796S_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
#define ST7796S_INVERT_COLORS CONFIG_LV_INVERT_COLORS