Skip to content

Commit

Permalink
feat(lcd): Add patch for ST77903 for IDF v5.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Horion0415 committed Jan 23, 2024
1 parent 996917b commit e891a7d
Show file tree
Hide file tree
Showing 9 changed files with 4,845 additions and 45 deletions.
38 changes: 29 additions & 9 deletions .gitlab/ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,21 @@ build_example_display_lcd_qspi_without_ram:
parallel:
matrix:
- IMAGE: espressif/idf:v5.1.2
- IMAGE: espressif/idf:release-v5.2
before_script:
- export PATCH_PATH=${IOT_SOLUTION_PATH}/examples/display/lcd/qspi_without_ram/patch/support_qspi_without_ram_a9349f4ad4.patch
- cd "$(dirname $(whereis idf.py | awk -F ' ' '{print $2}'))/.."
- git checkout a9349f4ad4
- git submodule update --init --recursive
- |
if [[ "$IMAGE" == "espressif/idf:release-v5.2" ]]; then
export PATCH_PATH="${IOT_SOLUTION_PATH}/examples/display/lcd/qspi_without_ram/patch/support_qspi_without_ram_a9349f4ad4.patch"
cd "$(dirname "$(whereis idf.py | awk -F ' ' '{print $2}')")/.."
git checkout a9349f4ad4
git submodule update --init --recursive
./install.sh
. ./export.sh
else
export PATCH_PATH="${IOT_SOLUTION_PATH}/examples/display/lcd/qspi_without_ram/patch/support_qspi_without_ram_v5.1.2.patch"
cd "$(dirname "$(whereis idf.py | awk -F ' ' '{print $2}')")/.."
git submodule update --init --recursive
fi
- git apply ${PATCH_PATH}
- cd ${IOT_SOLUTION_PATH}
variables:
Expand Down Expand Up @@ -635,12 +645,22 @@ build_components_display_lcd_esp_lcd_st77903_test_apps:
- .rules:build:components_display_lcd_esp_lcd_st77903_test_apps
parallel:
matrix:
- IMAGE: espressif/idf:latest
- IMAGE: espressif/idf:v5.1.2
- IMAGE: espressif/idf:release-v5.2
before_script:
- export PATCH_PATH=${IOT_SOLUTION_PATH}/examples/display/lcd/qspi_without_ram/patch/support_qspi_without_ram_a9349f4ad4.patch
- cd "$(dirname $(whereis idf.py | awk -F ' ' '{print $2}'))/.."
- git checkout a9349f4ad4
- git submodule update --init --recursive
- |
if [[ "$IMAGE" == "espressif/idf:release-v5.2" ]]; then
export PATCH_PATH="${IOT_SOLUTION_PATH}/examples/display/lcd/qspi_without_ram/patch/support_qspi_without_ram_a9349f4ad4.patch"
cd "$(dirname "$(whereis idf.py | awk -F ' ' '{print $2}')")/.."
git checkout a9349f4ad4
git submodule update --init --recursive
./install.sh
. ./export.sh
else
export PATCH_PATH="${IOT_SOLUTION_PATH}/examples/display/lcd/qspi_without_ram/patch/support_qspi_without_ram_v5.1.2.patch"
cd "$(dirname "$(whereis idf.py | awk -F ' ' '{print $2}')")/.."
git submodule update --init --recursive
fi
- git apply ${PATCH_PATH}
- cd ${IOT_SOLUTION_PATH}
variables:
Expand Down
39 changes: 19 additions & 20 deletions .gitlab/ci/target_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -392,26 +392,25 @@ components_test_esp_lcd_st7701:
TEST_FOLDER: components/display/lcd/esp_lcd_st7701
TEST_ENV: esp32_s3_lcd_ev_board

# Diable due to lack IDF release-v5.2 docker
# components_test_esp_lcd_st77903:
# extends:
# - .pytest_template
# - .rules:build:components_display_lcd_esp_lcd_st77903_test_apps
# needs:
# - job: "build_components_display_lcd_esp_lcd_st77903_test_apps"
# artifacts: true
# optional: false
# parallel:
# matrix:
# - IDF_VERSION: "5.2"
# 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
# TEST_ENV: esp32_s3_lcd_ev_board
components_test_esp_lcd_st77903:
extends:
- .pytest_template
- .rules:build:components_display_lcd_esp_lcd_st77903_test_apps
needs:
- job: "build_components_display_lcd_esp_lcd_st77903_test_apps"
artifacts: true
optional: false
parallel:
matrix:
- IDF_VERSION: "5.1"
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
TEST_ENV: esp32_s3_lcd_ev_board

components_led_lightbulb_driver_test:
extends:
Expand Down
5 changes: 2 additions & 3 deletions components/.build-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ components/display/lcd/esp_lcd_st7701/test_apps:
- if: IDF_TARGET in ["esp32s3"]

