From 406e4ac4dc24090d18ec96cfc8047fde128a9b46 Mon Sep 17 00:00:00 2001 From: laokaiyao Date: Thu, 9 Nov 2023 16:54:18 +0800 Subject: [PATCH] refactor(ana_cmpr): make analog comparator driver as component --- components/driver/CMakeLists.txt | 11 +------- components/driver/Kconfig | 25 ------------------- components/driver/linker.lf | 4 --- .../driver/test_apps/.build-test-rules.yml | 8 ------ components/esp_driver_ana_cmpr/CMakeLists.txt | 15 +++++++++++ components/esp_driver_ana_cmpr/Kconfig | 24 ++++++++++++++++++ .../ana_cmpr.c | 10 ++++---- .../ana_cmpr_etm.c | 0 .../ana_cmpr_private.h | 0 .../include/driver/ana_cmpr.h | 2 +- .../include/driver/ana_cmpr_etm.h | 0 .../include/driver/ana_cmpr_types.h | 2 +- components/esp_driver_ana_cmpr/linker.lf | 7 ++++++ .../test_apps/.build-test-rules.yml | 12 +++++++++ .../analog_comparator/CMakeLists.txt | 2 +- .../test_apps/analog_comparator/README.md | 0 .../analog_comparator/main/CMakeLists.txt | 2 +- .../analog_comparator/main/test_ana_cmpr.c | 0 .../analog_comparator/main/test_ana_cmpr.h | 0 .../main/test_ana_cmpr_common.c | 0 .../main/test_ana_cmpr_iram.c | 0 .../analog_comparator/main/test_app_main.c | 0 .../analog_comparator/pytest_ana_cmpr.py | 0 .../analog_comparator/sdkconfig.ci.iram_safe | 0 .../analog_comparator/sdkconfig.ci.release | 0 .../analog_comparator/sdkconfig.defaults | 0 .../test_apps/.build-test-rules.yml | 2 +- .../test_apps/etm/main/CMakeLists.txt | 4 +-- docs/doxygen/Doxyfile | 6 ++--- .../release-5.x/5.3/peripherals.rst | 1 + .../release-5.x/5.3/peripherals.rst | 1 + examples/peripherals/.build-test-rules.yml | 3 +++ .../analog_comparator/CMakeLists.txt | 2 ++ .../analog_comparator/main/CMakeLists.txt | 1 + 34 files changed, 82 insertions(+), 62 deletions(-) create mode 100644 components/esp_driver_ana_cmpr/CMakeLists.txt create mode 100644 components/esp_driver_ana_cmpr/Kconfig rename components/{driver/analog_comparator => esp_driver_ana_cmpr}/ana_cmpr.c (97%) rename components/{driver/analog_comparator => esp_driver_ana_cmpr}/ana_cmpr_etm.c (100%) rename components/{driver/analog_comparator => esp_driver_ana_cmpr}/ana_cmpr_private.h (100%) rename components/{driver/analog_comparator => esp_driver_ana_cmpr}/include/driver/ana_cmpr.h (98%) rename components/{driver/analog_comparator => esp_driver_ana_cmpr}/include/driver/ana_cmpr_etm.h (100%) rename components/{driver/analog_comparator => esp_driver_ana_cmpr}/include/driver/ana_cmpr_types.h (96%) create mode 100644 components/esp_driver_ana_cmpr/linker.lf create mode 100644 components/esp_driver_ana_cmpr/test_apps/.build-test-rules.yml rename components/{driver => esp_driver_ana_cmpr}/test_apps/analog_comparator/CMakeLists.txt (86%) rename components/{driver => esp_driver_ana_cmpr}/test_apps/analog_comparator/README.md (100%) rename components/{driver => esp_driver_ana_cmpr}/test_apps/analog_comparator/main/CMakeLists.txt (78%) rename components/{driver => esp_driver_ana_cmpr}/test_apps/analog_comparator/main/test_ana_cmpr.c (100%) rename components/{driver => esp_driver_ana_cmpr}/test_apps/analog_comparator/main/test_ana_cmpr.h (100%) rename components/{driver => esp_driver_ana_cmpr}/test_apps/analog_comparator/main/test_ana_cmpr_common.c (100%) rename components/{driver => esp_driver_ana_cmpr}/test_apps/analog_comparator/main/test_ana_cmpr_iram.c (100%) rename components/{driver => esp_driver_ana_cmpr}/test_apps/analog_comparator/main/test_app_main.c (100%) rename components/{driver => esp_driver_ana_cmpr}/test_apps/analog_comparator/pytest_ana_cmpr.py (100%) rename components/{driver => esp_driver_ana_cmpr}/test_apps/analog_comparator/sdkconfig.ci.iram_safe (100%) rename components/{driver => esp_driver_ana_cmpr}/test_apps/analog_comparator/sdkconfig.ci.release (100%) rename components/{driver => esp_driver_ana_cmpr}/test_apps/analog_comparator/sdkconfig.defaults (100%) diff --git a/components/driver/CMakeLists.txt b/components/driver/CMakeLists.txt index c7778102826a..7cc47de89979 100644 --- a/components/driver/CMakeLists.txt +++ b/components/driver/CMakeLists.txt @@ -10,7 +10,6 @@ set(srcs) # Always included headers set(includes "include" "deprecated" - "analog_comparator/include" "dac/include" "i2c/include" "i2s/include" @@ -38,14 +37,6 @@ if(CONFIG_SOC_ADC_DMA_SUPPORTED) list(APPEND srcs "deprecated/adc_dma_legacy.c") endif() -# Analog comparator related source files -if(CONFIG_SOC_ANA_CMPR_SUPPORTED) - list(APPEND srcs "analog_comparator/ana_cmpr.c") - if(CONFIG_SOC_ANA_CMPR_SUPPORT_ETM) - list(APPEND srcs "analog_comparator/ana_cmpr_etm.c") - endif() -endif() - # DAC related source files if(CONFIG_SOC_DAC_SUPPORTED) list(APPEND srcs "dac/dac_oneshot.c" @@ -192,7 +183,7 @@ else() # for backward compatibility, the driver component needs to # have a public dependency on other "esp_driver_foo" components esp_driver_gpio esp_driver_pcnt esp_driver_gptimer esp_driver_spi esp_driver_mcpwm - esp_driver_sdmmc + esp_driver_sdmmc esp_driver_ana_cmpr LDFRAGMENTS ${ldfragments} ) endif() diff --git a/components/driver/Kconfig b/components/driver/Kconfig index 63365b40aec8..a5a0232794dc 100644 --- a/components/driver/Kconfig +++ b/components/driver/Kconfig @@ -120,31 +120,6 @@ menu "Driver Configurations" Note that, this option only controls the SDM driver log, won't affect other drivers. endmenu # Sigma Delta Modulator Configuration - menu "Analog Comparator Configuration" - depends on SOC_ANA_CMPR_SUPPORTED - config ANA_CMPR_ISR_IRAM_SAFE - bool "Analog comparator ISR IRAM-Safe" - default n - help - Ensure the Analog Comparator interrupt is IRAM-Safe by allowing the interrupt handler to be - executable when the cache is disabled (e.g. SPI Flash write). - - config ANA_CMPR_CTRL_FUNC_IN_IRAM - bool "Place Analog Comparator control functions into IRAM" - default n - help - Place Analog Comparator control functions (like ana_cmpr_set_internal_reference) into IRAM, - so that these functions can be IRAM-safe and able to be called in an IRAM interrupt context. - Enabling this option can improve driver performance as well. - - config ANA_CMPR_ENABLE_DEBUG_LOG - bool "Enable debug log" - default n - help - Wether to enable the debug log message for Analog Comparator driver. - Note that, this option only controls the Analog Comparator driver log, won't affect other drivers. - endmenu # Analog Comparator Configuration - orsource "./rmt/Kconfig.rmt" menu "I2S Configuration" diff --git a/components/driver/linker.lf b/components/driver/linker.lf index 6c90eff1f4cf..490c7a89ba39 100644 --- a/components/driver/linker.lf +++ b/components/driver/linker.lf @@ -3,10 +3,6 @@ archive: libdriver.a entries: if SDM_CTRL_FUNC_IN_IRAM = y: sdm: sdm_channel_set_pulse_density (noflash) - if ANA_CMPR_CTRL_FUNC_IN_IRAM = y: - ana_cmpr: ana_cmpr_set_internal_reference (noflash) - ana_cmpr: ana_cmpr_set_debounce (noflash) - ana_cmpr: ana_cmpr_set_cross_type (noflash) if DAC_CTRL_FUNC_IN_IRAM = y: dac_oneshot: dac_oneshot_output_voltage (noflash) dac_continuous: dac_continuous_write_asynchronously (noflash) diff --git a/components/driver/test_apps/.build-test-rules.yml b/components/driver/test_apps/.build-test-rules.yml index 300b2b44b216..f2cc747bac9e 100644 --- a/components/driver/test_apps/.build-test-rules.yml +++ b/components/driver/test_apps/.build-test-rules.yml @@ -1,13 +1,5 @@ # Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps -components/driver/test_apps/analog_comparator: - disable: - - if: SOC_ANA_CMPR_SUPPORTED != 1 - disable_test: - - if: IDF_TARGET == "esp32p4" - temporary: true - reason: not supported yet - components/driver/test_apps/dac_test_apps/dac: disable: - if: SOC_DAC_SUPPORTED != 1 diff --git a/components/esp_driver_ana_cmpr/CMakeLists.txt b/components/esp_driver_ana_cmpr/CMakeLists.txt new file mode 100644 index 000000000000..5fd665a33d7e --- /dev/null +++ b/components/esp_driver_ana_cmpr/CMakeLists.txt @@ -0,0 +1,15 @@ +set(srcs) + +# Analog comparator related source files +if(CONFIG_SOC_ANA_CMPR_SUPPORTED) + list(APPEND srcs "ana_cmpr.c") + if(CONFIG_SOC_ANA_CMPR_SUPPORT_ETM) + list(APPEND srcs "ana_cmpr_etm.c") + endif() +endif() + +idf_component_register(SRCS ${srcs} + INCLUDE_DIRS "include" + PRIV_REQUIRES esp_pm esp_driver_gpio + LDFRAGMENTS "linker.lf" + ) diff --git a/components/esp_driver_ana_cmpr/Kconfig b/components/esp_driver_ana_cmpr/Kconfig new file mode 100644 index 000000000000..98a8c96e5578 --- /dev/null +++ b/components/esp_driver_ana_cmpr/Kconfig @@ -0,0 +1,24 @@ +menu "ESP-Driver:Analog Comparator Configurations" + depends on SOC_ANA_CMPR_SUPPORTED + config ANA_CMPR_ISR_IRAM_SAFE + bool "Analog comparator ISR IRAM-Safe" + default n + help + Ensure the Analog Comparator interrupt is IRAM-Safe by allowing the interrupt handler to be + executable when the cache is disabled (e.g. SPI Flash write). + + config ANA_CMPR_CTRL_FUNC_IN_IRAM + bool "Place Analog Comparator control functions into IRAM" + default n + help + Place Analog Comparator control functions (like ana_cmpr_set_internal_reference) into IRAM, + so that these functions can be IRAM-safe and able to be called in an IRAM interrupt context. + Enabling this option can improve driver performance as well. + + config ANA_CMPR_ENABLE_DEBUG_LOG + bool "Enable debug log" + default n + help + Wether to enable the debug log message for Analog Comparator driver. + Note that, this option only controls the Analog Comparator driver log, won't affect other drivers. +endmenu # Analog Comparator Configuration diff --git a/components/driver/analog_comparator/ana_cmpr.c b/components/esp_driver_ana_cmpr/ana_cmpr.c similarity index 97% rename from components/driver/analog_comparator/ana_cmpr.c rename to components/esp_driver_ana_cmpr/ana_cmpr.c index f417c2a02a31..2f887286ac37 100644 --- a/components/driver/analog_comparator/ana_cmpr.c +++ b/components/esp_driver_ana_cmpr/ana_cmpr.c @@ -63,7 +63,7 @@ static const char *TAG = "ana_cmpr"; /* Global static object of the Analog Comparator unit */ static ana_cmpr_handle_t s_ana_cmpr[SOC_ANA_CMPR_NUM] = { - [0 ... (SOC_ANA_CMPR_NUM - 1)] = NULL, + [0 ...(SOC_ANA_CMPR_NUM - 1)] = NULL, }; /* Global spin lock */ @@ -149,9 +149,9 @@ esp_err_t ana_cmpr_new_unit(const ana_cmpr_config_t *config, ana_cmpr_handle_t * /* Analog clock comes from IO MUX, but IO MUX clock might be shared with other submodules as well */ ESP_GOTO_ON_ERROR(esp_clk_tree_src_get_freq_hz((soc_module_clk_t)config->clk_src, - ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, - &s_ana_cmpr[unit]->src_clk_freq_hz), - err, TAG, "get source clock frequency failed"); + ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, + &s_ana_cmpr[unit]->src_clk_freq_hz), + err, TAG, "get source clock frequency failed"); ESP_GOTO_ON_ERROR(io_mux_set_clock_source((soc_module_clk_t)(config->clk_src)), err, TAG, "potential clock source conflicts from other IOMUX peripherals"); @@ -298,7 +298,7 @@ esp_err_t ana_cmpr_register_event_callbacks(ana_cmpr_handle_t cmpr, const ana_cm intr_flags |= ESP_INTR_FLAG_SHARED; #endif // SOC_ANA_CMPR_INTR_SHARE_WITH_GPIO ESP_RETURN_ON_ERROR(esp_intr_alloc_intrstatus(ana_cmpr_periph[cmpr->unit].intr_src, intr_flags, (uint32_t)analog_cmpr_ll_get_intr_status_reg(cmpr->dev), - cmpr->intr_mask, s_ana_cmpr_default_intr_handler, cmpr, &cmpr->intr_handle), TAG, "allocate interrupt failed"); + cmpr->intr_mask, s_ana_cmpr_default_intr_handler, cmpr, &cmpr->intr_handle), TAG, "allocate interrupt failed"); } /* Save the callback group */ diff --git a/components/driver/analog_comparator/ana_cmpr_etm.c b/components/esp_driver_ana_cmpr/ana_cmpr_etm.c similarity index 100% rename from components/driver/analog_comparator/ana_cmpr_etm.c rename to components/esp_driver_ana_cmpr/ana_cmpr_etm.c diff --git a/components/driver/analog_comparator/ana_cmpr_private.h b/components/esp_driver_ana_cmpr/ana_cmpr_private.h similarity index 100% rename from components/driver/analog_comparator/ana_cmpr_private.h rename to components/esp_driver_ana_cmpr/ana_cmpr_private.h diff --git a/components/driver/analog_comparator/include/driver/ana_cmpr.h b/components/esp_driver_ana_cmpr/include/driver/ana_cmpr.h similarity index 98% rename from components/driver/analog_comparator/include/driver/ana_cmpr.h rename to components/esp_driver_ana_cmpr/include/driver/ana_cmpr.h index d10b1e0a74f5..0fbb08392753 100644 --- a/components/driver/analog_comparator/include/driver/ana_cmpr.h +++ b/components/esp_driver_ana_cmpr/include/driver/ana_cmpr.h @@ -31,7 +31,7 @@ typedef struct { int intr_priority; /*!< The interrupt priority, range 0~7, if set to 0, the driver will try to allocate an interrupt with a relative low priority (1,2,3) * otherwise the larger the higher, 7 is NMI */ struct { - uint32_t io_loop_back:1; /*!< Enable this field when the other signals that output on the comparision pins are supposed to be fed back. + uint32_t io_loop_back: 1; /*!< Enable this field when the other signals that output on the comparision pins are supposed to be fed back. * Normally used for debug/test scenario */ } flags; /*!< Analog comparator driver flags */ } ana_cmpr_config_t; diff --git a/components/driver/analog_comparator/include/driver/ana_cmpr_etm.h b/components/esp_driver_ana_cmpr/include/driver/ana_cmpr_etm.h similarity index 100% rename from components/driver/analog_comparator/include/driver/ana_cmpr_etm.h rename to components/esp_driver_ana_cmpr/include/driver/ana_cmpr_etm.h diff --git a/components/driver/analog_comparator/include/driver/ana_cmpr_types.h b/components/esp_driver_ana_cmpr/include/driver/ana_cmpr_types.h similarity index 96% rename from components/driver/analog_comparator/include/driver/ana_cmpr_types.h rename to components/esp_driver_ana_cmpr/include/driver/ana_cmpr_types.h index 978509262097..19747433630b 100644 --- a/components/driver/analog_comparator/include/driver/ana_cmpr_types.h +++ b/components/esp_driver_ana_cmpr/include/driver/ana_cmpr_types.h @@ -105,7 +105,7 @@ typedef struct { * * @return Whether a high priority task has been waken up by this callback function */ -typedef bool (*ana_cmpr_cross_cb_t) (ana_cmpr_handle_t cmpr, const ana_cmpr_cross_event_data_t *edata, void *user_ctx); +typedef bool (*ana_cmpr_cross_cb_t)(ana_cmpr_handle_t cmpr, const ana_cmpr_cross_event_data_t *edata, void *user_ctx); #ifdef __cplusplus } diff --git a/components/esp_driver_ana_cmpr/linker.lf b/components/esp_driver_ana_cmpr/linker.lf new file mode 100644 index 000000000000..c48d1eaa6e49 --- /dev/null +++ b/components/esp_driver_ana_cmpr/linker.lf @@ -0,0 +1,7 @@ +[mapping:ana_cmpr_driver] +archive: libesp_driver_ana_cmpr.a +entries: + if ANA_CMPR_CTRL_FUNC_IN_IRAM = y: + ana_cmpr: ana_cmpr_set_internal_reference (noflash) + ana_cmpr: ana_cmpr_set_debounce (noflash) + ana_cmpr: ana_cmpr_set_cross_type (noflash) diff --git a/components/esp_driver_ana_cmpr/test_apps/.build-test-rules.yml b/components/esp_driver_ana_cmpr/test_apps/.build-test-rules.yml new file mode 100644 index 000000000000..cbcb9d16bc09 --- /dev/null +++ b/components/esp_driver_ana_cmpr/test_apps/.build-test-rules.yml @@ -0,0 +1,12 @@ +# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps + +components/esp_driver_ana_cmpr/test_apps/analog_comparator: + disable: + - if: SOC_ANA_CMPR_SUPPORTED != 1 + disable_test: + - if: IDF_TARGET == "esp32p4" + temporary: true + reason: not supported yet + depends_components: + - esp_driver_gpio + - esp_driver_ana_cmpr diff --git a/components/driver/test_apps/analog_comparator/CMakeLists.txt b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/CMakeLists.txt similarity index 86% rename from components/driver/test_apps/analog_comparator/CMakeLists.txt rename to components/esp_driver_ana_cmpr/test_apps/analog_comparator/CMakeLists.txt index ef4e64222d43..c5b8c3e782aa 100644 --- a/components/driver/test_apps/analog_comparator/CMakeLists.txt +++ b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/CMakeLists.txt @@ -10,7 +10,7 @@ project(test_ana_cmpr) if(CONFIG_COMPILER_DUMP_RTL_FILES) add_custom_target(check_test_app_sections ALL COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py - --rtl-dirs ${CMAKE_BINARY_DIR}/esp-idf/driver/,${CMAKE_BINARY_DIR}/esp-idf/hal/ + --rtl-dirs ${CMAKE_BINARY_DIR}/esp-idf/esp_driver_ana_cmpr/,${CMAKE_BINARY_DIR}/esp-idf/hal/ --elf-file ${CMAKE_BINARY_DIR}/test_ana_cmpr.elf find-refs --from-sections=.iram0.text diff --git a/components/driver/test_apps/analog_comparator/README.md b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/README.md similarity index 100% rename from components/driver/test_apps/analog_comparator/README.md rename to components/esp_driver_ana_cmpr/test_apps/analog_comparator/README.md diff --git a/components/driver/test_apps/analog_comparator/main/CMakeLists.txt b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/CMakeLists.txt similarity index 78% rename from components/driver/test_apps/analog_comparator/main/CMakeLists.txt rename to components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/CMakeLists.txt index bad9d9c3314d..b4687d1c66ee 100644 --- a/components/driver/test_apps/analog_comparator/main/CMakeLists.txt +++ b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/CMakeLists.txt @@ -8,5 +8,5 @@ endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS "." - PRIV_REQUIRES unity driver + PRIV_REQUIRES unity esp_driver_gpio esp_driver_ana_cmpr WHOLE_ARCHIVE) diff --git a/components/driver/test_apps/analog_comparator/main/test_ana_cmpr.c b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/test_ana_cmpr.c similarity index 100% rename from components/driver/test_apps/analog_comparator/main/test_ana_cmpr.c rename to components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/test_ana_cmpr.c diff --git a/components/driver/test_apps/analog_comparator/main/test_ana_cmpr.h b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/test_ana_cmpr.h similarity index 100% rename from components/driver/test_apps/analog_comparator/main/test_ana_cmpr.h rename to components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/test_ana_cmpr.h diff --git a/components/driver/test_apps/analog_comparator/main/test_ana_cmpr_common.c b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/test_ana_cmpr_common.c similarity index 100% rename from components/driver/test_apps/analog_comparator/main/test_ana_cmpr_common.c rename to components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/test_ana_cmpr_common.c diff --git a/components/driver/test_apps/analog_comparator/main/test_ana_cmpr_iram.c b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/test_ana_cmpr_iram.c similarity index 100% rename from components/driver/test_apps/analog_comparator/main/test_ana_cmpr_iram.c rename to components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/test_ana_cmpr_iram.c diff --git a/components/driver/test_apps/analog_comparator/main/test_app_main.c b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/test_app_main.c similarity index 100% rename from components/driver/test_apps/analog_comparator/main/test_app_main.c rename to components/esp_driver_ana_cmpr/test_apps/analog_comparator/main/test_app_main.c diff --git a/components/driver/test_apps/analog_comparator/pytest_ana_cmpr.py b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/pytest_ana_cmpr.py similarity index 100% rename from components/driver/test_apps/analog_comparator/pytest_ana_cmpr.py rename to components/esp_driver_ana_cmpr/test_apps/analog_comparator/pytest_ana_cmpr.py diff --git a/components/driver/test_apps/analog_comparator/sdkconfig.ci.iram_safe b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/sdkconfig.ci.iram_safe similarity index 100% rename from components/driver/test_apps/analog_comparator/sdkconfig.ci.iram_safe rename to components/esp_driver_ana_cmpr/test_apps/analog_comparator/sdkconfig.ci.iram_safe diff --git a/components/driver/test_apps/analog_comparator/sdkconfig.ci.release b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/sdkconfig.ci.release similarity index 100% rename from components/driver/test_apps/analog_comparator/sdkconfig.ci.release rename to components/esp_driver_ana_cmpr/test_apps/analog_comparator/sdkconfig.ci.release diff --git a/components/driver/test_apps/analog_comparator/sdkconfig.defaults b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/sdkconfig.defaults similarity index 100% rename from components/driver/test_apps/analog_comparator/sdkconfig.defaults rename to components/esp_driver_ana_cmpr/test_apps/analog_comparator/sdkconfig.defaults diff --git a/components/esp_hw_support/test_apps/.build-test-rules.yml b/components/esp_hw_support/test_apps/.build-test-rules.yml index 7db7e3242093..43acc7dfd8ae 100644 --- a/components/esp_hw_support/test_apps/.build-test-rules.yml +++ b/components/esp_hw_support/test_apps/.build-test-rules.yml @@ -18,7 +18,7 @@ components/esp_hw_support/test_apps/etm: - esp_driver_gpio - esp_driver_mcpwm - esp_timer - - driver # TODO: replace with esp_driver_ana_cmpr (IDF-8521) + - esp_driver_ana_cmpr components/esp_hw_support/test_apps/host_test_linux: enable: diff --git a/components/esp_hw_support/test_apps/etm/main/CMakeLists.txt b/components/esp_hw_support/test_apps/etm/main/CMakeLists.txt index 93692b32fd5e..214712238d3c 100644 --- a/components/esp_hw_support/test_apps/etm/main/CMakeLists.txt +++ b/components/esp_hw_support/test_apps/etm/main/CMakeLists.txt @@ -29,6 +29,6 @@ endif() # 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 unity esp_timer esp_driver_gptimer esp_driver_gpio esp_driver_mcpwm - driver # TODO: replace with esp_driver_ana_cmpr (IDF-8521) + PRIV_REQUIRES unity esp_timer esp_driver_gptimer esp_driver_gpio + esp_driver_mcpwm esp_driver_ana_cmpr WHOLE_ARCHIVE) diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index 5b3c50e514d9..13b1f33f858d 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -73,9 +73,6 @@ INPUT = \ $(PROJECT_PATH)/components/bt/host/bluedroid/api/include/api/esp_spp_api.h \ $(PROJECT_PATH)/components/bt/host/nimble/esp-hci/include/esp_nimble_hci.h \ $(PROJECT_PATH)/components/console/esp_console.h \ - $(PROJECT_PATH)/components/driver/analog_comparator/include/driver/ana_cmpr.h \ - $(PROJECT_PATH)/components/driver/analog_comparator/include/driver/ana_cmpr_etm.h \ - $(PROJECT_PATH)/components/driver/analog_comparator/include/driver/ana_cmpr_types.h \ $(PROJECT_PATH)/components/driver/dac/include/driver/dac_continuous.h \ $(PROJECT_PATH)/components/driver/dac/include/driver/dac_cosine.h \ $(PROJECT_PATH)/components/driver/dac/include/driver/dac_oneshot.h \ @@ -124,6 +121,9 @@ INPUT = \ $(PROJECT_PATH)/components/esp_common/include/esp_check.h \ $(PROJECT_PATH)/components/esp_common/include/esp_err.h \ $(PROJECT_PATH)/components/esp_common/include/esp_idf_version.h \ + $(PROJECT_PATH)/components/esp_driver_ana_cmpr/include/driver/ana_cmpr.h \ + $(PROJECT_PATH)/components/esp_driver_ana_cmpr/include/driver/ana_cmpr_etm.h \ + $(PROJECT_PATH)/components/esp_driver_ana_cmpr/include/driver/ana_cmpr_types.h \ $(PROJECT_PATH)/components/esp_driver_gpio/include/driver/dedic_gpio.h \ $(PROJECT_PATH)/components/esp_driver_gpio/include/driver/gpio.h \ $(PROJECT_PATH)/components/esp_driver_gpio/include/driver/gpio_etm.h \ diff --git a/docs/en/migration-guides/release-5.x/5.3/peripherals.rst b/docs/en/migration-guides/release-5.x/5.3/peripherals.rst index eb5d4e885117..faec40380612 100644 --- a/docs/en/migration-guides/release-5.x/5.3/peripherals.rst +++ b/docs/en/migration-guides/release-5.x/5.3/peripherals.rst @@ -11,6 +11,7 @@ In order to control the dependence of other components on drivers at a smaller g - `esp_driver_spi` - Driver for GPSPI - `esp_driver_mcpwm` - Driver for Motor Control PWM - `esp_driver_sdmmc` - Driver for SDMMC +- `esp_driver_ana_cmpr` - Driver for Analog Comparator For compatibility, the original `driver`` component is still treated as an all-in-one component by registering these `esp_driver_xyz`` components as its public dependencies. In other words, you do not need to modify the CMake file of an existing project, but you now have a way to specify the specific peripheral driver that your project depends on. diff --git a/docs/zh_CN/migration-guides/release-5.x/5.3/peripherals.rst b/docs/zh_CN/migration-guides/release-5.x/5.3/peripherals.rst index 8924c354a5e7..95717dde388d 100644 --- a/docs/zh_CN/migration-guides/release-5.x/5.3/peripherals.rst +++ b/docs/zh_CN/migration-guides/release-5.x/5.3/peripherals.rst @@ -11,6 +11,7 @@ - `esp_driver_spi` - 通用 SPI 驱动 - `esp_driver_mcpwm` - 电机控制 PWM 驱动 - `esp_driver_sdmmc` - SDMMC 驱动 +- `esp_driver_ana_cmpr` - 模拟比较器驱动 为了兼容性,原来的 `driver` 组件仍然存在,并作为一个 “all-in-one" 的组件,将以上这些 `esp_driver_xyz` 组件注册成自己的公共依赖。换句话说,你无需修改既有项目的 CMake 文件,但是你现在多了一个途径去指定你项目依赖的具体的外设驱动。 diff --git a/examples/peripherals/.build-test-rules.yml b/examples/peripherals/.build-test-rules.yml index a26e19b14317..8abf37e9cf16 100644 --- a/examples/peripherals/.build-test-rules.yml +++ b/examples/peripherals/.build-test-rules.yml @@ -22,6 +22,9 @@ examples/peripherals/analog_comparator: - if: IDF_TARGET == "esp32p4" temporary: true reason: not supported yet + depends_components: + - esp_driver_gpio + - esp_driver_ana_cmpr examples/peripherals/dac: disable: diff --git a/examples/peripherals/analog_comparator/CMakeLists.txt b/examples/peripherals/analog_comparator/CMakeLists.txt index fa9f99dcd0fb..914719a3fbd5 100644 --- a/examples/peripherals/analog_comparator/CMakeLists.txt +++ b/examples/peripherals/analog_comparator/CMakeLists.txt @@ -5,4 +5,6 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(COMPONENTS main) + project(analog_comparator_example) diff --git a/examples/peripherals/analog_comparator/main/CMakeLists.txt b/examples/peripherals/analog_comparator/main/CMakeLists.txt index 07070ae02048..2a3492794526 100644 --- a/examples/peripherals/analog_comparator/main/CMakeLists.txt +++ b/examples/peripherals/analog_comparator/main/CMakeLists.txt @@ -7,4 +7,5 @@ else() endif() idf_component_register(SRCS ${src} + PRIV_REQUIRES esp_driver_ana_cmpr esp_driver_gpio INCLUDE_DIRS ".")