Explorar o código

Merge branch 'feature/lcd_support_esp32h2' into 'master'

lcd: driver support for esp32h2

Closes IDF-6213 and IDF-6674

See merge request espressif/esp-idf!22299
morris %!s(int64=3) %!d(string=hai) anos
pai
achega
8ff376537c

+ 1 - 4
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.

+ 0 - 4
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"

+ 2 - 2
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.

+ 2 - 2
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.

+ 12 - 1
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)
 

+ 5 - 1
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));
 }
 

+ 0 - 1
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

+ 1 - 6
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:

+ 2 - 2
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
 

+ 2 - 2
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
 

+ 2 - 2
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