components/display/lcd/esp_lcd_st77903:
disable:
- if: INCLUDE_DEFAULT == 1
reason: lack IDF release-v5.2 docker
enable:
- if: IDF_TARGET in ["esp32s3"]

components/display/lcd/esp_lcd_st77916/test_apps:
enable:
Expand Down
2 changes: 1 addition & 1 deletion components/display/lcd/esp_lcd_st77903/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ url: https://github.com/espressif/esp-iot-solution/tree/master/components/displa
repository: https://github.com/espressif/esp-iot-solution.git
issues: https://github.com/espressif/esp-iot-solution/issues
dependencies:
idf: ">=5.2"
idf: ">=5.1.0"
cmake_utilities: "0.*"
examples:
- path: ../../../../examples/display/lcd/qspi_without_ram
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## IDF Component Manager Manifest File
dependencies:
idf: ">=5.2.0"
idf: ">=5.1.0"
esp_lcd_panel_io_additions: "^1"
esp_lcd_st77903:
version: "*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@
#define TEST_LCD_QSPI_V_RES (400)
#define TEST_LCD_QSPI_BIT_PER_PIXEL (16)

#define TEST_PIN_NUM_LCD_QSPI_CS (GPIO_NUM_9)
#define TEST_PIN_NUM_LCD_QSPI_PCLK (GPIO_NUM_10)
#define TEST_PIN_NUM_LCD_QSPI_DATA0 (GPIO_NUM_11)
#define TEST_PIN_NUM_LCD_QSPI_DATA1 (GPIO_NUM_12)
#define TEST_PIN_NUM_LCD_QSPI_DATA2 (GPIO_NUM_13)
#define TEST_PIN_NUM_LCD_QSPI_DATA3 (GPIO_NUM_14)
#define TEST_PIN_NUM_LCD_QSPI_CS (GPIO_NUM_14)
#define TEST_PIN_NUM_LCD_QSPI_PCLK (GPIO_NUM_9)
#define TEST_PIN_NUM_LCD_QSPI_DATA0 (GPIO_NUM_10)
#define TEST_PIN_NUM_LCD_QSPI_DATA1 (GPIO_NUM_11)
#define TEST_PIN_NUM_LCD_QSPI_DATA2 (GPIO_NUM_12)
#define TEST_PIN_NUM_LCD_QSPI_DATA3 (GPIO_NUM_13)

#define TEST_ENABLE_LCD_READ (0)
#define TEST_LCD_REG_RDDST (0x09)
#define TEST_LCD_REG_VALUE (0x00265284ULL)

