From ad84b61e490cf1671984e7a52997d5011c5eb7be Mon Sep 17 00:00:00 2001 From: morris Date: Thu, 11 Jan 2024 18:25:08 +0800 Subject: [PATCH] change(esp_lcd): rearrange the esp_lcd folder by types --- components/esp_lcd/CMakeLists.txt | 23 ++++++++++++------- components/esp_lcd/Kconfig | 1 + .../{src => i2c}/esp_lcd_panel_io_i2c_v1.c | 0 .../{src => i2c}/esp_lcd_panel_io_i2c_v2.c | 0 .../{src => i80}/esp_lcd_panel_io_i2s.c | 0 .../{src => i80}/esp_lcd_panel_io_i80.c | 0 .../{src => priv_include}/esp_lcd_common.h | 0 .../esp_lcd/{src => rgb}/esp_lcd_panel_rgb.c | 0 .../{ => rgb}/include/esp_lcd_panel_rgb.h | 0 .../{src => spi}/esp_lcd_panel_io_spi.c | 0 .../esp_lcd/src/esp_lcd_panel_nt35510.c | 2 +- components/esp_lcd/src/esp_lcd_panel_ops.c | 1 + components/esp_lcd/src/esp_lcd_panel_st7789.c | 2 +- .../test_apps/i2c_lcd/main/CMakeLists.txt | 2 +- .../test_apps/spi_lcd/main/CMakeLists.txt | 2 +- docs/doxygen/Doxyfile | 1 - docs/doxygen/Doxyfile_esp32s3 | 1 + docs/en/api-reference/peripherals/lcd.rst | 5 +++- 18 files changed, 26 insertions(+), 14 deletions(-) rename components/esp_lcd/{src => i2c}/esp_lcd_panel_io_i2c_v1.c (100%) rename components/esp_lcd/{src => i2c}/esp_lcd_panel_io_i2c_v2.c (100%) rename components/esp_lcd/{src => i80}/esp_lcd_panel_io_i2s.c (100%) rename components/esp_lcd/{src => i80}/esp_lcd_panel_io_i80.c (100%) rename components/esp_lcd/{src => priv_include}/esp_lcd_common.h (100%) rename components/esp_lcd/{src => rgb}/esp_lcd_panel_rgb.c (100%) rename components/esp_lcd/{ => rgb}/include/esp_lcd_panel_rgb.h (100%) rename components/esp_lcd/{src => spi}/esp_lcd_panel_io_spi.c (100%) diff --git a/components/esp_lcd/CMakeLists.txt b/components/esp_lcd/CMakeLists.txt index d748393fab..bffe85979f 100644 --- a/components/esp_lcd/CMakeLists.txt +++ b/components/esp_lcd/CMakeLists.txt @@ -6,27 +6,34 @@ endif() set(srcs "src/esp_lcd_common.c" "src/esp_lcd_panel_io.c" - "src/esp_lcd_panel_io_i2c_v1.c" - "src/esp_lcd_panel_io_i2c_v2.c" - "src/esp_lcd_panel_io_spi.c" "src/esp_lcd_panel_nt35510.c" "src/esp_lcd_panel_ssd1306.c" "src/esp_lcd_panel_st7789.c" "src/esp_lcd_panel_ops.c") set(includes "include" "interface") -set(priv_requires "esp_mm" "esp_psram") +set(priv_requires "esp_mm" "esp_psram" "esp_pm" "esp_driver_spi" "esp_driver_i2s") +set(public_requires "driver" "esp_driver_gpio" "esp_driver_i2c") + +if(CONFIG_SOC_I2C_SUPPORTED) + list(APPEND srcs "i2c/esp_lcd_panel_io_i2c_v1.c" "i2c/esp_lcd_panel_io_i2c_v2.c") +endif() + +if(CONFIG_SOC_GPSPI_SUPPORTED) + list(APPEND srcs "spi/esp_lcd_panel_io_spi.c") +endif() if(CONFIG_SOC_I2S_LCD_I80_VARIANT) - list(APPEND srcs "src/esp_lcd_panel_io_i2s.c") - list(APPEND priv_requires "esp_driver_i2s") + list(APPEND srcs "i80/esp_lcd_panel_io_i2s.c") endif() if(CONFIG_SOC_LCDCAM_SUPPORTED) - list(APPEND srcs "src/esp_lcd_panel_io_i80.c" "src/esp_lcd_panel_rgb.c") + list(APPEND includes "rgb/include") + list(APPEND srcs "i80/esp_lcd_panel_io_i80.c" "rgb/esp_lcd_panel_rgb.c") endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${includes} + PRIV_INCLUDE_DIRS "priv_include" PRIV_REQUIRES ${priv_requires} - REQUIRES driver esp_driver_gpio esp_driver_spi esp_driver_i2c + REQUIRES ${public_requires} LDFRAGMENTS linker.lf) diff --git a/components/esp_lcd/Kconfig b/components/esp_lcd/Kconfig index 25a77c8376..b72408b5ed 100644 --- a/components/esp_lcd/Kconfig +++ b/components/esp_lcd/Kconfig @@ -3,6 +3,7 @@ menu "LCD and Touch Panel" menu "LCD Peripheral Configuration" config LCD_PANEL_IO_FORMAT_BUF_SIZE + depends on SOC_LCD_I80_SUPPORTED int "LCD panel io format buffer size" default 32 help diff --git a/components/esp_lcd/src/esp_lcd_panel_io_i2c_v1.c b/components/esp_lcd/i2c/esp_lcd_panel_io_i2c_v1.c similarity index 100% rename from components/esp_lcd/src/esp_lcd_panel_io_i2c_v1.c rename to components/esp_lcd/i2c/esp_lcd_panel_io_i2c_v1.c diff --git a/components/esp_lcd/src/esp_lcd_panel_io_i2c_v2.c b/components/esp_lcd/i2c/esp_lcd_panel_io_i2c_v2.c similarity index 100% rename from components/esp_lcd/src/esp_lcd_panel_io_i2c_v2.c rename to components/esp_lcd/i2c/esp_lcd_panel_io_i2c_v2.c diff --git a/components/esp_lcd/src/esp_lcd_panel_io_i2s.c b/components/esp_lcd/i80/esp_lcd_panel_io_i2s.c similarity index 100% rename from components/esp_lcd/src/esp_lcd_panel_io_i2s.c rename to components/esp_lcd/i80/esp_lcd_panel_io_i2s.c diff --git a/components/esp_lcd/src/esp_lcd_panel_io_i80.c b/components/esp_lcd/i80/esp_lcd_panel_io_i80.c similarity index 100% rename from components/esp_lcd/src/esp_lcd_panel_io_i80.c rename to components/esp_lcd/i80/esp_lcd_panel_io_i80.c diff --git a/components/esp_lcd/src/esp_lcd_common.h b/components/esp_lcd/priv_include/esp_lcd_common.h similarity index 100% rename from components/esp_lcd/src/esp_lcd_common.h rename to components/esp_lcd/priv_include/esp_lcd_common.h diff --git a/components/esp_lcd/src/esp_lcd_panel_rgb.c b/components/esp_lcd/rgb/esp_lcd_panel_rgb.c similarity index 100% rename from components/esp_lcd/src/esp_lcd_panel_rgb.c rename to components/esp_lcd/rgb/esp_lcd_panel_rgb.c diff --git a/components/esp_lcd/include/esp_lcd_panel_rgb.h b/components/esp_lcd/rgb/include/esp_lcd_panel_rgb.h similarity index 100% rename from components/esp_lcd/include/esp_lcd_panel_rgb.h rename to components/esp_lcd/rgb/include/esp_lcd_panel_rgb.h diff --git a/components/esp_lcd/src/esp_lcd_panel_io_spi.c b/components/esp_lcd/spi/esp_lcd_panel_io_spi.c similarity index 100% rename from components/esp_lcd/src/esp_lcd_panel_io_spi.c rename to components/esp_lcd/spi/esp_lcd_panel_io_spi.c diff --git a/components/esp_lcd/src/esp_lcd_panel_nt35510.c b/components/esp_lcd/src/esp_lcd_panel_nt35510.c index 7fbe7ab37d..aa2a472b23 100644 --- a/components/esp_lcd/src/esp_lcd_panel_nt35510.c +++ b/components/esp_lcd/src/esp_lcd_panel_nt35510.c @@ -80,7 +80,7 @@ esp_lcd_new_panel_nt35510(const esp_lcd_panel_io_handle_t io, const esp_lcd_pane nt35510->madctl_val |= LCD_CMD_BGR_BIT; break; default: - ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported color space"); + ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported RGB element order"); break; } diff --git a/components/esp_lcd/src/esp_lcd_panel_ops.c b/components/esp_lcd/src/esp_lcd_panel_ops.c index 1e03be92d2..acef06ce4e 100644 --- a/components/esp_lcd/src/esp_lcd_panel_ops.c +++ b/components/esp_lcd/src/esp_lcd_panel_ops.c @@ -31,6 +31,7 @@ esp_err_t esp_lcd_panel_del(esp_lcd_panel_handle_t panel) esp_err_t esp_lcd_panel_draw_bitmap(esp_lcd_panel_handle_t panel, int x_start, int y_start, int x_end, int y_end, const void *color_data) { ESP_RETURN_ON_FALSE(panel, ESP_ERR_INVALID_ARG, TAG, "invalid panel handle"); + ESP_RETURN_ON_FALSE(panel->draw_bitmap, ESP_ERR_NOT_SUPPORTED, TAG, "draw_bitmap is not supported by this panel"); return panel->draw_bitmap(panel, x_start, y_start, x_end, y_end, color_data); } diff --git a/components/esp_lcd/src/esp_lcd_panel_st7789.c b/components/esp_lcd/src/esp_lcd_panel_st7789.c index fc43f91582..e6cd329d13 100644 --- a/components/esp_lcd/src/esp_lcd_panel_st7789.c +++ b/components/esp_lcd/src/esp_lcd_panel_st7789.c @@ -85,7 +85,7 @@ esp_lcd_new_panel_st7789(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel st7789->madctl_val |= LCD_CMD_BGR_BIT; break; default: - ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported color space"); + ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported RGB element order"); break; } diff --git a/components/esp_lcd/test_apps/i2c_lcd/main/CMakeLists.txt b/components/esp_lcd/test_apps/i2c_lcd/main/CMakeLists.txt index aa4f3147a3..1b5ee568b6 100644 --- a/components/esp_lcd/test_apps/i2c_lcd/main/CMakeLists.txt +++ b/components/esp_lcd/test_apps/i2c_lcd/main/CMakeLists.txt @@ -4,5 +4,5 @@ set(srcs "test_app_main.c" # In order for the cases defined by `TEST_CASE` to be linked into the final elf, # the component can be registered as WHOLE_ARCHIVE idf_component_register(SRCS ${srcs} - PRIV_REQUIRES esp_lcd unity driver + PRIV_REQUIRES esp_lcd unity esp_driver_i2c WHOLE_ARCHIVE) diff --git a/components/esp_lcd/test_apps/spi_lcd/main/CMakeLists.txt b/components/esp_lcd/test_apps/spi_lcd/main/CMakeLists.txt index 72a8ae1d4a..77a57a2cc4 100644 --- a/components/esp_lcd/test_apps/spi_lcd/main/CMakeLists.txt +++ b/components/esp_lcd/test_apps/spi_lcd/main/CMakeLists.txt @@ -4,5 +4,5 @@ set(srcs "test_app_main.c" # In order for the cases defined by `TEST_CASE` to be linked into the final elf, # the component can be registered as WHOLE_ARCHIVE idf_component_register(SRCS ${srcs} - PRIV_REQUIRES esp_lcd unity driver + PRIV_REQUIRES esp_lcd unity esp_driver_spi WHOLE_ARCHIVE) diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index d60e0ec0c5..e99f39df8c 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -174,7 +174,6 @@ INPUT = \ $(PROJECT_PATH)/components/esp_hw_support/include/esp_sleep.h \ $(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_panel_io.h \ $(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_panel_ops.h \ - $(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_panel_rgb.h \ $(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_panel_vendor.h \ $(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_panel_dev.h \ $(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_panel_ssd1306.h \ diff --git a/docs/doxygen/Doxyfile_esp32s3 b/docs/doxygen/Doxyfile_esp32s3 index 2f77282841..5671ce1fae 100644 --- a/docs/doxygen/Doxyfile_esp32s3 +++ b/docs/doxygen/Doxyfile_esp32s3 @@ -1,5 +1,6 @@ INPUT += \ $(PROJECT_PATH)/components/driver/touch_sensor/$(IDF_TARGET)/include/driver/touch_sensor.h \ + $(PROJECT_PATH)/components/esp_lcd/rgb/include/esp_lcd_panel_rgb.h \ $(PROJECT_PATH)/components/soc/$(IDF_TARGET)/include/soc/touch_sensor_channel.h \ $(PROJECT_PATH)/components/ulp/ulp_common/include/$(IDF_TARGET)/ulp_common_defs.h \ $(PROJECT_PATH)/components/ulp/ulp_fsm/include/$(IDF_TARGET)/ulp.h \ diff --git a/docs/en/api-reference/peripherals/lcd.rst b/docs/en/api-reference/peripherals/lcd.rst index 20f48d148a..674ab3525c 100644 --- a/docs/en/api-reference/peripherals/lcd.rst +++ b/docs/en/api-reference/peripherals/lcd.rst @@ -498,5 +498,8 @@ API Reference .. include-build-file:: inc/esp_lcd_types.inc .. include-build-file:: inc/esp_lcd_panel_io.inc .. include-build-file:: inc/esp_lcd_panel_ops.inc -.. include-build-file:: inc/esp_lcd_panel_rgb.inc .. include-build-file:: inc/esp_lcd_panel_vendor.inc + +.. only:: SOC_LCD_RGB_SUPPORTED + + .. include-build-file:: inc/esp_lcd_panel_rgb.inc