Skip to content

Commit

Permalink
Merge branch 'feat/restore_lcd_st77903' into 'master'
Browse files Browse the repository at this point in the history
feat(display): restore st77903 QSPI LCD

See merge request ae_group/esp-iot-solution!990
  • Loading branch information
leeebo committed May 14, 2024
2 parents 7f0eeff + 38d56d5 commit 4bc1edc
Show file tree
Hide file tree
Showing 43 changed files with 3,654 additions and 89 deletions.
1 change: 1 addition & 0 deletions .github/workflows/upload_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
components/display/lcd/esp_lcd_sh8601;
components/display/lcd/esp_lcd_spd2010;
components/display/lcd/esp_lcd_st7701;
components/display/lcd/esp_lcd_st77903_qspi;
components/display/lcd/esp_lcd_st77903_rgb;
components/display/lcd/esp_lcd_st77916;
components/display/lcd/esp_lcd_st77922;
Expand Down
10 changes: 10 additions & 0 deletions .gitlab/ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,16 @@ build_components_display_lcd_esp_lcd_st7701_test_apps:
variables:
EXAMPLE_DIR: components/display/lcd/esp_lcd_st7701/test_apps

build_components_display_lcd_esp_lcd_st77903_qspi_test_apps:
extends:
- .build_examples_template
- .rules:build:components_display_lcd_esp_lcd_st77903_qspi_test_apps
parallel:
matrix:
- IMAGE: espressif/idf:release-v5.3
variables:
EXAMPLE_DIR: components/display/lcd/esp_lcd_st77903_qspi/test_apps

build_components_display_lcd_esp_lcd_st77903_rgb_test_apps:
extends:
- .build_examples_template
Expand Down
16 changes: 16 additions & 0 deletions .gitlab/ci/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@
.patterns-components_display_lcd_esp_lcd_st7701: &patterns-components_display_lcd_esp_lcd_st7701
- "components/display/lcd/esp_lcd_st7701/**/*"

.patterns-components_display_lcd_esp_lcd_st77903_qspi: &patterns-components_display_lcd_esp_lcd_st77903_qspi
- "components/display/lcd/esp_lcd_st77903_qspi/**/*"

.patterns-components_display_lcd_esp_lcd_st77903_rgb: &patterns-components_display_lcd_esp_lcd_st77903_rgb
- "components/display/lcd/esp_lcd_st77903_rgb/**/*"

Expand Down Expand Up @@ -705,6 +708,8 @@
- <<: *if-trigger-job
- <<: *if-dev-push
changes: *patterns-build_system
- <<: *if-dev-push
changes: *patterns-components_display_lcd_esp_lcd_st77903_qspi
- <<: *if-dev-push
changes: *patterns-example_display_lcd_qspi_without_ram

Expand Down Expand Up @@ -1386,6 +1391,17 @@
- <<: *if-dev-push
changes: *patterns-components_display_lcd_esp_lcd_st7701

.rules:build:components_display_lcd_esp_lcd_st77903_qspi_test_apps:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-target_test
- <<: *if-trigger-job
- <<: *if-dev-push
changes: *patterns-build_system
- <<: *if-dev-push
changes: *patterns-components_display_lcd_esp_lcd_st77903_qspi

.rules:build:components_display_lcd_esp_lcd_st77903_rgb_test_apps:
rules:
- <<: *if-protected
Expand Down
20 changes: 20 additions & 0 deletions .gitlab/ci/target_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,26 @@ components_test_esp_lcd_st7701:
TEST_FOLDER: components/display/lcd/esp_lcd_st7701
TEST_ENV: esp32_s3_lcd_ev_board

components_test_esp_lcd_st77903_qspi:
extends:
- .pytest_template
- .rules:build:components_display_lcd_esp_lcd_st77903_qspi_test_apps
needs:
- job: "build_components_display_lcd_esp_lcd_st77903_qspi_test_apps"
artifacts: true
optional: false
parallel:
matrix:
- IDF_VERSION: "5.3"
tags:
- esp32s3
- esp32s3_lcd_ev
image: $DOCKER_TARGET_TEST_v5_1_ENV_IMAGE
variables:
TEST_TARGET: esp32s3
TEST_FOLDER: components/display/lcd/esp_lcd_st77903_qspi
TEST_ENV: esp32_s3_lcd_ev_board