#if SOC_LCD_RGB_SUPPORTED
#define TEST_LCD_RGB_H_RES (320)
Expand Down Expand Up @@ -72,6 +76,7 @@ static void test_draw_bitmap(esp_lcd_panel_handle_t panel_handle, uint16_t h_res
uint16_t row_line = v_res / bits_per_pixel;
uint8_t byte_per_pixel = bits_per_pixel / 8;
uint8_t *color = (uint8_t *)heap_caps_calloc(1, row_line * h_res * byte_per_pixel, MALLOC_CAP_DMA);
TEST_ASSERT_NOT_NULL(color);
for (int j = 0; j < bits_per_pixel; j++) {
for (int i = 0; i < row_line * h_res; i++) {
for (int k = 0; k < byte_per_pixel; k++) {
Expand All @@ -88,7 +93,7 @@ static void test_draw_bitmap(esp_lcd_panel_handle_t panel_handle, uint16_t h_res
vTaskDelay(pdMS_TO_TICKS(TEST_DELAY_TIME_MS));
}

TEST_CASE("test st77903 to draw color bar with QSPI interface", "[st77903][qspi]")
TEST_CASE("test st77903 to draw color bar with QSPI interface", "[st77903][qspi][write]")
{
ESP_LOGI(TAG, "Install st77903 panel driver");
esp_lcd_panel_handle_t panel_handle = NULL;
Expand Down Expand Up @@ -121,7 +126,6 @@ TEST_CASE("test st77903 to draw color bar with QSPI interface", "[st77903][qspi]
};
TEST_ESP_OK(esp_lcd_new_panel_st77903(NULL, &panel_config, &panel_handle));
TEST_ESP_OK(esp_lcd_panel_reset(panel_handle));
TEST_ESP_OK(esp_lcd_panel_mirror(panel_handle, true, false));
TEST_ESP_OK(esp_lcd_panel_disp_on_off(panel_handle, true));
TEST_ESP_OK(esp_lcd_panel_init(panel_handle));

Expand All @@ -137,6 +141,56 @@ TEST_CASE("test st77903 to draw color bar with QSPI interface", "[st77903][qspi]
TEST_ESP_OK(esp_lcd_panel_del(panel_handle));
}

#if TEST_ENABLE_LCD_READ
TEST_CASE("test st77903 to read register with QSPI interface", "[st77903][qspi][read]")
{
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(TEST_LCD_HOST,
TEST_PIN_NUM_LCD_QSPI_CS,
TEST_PIN_NUM_LCD_QSPI_PCLK,
TEST_PIN_NUM_LCD_QSPI_DATA0,
TEST_PIN_NUM_LCD_QSPI_DATA1,
TEST_PIN_NUM_LCD_QSPI_DATA2,
TEST_PIN_NUM_LCD_QSPI_DATA3,
1,
TEST_LCD_QSPI_H_RES,
TEST_LCD_QSPI_V_RES);
qspi_config.flags.enable_read_reg = 1;
#if CONFIG_IDF_TARGET_ESP32C6
qspi_config.flags.fb_in_psram = 0;
qspi_config.trans_pool_num = 2;
#endif
st77903_vendor_config_t vendor_config = {
.qspi_config = &qspi_config,
.flags = {
.use_qspi_interface = 1,
.mirror_by_cmd = 1,
},
};
const esp_lcd_panel_dev_config_t panel_config = {
.reset_gpio_num = TEST_PIN_NUM_LCD_RST,
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_BGR,
.bits_per_pixel = TEST_LCD_QSPI_BIT_PER_PIXEL,
.vendor_config = &vendor_config,
};
TEST_ESP_OK(esp_lcd_new_panel_st77903(NULL, &panel_config, &panel_handle));
TEST_ESP_OK(esp_lcd_panel_reset(panel_handle));
TEST_ESP_OK(esp_lcd_panel_disp_on_off(panel_handle, true));
TEST_ESP_OK(esp_lcd_panel_init(panel_handle));

test_draw_bitmap(panel_handle, TEST_LCD_QSPI_H_RES, TEST_LCD_QSPI_V_RES, TEST_LCD_QSPI_BIT_PER_PIXEL, true);
vTaskDelay(pdMS_TO_TICKS(TEST_DELAY_TIME_MS));

int reg_value = 0;
TEST_ESP_OK(esp_lcd_st77903_qspi_read_reg(panel_handle, TEST_LCD_REG_RDDST, (uint8_t *)&reg_value, sizeof(reg_value), portMAX_DELAY));
ESP_LOGI(TAG, "Read register 0x%02x value: 0x%08x", TEST_LCD_REG_RDDST, reg_value);
TEST_ASSERT_TRUE(reg_value == TEST_LCD_REG_VALUE);

TEST_ESP_OK(esp_lcd_panel_del(panel_handle));
}
#endif

#if SOC_LCD_RGB_SUPPORTED
TEST_CASE("test st77903 to draw color bar with RGB interface", "[st77903][rgb]")
{
Expand Down
10 changes: 8 additions & 2 deletions examples/display/lcd/qspi_without_ram/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ This example uses the [esp_timer](https://docs.espressif.com/projects/esp-idf/en

## ESP-IDF Required

The ST77903 driver relies on some new features that have not yet been merged into `ESP-IDF`. To successfully compile the example, please follow the steps to apply the patch:
The ST77903 driver relies on some new features that have not yet been merged into `ESP-IDF`. Currently, we have patches for two ESP-IDF commit versions: a9349f4ad4 and tags/v5.1.2. To successfully compile the example, please follow the steps to apply the patch:

1. Get the `release/v5.2` or `master` branch of ESP-IDF.
**If choose ESP-IDF commit a9349f4ad4**
1. Get the `release/v5.2` branch of ESP-IDF.

2. Go to the root folder of ESP-IDF, run the following commands and swtich to the commit **a9349f4ad4**. If the commit can't be switched, please update the branch.

Expand All @@ -31,6 +32,11 @@ git submodule update --init --recursive

3. Run the command `git apply <path_of_patch>/support_qspi_without_ram_a9349f4ad4.patch` to apply the [patch](patch/support_qspi_without_ram_a9349f4ad4.patch).

**If choose ESP-IDF commit v5.1.2**
1. Get the `v5.1.2` version of ESP-IDF.

2. Run the command `git apply <path_of_patch>/support_qspi_without_ram_v5.1.2.patch` to apply the [patch](patch/support_qspi_without_ram_v5.1.2.patch).

### Hardware Required

* An ESP32-S3R2 or ESP32-S3R8 development board
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies:
lvgl/lvgl: "^8.3.0"
idf:
version: ">=5.2.0"
version: ">=5.1.0"
esp_lcd_st77903:
version: "*"
override_path: "../../../../../components/display/lcd/esp_lcd_st77903"
Loading

0 comments on commit e891a7d

Please sign in to comment.