From c2c4fbff13d202df8bd4b17e16ce3bd5493cd982 Mon Sep 17 00:00:00 2001 From: morris Date: Thu, 9 Feb 2023 19:01:40 +0800 Subject: [PATCH] lcd: driver support for esp32h2 --- components/esp_lcd/.build-test-rules.yml | 5 +---- components/esp_lcd/CMakeLists.txt | 4 ---- components/esp_lcd/test_apps/i2c_lcd/README.md | 4 ++-- components/esp_lcd/test_apps/spi_lcd/README.md | 4 ++-- .../esp_lcd/test_apps/spi_lcd/main/test_spi_board.h | 13 ++++++++++++- .../test_apps/spi_lcd/main/test_spi_lcd_panel.c | 6 +++++- docs/docs_not_updated/esp32h2.txt | 1 - examples/peripherals/.build-test-rules.yml | 7 +------ examples/peripherals/lcd/i2c_oled/README.md | 4 ++-- examples/peripherals/lcd/spi_lcd_touch/README.md | 4 ++-- examples/peripherals/lcd/tjpgd/README.md | 4 ++-- 11 files changed, 29 insertions(+), 27 deletions(-) diff --git a/components/esp_lcd/.build-test-rules.yml b/components/esp_lcd/.build-test-rules.yml index b1d724d01e..bf0d5f66a5 100644 --- a/components/esp_lcd/.build-test-rules.yml +++ b/components/esp_lcd/.build-test-rules.yml @@ -2,8 +2,7 @@ components/esp_lcd/test_apps/i2c_lcd: disable: - - if: SOC_I2C_SUPPORTED != 1 or IDF_TARGET == "esp32h2" - reason: LCD has not been supported on esp32h2, IDF-6213 + - if: SOC_I2C_SUPPORTED != 1 components/esp_lcd/test_apps/i80_lcd: disable: @@ -16,5 +15,3 @@ components/esp_lcd/test_apps/rgb_lcd: components/esp_lcd/test_apps/spi_lcd: disable: - if: SOC_GPSPI_SUPPORTED != 1 - - if: IDF_TARGET == "esp32h2" - reason: Not tested yet. diff --git a/components/esp_lcd/CMakeLists.txt b/components/esp_lcd/CMakeLists.txt index f7a5e1d520..cb1cbc99e1 100644 --- a/components/esp_lcd/CMakeLists.txt +++ b/components/esp_lcd/CMakeLists.txt @@ -1,7 +1,3 @@ -if(IDF_TARGET STREQUAL "esp32h2") - return() #ESP32H2-TODO: IDF-6213 -endif() - set(srcs "src/esp_lcd_common.c" "src/esp_lcd_panel_io.c" "src/esp_lcd_panel_io_i2c.c" diff --git a/components/esp_lcd/test_apps/i2c_lcd/README.md b/components/esp_lcd/test_apps/i2c_lcd/README.md index b99fe2b5eb..de65dcc35b 100644 --- a/components/esp_lcd/test_apps/i2c_lcd/README.md +++ b/components/esp_lcd/test_apps/i2c_lcd/README.md @@ -1,4 +1,4 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | This test app is used to test LCDs with I2C interface. diff --git a/components/esp_lcd/test_apps/spi_lcd/README.md b/components/esp_lcd/test_apps/spi_lcd/README.md index 0c052495c6..f6872a4414 100644 --- a/components/esp_lcd/test_apps/spi_lcd/README.md +++ b/components/esp_lcd/test_apps/spi_lcd/README.md @@ -1,4 +1,4 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | This test app is used to test LCDs with SPI interface. diff --git a/components/esp_lcd/test_apps/spi_lcd/main/test_spi_board.h b/components/esp_lcd/test_apps/spi_lcd/main/test_spi_board.h index 2bb9c8a755..7c6d24c36b 100644 --- a/components/esp_lcd/test_apps/spi_lcd/main/test_spi_board.h +++ b/components/esp_lcd/test_apps/spi_lcd/main/test_spi_board.h @@ -1,10 +1,12 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include "sdkconfig.h" + #ifdef __cplusplus extern "C" { #endif @@ -12,6 +14,14 @@ extern "C" { #define TEST_LCD_H_RES 240 #define TEST_LCD_V_RES 280 +#if CONFIG_IDF_TARGET_ESP32H2 +#define TEST_LCD_BK_LIGHT_GPIO 10 +#define TEST_LCD_RST_GPIO 5 +#define TEST_LCD_CS_GPIO 3 +#define TEST_LCD_DC_GPIO 4 +#define TEST_LCD_PCLK_GPIO 2 +#define TEST_LCD_DATA0_GPIO 1 +#else #define TEST_LCD_BK_LIGHT_GPIO 18 #define TEST_LCD_RST_GPIO 5 #define TEST_LCD_CS_GPIO 0 @@ -25,6 +35,7 @@ extern "C" { #define TEST_LCD_DATA5_GPIO 11 #define TEST_LCD_DATA6_GPIO 12 #define TEST_LCD_DATA7_GPIO 13 +#endif #define TEST_LCD_PIXEL_CLOCK_HZ (20 * 1000 * 1000) diff --git a/components/esp_lcd/test_apps/spi_lcd/main/test_spi_lcd_panel.c b/components/esp_lcd/test_apps/spi_lcd/main/test_spi_lcd_panel.c index 382e2bc9ad..9b575e8c7b 100644 --- a/components/esp_lcd/test_apps/spi_lcd/main/test_spi_lcd_panel.c +++ b/components/esp_lcd/test_apps/spi_lcd/main/test_spi_lcd_panel.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -37,6 +37,7 @@ void test_spi_lcd_common_initialize(esp_lcd_panel_io_handle_t *io_handle, esp_lc .quadhd_io_num = -1, .max_transfer_sz = TEST_LCD_H_RES * TEST_LCD_V_RES * sizeof(uint16_t) }; +#if SOC_SPI_SUPPORT_OCT if (oct_mode) { buscfg.data1_io_num = TEST_LCD_DATA1_GPIO; buscfg.data2_io_num = TEST_LCD_DATA2_GPIO; @@ -47,6 +48,7 @@ void test_spi_lcd_common_initialize(esp_lcd_panel_io_handle_t *io_handle, esp_lc buscfg.data7_io_num = TEST_LCD_DATA7_GPIO; buscfg.flags = SPICOMMON_BUSFLAG_OCTAL; } +#endif TEST_ESP_OK(spi_bus_initialize(TEST_SPI_HOST_ID, &buscfg, SPI_DMA_CH_AUTO)); esp_lcd_panel_io_spi_config_t io_config = { @@ -60,10 +62,12 @@ void test_spi_lcd_common_initialize(esp_lcd_panel_io_handle_t *io_handle, esp_lc .on_color_trans_done = on_color_trans_done, .user_ctx = user_data, }; +#if SOC_SPI_SUPPORT_OCT if (oct_mode) { io_config.flags.octal_mode = 1; io_config.spi_mode = 3; } +#endif TEST_ESP_OK(esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)TEST_SPI_HOST_ID, &io_config, io_handle)); } diff --git a/docs/docs_not_updated/esp32h2.txt b/docs/docs_not_updated/esp32h2.txt index fa80cd12f5..22f297b85f 100644 --- a/docs/docs_not_updated/esp32h2.txt +++ b/docs/docs_not_updated/esp32h2.txt @@ -78,7 +78,6 @@ api-reference/peripherals/sdspi_host api-reference/peripherals/dac api-reference/peripherals/i2s api-reference/peripherals/touch_element -api-reference/peripherals/lcd api-reference/peripherals/secure_element api-reference/peripherals/temp_sensor api-reference/peripherals/spi_features diff --git a/examples/peripherals/.build-test-rules.yml b/examples/peripherals/.build-test-rules.yml index 0d0e6dd9ec..88cd734c35 100644 --- a/examples/peripherals/.build-test-rules.yml +++ b/examples/peripherals/.build-test-rules.yml @@ -66,8 +66,7 @@ examples/peripherals/i2s/i2s_recorder: examples/peripherals/lcd/i2c_oled: disable: - - if: SOC_I2C_SUPPORTED != 1 or IDF_TARGET == "esp32h2" - reason: LCD has not been supported on esp32h2, IDF-6213 + - if: SOC_I2C_SUPPORTED != 1 examples/peripherals/lcd/i80_controller: disable: @@ -80,14 +79,10 @@ examples/peripherals/lcd/rgb_panel: examples/peripherals/lcd/spi_lcd_touch: disable: - if: SOC_GPSPI_SUPPORTED != 1 - - if: IDF_TARGET == "esp32h2" - reason: Not tested yet. examples/peripherals/lcd/tjpgd: disable: - if: SOC_GPSPI_SUPPORTED != 1 - - if: IDF_TARGET == "esp32h2" - reason: Not tested yet. examples/peripherals/ledc: disable: diff --git a/examples/peripherals/lcd/i2c_oled/README.md b/examples/peripherals/lcd/i2c_oled/README.md index 09284bb911..5d34cbbf04 100644 --- a/examples/peripherals/lcd/i2c_oled/README.md +++ b/examples/peripherals/lcd/i2c_oled/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | # I2C OLED example diff --git a/examples/peripherals/lcd/spi_lcd_touch/README.md b/examples/peripherals/lcd/spi_lcd_touch/README.md index f16cf4ebb5..804abb7aef 100644 --- a/examples/peripherals/lcd/spi_lcd_touch/README.md +++ b/examples/peripherals/lcd/spi_lcd_touch/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | # SPI LCD and Touch Panel Example diff --git a/examples/peripherals/lcd/tjpgd/README.md b/examples/peripherals/lcd/tjpgd/README.md index 6b25c19db0..4f21901f16 100644 --- a/examples/peripherals/lcd/tjpgd/README.md +++ b/examples/peripherals/lcd/tjpgd/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | ## LCD tjpgd example