components_test_esp_lcd_st77903_rgb:
extends:
- .pytest_template
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The registered components in ESP-IoT-Solution are listed below:
| [esp_lcd_sh8601](https://components.espressif.com/components/espressif/esp_lcd_sh8601) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_sh8601/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_sh8601) |
| [esp_lcd_spd2010](https://components.espressif.com/components/espressif/esp_lcd_spd2010) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_spd2010/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_spd2010) |
| [esp_lcd_st7701](https://components.espressif.com/components/espressif/esp_lcd_st7701) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_st7701/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_st7701) |
| [esp_lcd_st77903_qspi](https://components.espressif.com/components/espressif/esp_lcd_st77903_qspi) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_st77903_qspi/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_st77903_qspi)
| [esp_lcd_st77903_rgb](https://components.espressif.com/components/espressif/esp_lcd_st77903_rgb) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_st77903_rgb/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_st77903_rgb)
| [esp_lcd_st77916](https://components.espressif.com/components/espressif/esp_lcd_st77916) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_st77916/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_st77916)
| [esp_lcd_st77922](https://components.espressif.com/components/espressif/esp_lcd_st77922) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_st77922/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_st77922)
Expand Down
1 change: 1 addition & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ ESP-IoT-Solution 中注册的组件如下:
| [esp_lcd_sh8601](https://components.espressif.com/components/espressif/esp_lcd_sh8601) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_sh8601/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_sh8601) |
| [esp_lcd_spd2010](https://components.espressif.com/components/espressif/esp_lcd_spd2010) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_spd2010/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_spd2010) |
| [esp_lcd_st7701](https://components.espressif.com/components/espressif/esp_lcd_st7701) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_st7701/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_st7701) |
| [esp_lcd_st77903_qspi](https://components.espressif.com/components/espressif/esp_lcd_st77903_qspi) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_st77903_qspi/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_st77903_qspi)
| [esp_lcd_st77903_rgb](https://components.espressif.com/components/espressif/esp_lcd_st77903_rgb) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_st77903_rgb/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_st77903_rgb)
| [esp_lcd_st77916](https://components.espressif.com/components/espressif/esp_lcd_st77916) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_st77916/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_st77916)
| [esp_lcd_st77922](https://components.espressif.com/components/espressif/esp_lcd_st77922) | [![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_st77922/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_st77922)
Expand Down
4 changes: 4 additions & 0 deletions components/.build-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ components/display/lcd/esp_lcd_st7701/test_apps:
enable:
- if: IDF_TARGET in ["esp32s3"]

components/display/lcd/esp_lcd_st77903_qspi:
enable:
- if: IDF_TARGET in ["esp32s3"]

components/display/lcd/esp_lcd_st77903_rgb:
enable:
- if: IDF_TARGET in ["esp32s3"]
Expand Down
11 changes: 0 additions & 11 deletions components/display/lcd/esp_lcd_st77903/README.md

This file was deleted.

33 changes: 33 additions & 0 deletions components/display/lcd/esp_lcd_st77903_qspi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# ChangeLog

## v0.4.1- 2024-05-09

### Enhancements:

* Upload the driver to the espressif repository
* Update test_apps
* use `xPortInIsrContext()` to check whether the function is called in the ISR

### bugfix

* Fix the non-reentrant of the `lcd_write_cmd` function

## v0.4.0- 2024-01-30

### Enhancements:

* Retain the RGB interface driver in the esp-iot-solution repository, and keep only the QSPI interface driver in this repository

## v0.3.1 - 2023-11-03

### bugfix

* Fix the missing check of flags `auto_del_panel_io` and `mirror_by_cmd` for RGB interface
* Remove LCD command `29h` from the initialization sequence for QSPI interface

## v0.3.0 - 2023-09-08

### Enhancements:

* Implement the driver for the ST77903 LCD controller
* Support QSPI and RGB interface
9 changes: 9 additions & 0 deletions components/display/lcd/esp_lcd_st77903_qspi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
idf_component_register(
SRCS "esp_lcd_st77903_qspi.c"
INCLUDE_DIRS "include"
PRIV_REQUIRES esp_timer esp_psram
REQUIRES driver esp_lcd
)

include(package_manager)
cu_pkg_define_version(${CMAKE_CURRENT_LIST_DIR})
45 changes: 45 additions & 0 deletions components/display/lcd/esp_lcd_st77903_qspi/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
menu "LCD ST77903 QSPI Configuration"
config LCD_ST77903_ISR_IRAM_SAFE
bool "LCD ISR IRAM-Safe"
default n
help
Ensure the LCD interrupt is IRAM-Safe by allowing the interrupt handler to be
executable when the cache is disabled (e.g. SPI Flash write).
If you want the LCD driver to keep flushing the screen even when cache ops disabled,
you can enable this option. Note, this will also increase the IRAM usage.

config LCD_VSYNC_FRONT_NUM
int "LCD VSYNC Front Porch"
default 8
range 0 65535

config LCD_VSYNC_BACK_NUM
int "LCD VSYNC Back Porch"
default 8
range 0 65535

config LCD_LINE_INTERVAL_MIN_US
int "Minimum LCD Line Interval (us)"
default 42
range 40 100

config LCD_TASK_CHECK_TIME_MS
int "LCD Task Check Time (ms)"
default 10
range 1 100

config LCD_TASK_STOP_WAIT_TIME_MS
int "LCD Task Stop Wait Time (ms)"
default 200
range 1 1000

config LCD_TASK_STOP_TIME_MAX_MS
int "Maximum LCD Task Stop Time (ms)"
default 1000
range 1 10000

config LCD_READ_WAIT_TIME_MAX_MS
int "LCD Read Wait Time (ms)"
default 10
range 1 100
endmenu
55 changes: 55 additions & 0 deletions components/display/lcd/esp_lcd_st77903_qspi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# ESP LCD ST77903 (QSPI)

Implementation of the ST77903 QSPI LCD controller with [esp_lcd](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/lcd.html) component.

| LCD controller | Communication interface | Component name | Link to datasheet |
| :------------: | :---------------------: | :------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| ST77903 | QSPI | esp_lcd_ST77903_qspi | [PDF1](https://dl.espressif.com/AE/esp-iot-solution/ST77903_SPEC_P0.5.pdf), [PDF2](https://dl.espressif.com/AE/esp-iot-solution/ST77903_Customer_Application_Notes.pdf) |

## Initialization Code

```c
/**
* Uncomment these line if use custom initialization commands.
* The array should be declared as static const and positioned outside the function.
*/
// static const st77903_lcd_init_cmd_t lcd_init_cmds[] = {
// // {cmd, { data }, data_size, delay_ms}
// {0xf0, (uint8_t []){0xc3}, 1, 0},
// {0xf0, (uint8_t []){0x96}, 1, 0},
// {0xf0, (uint8_t []){0xa5}, 1, 0},
// ...
// };

ESP_LOGI(TAG, "Install st77903 panel driver");
esp_lcd_panel_handle_t panel_handle = NULL;
st77903_qspi_config_t qspi_config = ST77903_QSPI_CONFIG_DEFAULT(EXAMPLE_LCD_HOST,
EXAMPLE_PIN_NUM_LCD_QSPI_CS,
EXAMPLE_PIN_NUM_LCD_QSPI_PCLK,
EXAMPLE_PIN_NUM_LCD_QSPI_DATA0,
EXAMPLE_PIN_NUM_LCD_QSPI_DATA1,
EXAMPLE_PIN_NUM_LCD_QSPI_DATA2,
EXAMPLE_PIN_NUM_LCD_QSPI_DATA3,
1,
EXAMPLE_LCD_QSPI_H_RES,
EXAMPLE_LCD_QSPI_V_RES);
st77903_vendor_config_t vendor_config = {
.qspi_config = &qspi_config,
// .init_cmds = lcd_init_cmds, // Uncomment these line if use custom initialization commands
// .init_cmds_size = sizeof(lcd_init_cmds) / sizeof(st77903_lcd_init_cmd_t),
.flags = {
.mirror_by_cmd = 1, // Implemented by LCD command `36h`
},
};
const esp_lcd_panel_dev_config_t panel_config = {
.reset_gpio_num = EXAMPLE_PIN_NUM_LCD_RST,
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB, // Implemented by LCD command `36h`
.bits_per_pixel = EXAMPLE_LCD_BIT_PER_PIXEL, // Implemented by LCD command `3Ah` (16/18/24)
.vendor_config = &vendor_config,
};
ESP_ERROR_CHECK(esp_lcd_new_panel_st77903(&panel_config, &panel_handle));
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_handle));
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, true, false)); // This function can only be called when the refresh task is not running
ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(panel_handle, true)); // This function can control the display on/off and the refresh task run/stop
ESP_ERROR_CHECK(esp_lcd_panel_init(panel_handle)); // Start the refresh task
```
Loading

0 comments on commit 4bc1edc

Please sign in to comment.