diff --git a/components/driver/CMakeLists.txt b/components/driver/CMakeLists.txt index 075d4161b5..04b6b3721e 100644 --- a/components/driver/CMakeLists.txt +++ b/components/driver/CMakeLists.txt @@ -26,11 +26,6 @@ if(CONFIG_SOC_RMT_SUPPORTED) list(APPEND srcs "deprecated/rmt_legacy.c") endif() -# Sigma-Delta Modulation legacy driver -if(CONFIG_SOC_SDM_SUPPORTED) - list(APPEND srcs "deprecated/sigma_delta_legacy.c") -endif() - # Touch Sensor related source files if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED) if(CONFIG_SOC_TOUCH_SENSOR_VERSION LESS 3) diff --git a/components/driver/Kconfig b/components/driver/Kconfig index c47a39804c..b8b3bf3b9f 100644 --- a/components/driver/Kconfig +++ b/components/driver/Kconfig @@ -28,23 +28,6 @@ menu "Driver Configurations" This configuration option allows the user to bypass the conflict check mechanism with legacy code. endmenu # Legacy I2C Driver Configurationss - menu "Legacy SDM Driver Configurations" - depends on SOC_SDM_SUPPORTED - config SDM_SUPPRESS_DEPRECATE_WARN - bool "Suppress legacy driver deprecated warning" - default n - help - whether to suppress the deprecation warnings when using legacy SDM driver (driver/sigmadelta.h). - If you want to continue using the legacy driver, and don't want to see related deprecation warnings, - you can enable this option. - - config SDM_SKIP_LEGACY_CONFLICT_CHECK - bool "Skip legacy conflict check" - default n - help - This configuration option allows the user to bypass the conflict check mechanism with legacy code. - endmenu # Legacy SDM Driver Configurationss - menu "Legacy Touch Sensor Driver Configurations" depends on SOC_TOUCH_SENSOR_SUPPORTED config TOUCH_SUPPRESS_DEPRECATE_WARN diff --git a/components/driver/deprecated/driver/sigmadelta.h b/components/driver/deprecated/driver/sigmadelta.h deleted file mode 100644 index 9b956cb3e9..0000000000 --- a/components/driver/deprecated/driver/sigmadelta.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include -#include "esp_err.h" -#include "driver/gpio.h" -#include "driver/sigmadelta_types_legacy.h" - -#if !CONFIG_SDM_SUPPRESS_DEPRECATE_WARN -#warning "The legacy sigma-delta driver is deprecated, please use driver/sdm.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Configure Sigma-delta channel - * - * @param config Pointer of Sigma-delta channel configuration struct - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_STATE sigmadelta driver already initialized - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t sigmadelta_config(const sigmadelta_config_t *config); - -/** - * @brief Set Sigma-delta channel duty. - * - * This function is used to set Sigma-delta channel duty, - * If you add a capacitor between the output pin and ground, - * the average output voltage will be Vdc = VDDIO / 256 * duty + VDDIO/2, - * where VDDIO is the power supply voltage. - * - * @param channel Sigma-delta channel number - * @param duty Sigma-delta duty of one channel, the value ranges from -128 to 127, recommended range is -90 ~ 90. - * The waveform is more like a random one in this range. - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_STATE sigmadelta driver has not been initialized - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t sigmadelta_set_duty(sigmadelta_channel_t channel, int8_t duty); - -/** - * @brief Set Sigma-delta channel's clock pre-scale value. - * The source clock is APP_CLK, 80MHz. The clock frequency of the sigma-delta channel is APP_CLK / pre_scale - * - * @param channel Sigma-delta channel number - * @param prescale The divider of source clock, ranges from 0 to 255 - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_STATE sigmadelta driver has not been initialized - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t sigmadelta_set_prescale(sigmadelta_channel_t channel, uint8_t prescale); - -/** - * @brief Set Sigma-delta signal output pin - * - * @param channel Sigma-delta channel number - * @param gpio_num GPIO number of output pin. - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_STATE sigmadelta driver has not been initialized - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t sigmadelta_set_pin(sigmadelta_channel_t channel, gpio_num_t gpio_num); - -#ifdef __cplusplus -} -#endif diff --git a/components/driver/deprecated/driver/sigmadelta_types_legacy.h b/components/driver/deprecated/driver/sigmadelta_types_legacy.h deleted file mode 100644 index dddb9cac50..0000000000 --- a/components/driver/deprecated/driver/sigmadelta_types_legacy.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include -#include "soc/soc_caps.h" -#include "driver/gpio.h" // for gpio_num_t type define - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief SIGMADELTA port number, the max port number is (SIGMADELTA_NUM_MAX -1). - */ -typedef enum { - SIGMADELTA_PORT_0, /*!< SIGMADELTA port 0 */ - SIGMADELTA_PORT_MAX, /*!< SIGMADELTA port max */ -} sigmadelta_port_t; - -/** - * @brief Sigma-delta channel list - */ -typedef enum { - SIGMADELTA_CHANNEL_0, /*!< Sigma-delta channel 0 */ - SIGMADELTA_CHANNEL_1, /*!< Sigma-delta channel 1 */ - SIGMADELTA_CHANNEL_2, /*!< Sigma-delta channel 2 */ - SIGMADELTA_CHANNEL_3, /*!< Sigma-delta channel 3 */ -#if SOC_SDM_CHANNELS_PER_GROUP > 4 - SIGMADELTA_CHANNEL_4, /*!< Sigma-delta channel 4 */ - SIGMADELTA_CHANNEL_5, /*!< Sigma-delta channel 5 */ - SIGMADELTA_CHANNEL_6, /*!< Sigma-delta channel 6 */ - SIGMADELTA_CHANNEL_7, /*!< Sigma-delta channel 7 */ -#endif - SIGMADELTA_CHANNEL_MAX, /*!< Sigma-delta channel max */ -} sigmadelta_channel_t; - -/** - * @brief Sigma-delta configure struct - */ -typedef struct { - sigmadelta_channel_t channel; /*!< Sigma-delta channel number */ - int8_t sigmadelta_duty; /*!< Sigma-delta duty, duty ranges from -128 to 127. */ - uint8_t sigmadelta_prescale; /*!< Sigma-delta prescale, prescale ranges from 0 to 255. */ - gpio_num_t sigmadelta_gpio; /*!< Sigma-delta output io number, refer to gpio.h for more details. */ -} sigmadelta_config_t; - -#ifdef __cplusplus -} -#endif diff --git a/components/driver/deprecated/sigma_delta_legacy.c b/components/driver/deprecated/sigma_delta_legacy.c deleted file mode 100644 index 0b631ce002..0000000000 --- a/components/driver/deprecated/sigma_delta_legacy.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "esp_log.h" -#include "esp_check.h" -#include "esp_err.h" -#include "esp_heap_caps.h" -#include "driver/gpio.h" -#include "driver/sigmadelta_types_legacy.h" -#include "soc/sdm_periph.h" -#include "hal/sdm_hal.h" -#include "hal/sdm_ll.h" -#include "hal/gpio_hal.h" -#include "esp_rom_gpio.h" -#include "esp_private/gpio.h" - -static const char *TAG = "sdm(legacy)"; - -#define SIGMADELTA_CHECK(a,str,ret_val) ESP_RETURN_ON_FALSE(a, ret_val, TAG, "%s", str) - -typedef struct { - sdm_hal_context_t hal; /*!< SIGMADELTA hal context*/ -} sigmadelta_obj_t; - -static sigmadelta_obj_t *p_sigmadelta_obj[SIGMADELTA_PORT_MAX] = {0}; - -#define SIGMADELTA_OBJ_CHECK(sigmadelta_port) { \ - SIGMADELTA_CHECK((sigmadelta_port < SIGMADELTA_PORT_MAX), "sigmadelta port error", ESP_ERR_INVALID_ARG); \ - SIGMADELTA_CHECK((p_sigmadelta_obj[sigmadelta_port]), "sigmadelta driver has not been initialized", ESP_ERR_INVALID_STATE); \ -} - -static inline esp_err_t _sigmadelta_set_duty(sigmadelta_port_t sigmadelta_port, sigmadelta_channel_t channel, int8_t duty) -{ - SIGMADELTA_OBJ_CHECK(sigmadelta_port); - - sdm_ll_set_pulse_density(p_sigmadelta_obj[sigmadelta_port]->hal.dev, channel, duty); - return ESP_OK; -} - -static inline esp_err_t _sigmadelta_set_prescale(sigmadelta_port_t sigmadelta_port, sigmadelta_channel_t channel, uint8_t prescale) -{ - SIGMADELTA_OBJ_CHECK(sigmadelta_port); - - sdm_ll_set_prescale(p_sigmadelta_obj[sigmadelta_port]->hal.dev, channel, prescale + 1); - return ESP_OK; -} - -static inline esp_err_t _sigmadelta_set_pin(sigmadelta_port_t sigmadelta_port, sigmadelta_channel_t channel, gpio_num_t gpio_num) -{ - SIGMADELTA_OBJ_CHECK(sigmadelta_port); - - gpio_func_sel(gpio_num, PIN_FUNC_GPIO); - gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT); - esp_rom_gpio_connect_out_signal(gpio_num, sigma_delta_periph_signals.channels[channel].sd_sig, 0, 0); - return ESP_OK; -} - -static inline esp_err_t _sigmadelta_config(sigmadelta_port_t sigmadelta_port, const sigmadelta_config_t *config) -{ - SIGMADELTA_OBJ_CHECK(sigmadelta_port); - - _sigmadelta_set_duty(sigmadelta_port, config->channel, config->sigmadelta_duty); - _sigmadelta_set_prescale(sigmadelta_port, config->channel, config->sigmadelta_prescale); - _sigmadelta_set_pin(sigmadelta_port, config->channel, config->sigmadelta_gpio); - return ESP_OK; -} - -esp_err_t sigmadelta_deinit(sigmadelta_port_t sigmadelta_port) -{ - SIGMADELTA_OBJ_CHECK(sigmadelta_port); - - heap_caps_free(p_sigmadelta_obj[sigmadelta_port]); - p_sigmadelta_obj[sigmadelta_port] = NULL; - return ESP_OK; -} - -esp_err_t sigmadelta_init(sigmadelta_port_t sigmadelta_port) -{ - SIGMADELTA_CHECK((sigmadelta_port < SIGMADELTA_PORT_MAX), "sigmadelta_port error", ESP_ERR_INVALID_ARG); - SIGMADELTA_CHECK((p_sigmadelta_obj[sigmadelta_port]) == NULL, "sigmadelta driver already initialized", ESP_ERR_INVALID_STATE); - - p_sigmadelta_obj[sigmadelta_port] = (sigmadelta_obj_t *) heap_caps_calloc(1, sizeof(sigmadelta_obj_t), MALLOC_CAP_DEFAULT); - - if (p_sigmadelta_obj[sigmadelta_port] == NULL) { - ESP_LOGE(TAG, "TAG driver malloc error"); - return ESP_FAIL; - } - - sdm_hal_init(&(p_sigmadelta_obj[sigmadelta_port]->hal), sigmadelta_port); - sdm_ll_enable_clock(p_sigmadelta_obj[sigmadelta_port]->hal.dev, true); - return ESP_OK; -} - -// TODO: The following functions are wrappers, for compatibility with current API. - -esp_err_t sigmadelta_set_duty(sigmadelta_channel_t channel, int8_t duty) -{ - SIGMADELTA_CHECK(channel < SIGMADELTA_CHANNEL_MAX, "sigmadelta channel error", ESP_ERR_INVALID_ARG); - return _sigmadelta_set_duty(SIGMADELTA_PORT_0, channel, duty); -} - -esp_err_t sigmadelta_set_prescale(sigmadelta_channel_t channel, uint8_t prescale) -{ - SIGMADELTA_CHECK(channel < SIGMADELTA_CHANNEL_MAX, "sigmadelta channel error", ESP_ERR_INVALID_ARG); - return _sigmadelta_set_prescale(SIGMADELTA_PORT_0, channel, prescale); -} - -esp_err_t sigmadelta_set_pin(sigmadelta_channel_t channel, gpio_num_t gpio_num) -{ - SIGMADELTA_CHECK(channel < SIGMADELTA_CHANNEL_MAX, "sigmadelta channel error", ESP_ERR_INVALID_ARG); - SIGMADELTA_CHECK(GPIO_IS_VALID_OUTPUT_GPIO(gpio_num), "sigmadelta gpio num error", ESP_ERR_INVALID_ARG); - return _sigmadelta_set_pin(SIGMADELTA_PORT_0, channel, gpio_num); -} - -esp_err_t sigmadelta_config(const sigmadelta_config_t *config) -{ - SIGMADELTA_CHECK(config->channel < SIGMADELTA_CHANNEL_MAX, "sigmadelta channel error", ESP_ERR_INVALID_ARG); - SIGMADELTA_CHECK(GPIO_IS_VALID_OUTPUT_GPIO(config->sigmadelta_gpio), "sigmadelta gpio num error", ESP_ERR_INVALID_ARG); - esp_err_t ret; - - if ((p_sigmadelta_obj[SIGMADELTA_PORT_0]) == NULL) { - ret = sigmadelta_init(SIGMADELTA_PORT_0); - if (ret != ESP_OK) { - return ret; - } - } - return _sigmadelta_config(SIGMADELTA_PORT_0, config); -} - -#if !CONFIG_SDM_SKIP_LEGACY_CONFLICT_CHECK -/** - * @brief This function will be called during start up, to check that sdm driver is not running along with the legacy sdm driver - */ -__attribute__((constructor)) -static void check_sdm_driver_conflict(void) -{ - // This function was declared as weak here. sdm driver has one implementation. - // So if sdm driver is not linked in, then `sdm_new_channel` should be NULL at runtime. - extern __attribute__((weak)) esp_err_t sdm_new_channel(const void *config, void **ret_unit); - if ((void *)sdm_new_channel != NULL) { - ESP_EARLY_LOGE(TAG, "CONFLICT! driver_ng is not allowed to be used with the legacy driver"); - abort(); - } - ESP_EARLY_LOGW(TAG, "legacy driver is deprecated, please migrate to `driver/sdm.h`"); -} -#endif //CONFIG_PCNT_SKIP_LEGACY_CONFLICT_CHECK diff --git a/components/driver/test_apps/.build-test-rules.yml b/components/driver/test_apps/.build-test-rules.yml index 24b5b11e0a..d38f53a23c 100644 --- a/components/driver/test_apps/.build-test-rules.yml +++ b/components/driver/test_apps/.build-test-rules.yml @@ -14,14 +14,6 @@ components/driver/test_apps/legacy_rmt_driver: depends_filepatterns: - components/driver/deprecated/**/*rmt* -components/driver/test_apps/legacy_sigma_delta_driver: - disable: - - if: SOC_SDM_SUPPORTED != 1 - depends_filepatterns: - - components/driver/deprecated/**/*sigma* - depends_components: - - esp_driver_gpio - components/driver/test_apps/legacy_twai: disable: - if: SOC_TWAI_SUPPORTED != 1 or SOC_TWAI_SUPPORT_FD == 1 diff --git a/components/driver/test_apps/legacy_sigma_delta_driver/CMakeLists.txt b/components/driver/test_apps/legacy_sigma_delta_driver/CMakeLists.txt deleted file mode 100644 index 23e05b8a32..0000000000 --- a/components/driver/test_apps/legacy_sigma_delta_driver/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# This is the project CMakeLists.txt file for the test subproject -cmake_minimum_required(VERSION 3.16) - -# "Trim" the build. Include the minimal set of components, main, and anything it depends on. -set(COMPONENTS main) - -include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(legacy_sigma_delta_driver_test) diff --git a/components/driver/test_apps/legacy_sigma_delta_driver/README.md b/components/driver/test_apps/legacy_sigma_delta_driver/README.md deleted file mode 100644 index 46d16c788c..0000000000 --- a/components/driver/test_apps/legacy_sigma_delta_driver/README.md +++ /dev/null @@ -1,2 +0,0 @@ -| Supported Targets | ESP32 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | diff --git a/components/driver/test_apps/legacy_sigma_delta_driver/main/CMakeLists.txt b/components/driver/test_apps/legacy_sigma_delta_driver/main/CMakeLists.txt deleted file mode 100644 index 85392372b9..0000000000 --- a/components/driver/test_apps/legacy_sigma_delta_driver/main/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(srcs "test_app_main.c") - -if(CONFIG_SOC_SDM_SUPPORTED) - list(APPEND srcs "test_sigma_delta_legacy.c") -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 driver esp_driver_gpio - WHOLE_ARCHIVE) diff --git a/components/driver/test_apps/legacy_sigma_delta_driver/main/test_app_main.c b/components/driver/test_apps/legacy_sigma_delta_driver/main/test_app_main.c deleted file mode 100644 index ad06ff0d02..0000000000 --- a/components/driver/test_apps/legacy_sigma_delta_driver/main/test_app_main.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "unity.h" -#include "unity_test_runner.h" -#include "esp_heap_caps.h" - -// Some resources are lazy allocated in gpio/dedicated_gpio/delta_sigma driver, the threshold is left for that case -#define TEST_MEMORY_LEAK_THRESHOLD (-400) - -static size_t before_free_8bit; -static size_t before_free_32bit; - -static void check_leak(size_t before_free, size_t after_free, const char *type) -{ - ssize_t delta = after_free - before_free; - printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta); - TEST_ASSERT_MESSAGE(delta >= TEST_MEMORY_LEAK_THRESHOLD, "memory leak"); -} - -void setUp(void) -{ - before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); - before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); -} - -void tearDown(void) -{ - size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); - size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); - check_leak(before_free_8bit, after_free_8bit, "8BIT"); - check_leak(before_free_32bit, after_free_32bit, "32BIT"); -} - -void app_main(void) -{ - unity_run_menu(); -} diff --git a/components/driver/test_apps/legacy_sigma_delta_driver/main/test_sigma_delta_legacy.c b/components/driver/test_apps/legacy_sigma_delta_driver/main/test_sigma_delta_legacy.c deleted file mode 100644 index 927b4abef8..0000000000 --- a/components/driver/test_apps/legacy_sigma_delta_driver/main/test_sigma_delta_legacy.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "unity.h" -#include "soc/soc_caps.h" -#include "driver/sigmadelta.h" - -TEST_CASE("SigmaDelta_config_test", "[sigma_delta]") -{ - sigmadelta_config_t sigmadelta_cfg = { - .sigmadelta_prescale = 80, - .sigmadelta_duty = 45, - .sigmadelta_gpio = 4, - }; - for (int i = 0; i < SIGMADELTA_CHANNEL_MAX; i++) { - sigmadelta_cfg.channel = i; - TEST_ESP_OK(sigmadelta_config(&sigmadelta_cfg)); - } - - sigmadelta_cfg.channel = SIGMADELTA_CHANNEL_MAX; - TEST_ASSERT_EQUAL_MESSAGE(ESP_ERR_INVALID_ARG, sigmadelta_config(&sigmadelta_cfg), "wrong channel number should be inspected"); -} - -// connect GPIO4 with LED positive pin, and the GND pin connect LED negative pin -// logic analyzer help also to see the wave form(more standard and accurate) -TEST_CASE("SigmaDelta_pin_duty_prescale_set", "[sigma_delta]") -{ - sigmadelta_config_t sigmadelta_cfg = { - .channel = 0, - .sigmadelta_prescale = 80, - .sigmadelta_duty = 0, - .sigmadelta_gpio = 4, - }; - TEST_ESP_OK(sigmadelta_config(&sigmadelta_cfg)); - - int8_t duty = 0; - int inc = 1; - for (int i = 0; i < 100; i++) { - sigmadelta_set_duty(sigmadelta_cfg.channel, duty); - vTaskDelay(10 / portTICK_PERIOD_MS); - - duty += inc; - if (duty == 127 || duty == -127) { - inc = (-1) * inc; - } - } - - TEST_ESP_OK(sigmadelta_set_prescale(0, 200)); - for (int i = 0; i < 100; i++) { - sigmadelta_set_duty(sigmadelta_cfg.channel, duty); - vTaskDelay(10 / portTICK_PERIOD_MS); - - duty += inc; - if (duty == 127 || duty == -127) { - inc = (-1) * inc; - } - } - - TEST_ESP_OK(sigmadelta_set_pin(sigmadelta_cfg.channel, 5)); -} diff --git a/components/driver/test_apps/legacy_sigma_delta_driver/pytest_legacy_sigma_delta.py b/components/driver/test_apps/legacy_sigma_delta_driver/pytest_legacy_sigma_delta.py deleted file mode 100644 index 9a6b264285..0000000000 --- a/components/driver/test_apps/legacy_sigma_delta_driver/pytest_legacy_sigma_delta.py +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD -# SPDX-License-Identifier: CC0-1.0 -import pytest -from pytest_embedded_idf import IdfDut -from pytest_embedded_idf.utils import idf_parametrize - - -@pytest.mark.generic -@pytest.mark.parametrize( - 'config', - [ - 'release', - ], - indirect=True, -) -@idf_parametrize( - 'target', - ['esp32', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32s2', 'esp32s3', 'esp32p4'], - indirect=['target'], -) -def test_legacy_sigma_delta(dut: IdfDut) -> None: - dut.run_all_single_board_cases(group='sigma_delta') diff --git a/components/driver/test_apps/legacy_sigma_delta_driver/sdkconfig.ci.release b/components/driver/test_apps/legacy_sigma_delta_driver/sdkconfig.ci.release deleted file mode 100644 index 91d93f163e..0000000000 --- a/components/driver/test_apps/legacy_sigma_delta_driver/sdkconfig.ci.release +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG_PM_ENABLE=y -CONFIG_FREERTOS_USE_TICKLESS_IDLE=y -CONFIG_COMPILER_OPTIMIZATION_SIZE=y -CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/components/driver/test_apps/legacy_sigma_delta_driver/sdkconfig.defaults b/components/driver/test_apps/legacy_sigma_delta_driver/sdkconfig.defaults deleted file mode 100644 index 4299d6efa2..0000000000 --- a/components/driver/test_apps/legacy_sigma_delta_driver/sdkconfig.defaults +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_FREERTOS_HZ=1000 -CONFIG_ESP_TASK_WDT_EN=n -CONFIG_SDM_SUPPRESS_DEPRECATE_WARN=y diff --git a/docs/en/migration-guides/release-5.x/5.0/peripherals.rst b/docs/en/migration-guides/release-5.x/5.0/peripherals.rst index a9f76d501f..ef639bf0d5 100644 --- a/docs/en/migration-guides/release-5.x/5.0/peripherals.rst +++ b/docs/en/migration-guides/release-5.x/5.0/peripherals.rst @@ -91,15 +91,17 @@ GPIO .. only:: SOC_SDM_SUPPORTED - Sigma-Delta Modulator - --------------------- + .. _deprecate_sdm_legacy_driver: + + Legacy Sigma-Delta Modulator Driver is Deprecated + ------------------------------------------------- The Sigma-Delta Modulator driver has been redesigned into :doc:`SDM <../../../api-reference/peripherals/sdm>`. - The new driver implements a factory pattern, where the SDM channels are managed in a pool internally, thus users do not have to fix a SDM channel to a GPIO manually. - All SDM channels can be allocated dynamically. - Although it is recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/sigmadelta.h``. However, by default, including ``driver/sigmadelta.h`` triggers the build warning below. The warning can be suppressed by Kconfig option :ref:`CONFIG_SDM_SUPPRESS_DEPRECATE_WARN`. + Although it is recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/sigmadelta.h``. However, by default, including ``driver/sigmadelta.h`` triggers the build warning below. The warning can be suppressed by Kconfig option ``CONFIG_SDM_SUPPRESS_DEPRECATE_WARN``. .. code-block:: text @@ -122,43 +124,41 @@ GPIO - Channel configuration was done by channel allocation, in :cpp:func:`sdm_new_channel`. In the new driver, only the ``density`` can be changed at runtime, by :cpp:func:`sdm_channel_set_pulse_density`. Other parameters like ``gpio number`` and ``prescale`` are only allowed to set during channel allocation. - Before further channel operations, users should **enable** the channel in advance, by calling :cpp:func:`sdm_channel_enable`. This function helps to manage some system level services, like **Power Management**. - .. _deprecate_gptimer_legacy_driver: - -.. only:: not SOC_SDM_SUPPORTED +.. only:: SOC_GPTIMER_SUPPORTED .. _deprecate_gptimer_legacy_driver: -Legacy Timer Group Driver is Deprecated ---------------------------------------- + Legacy Timer Group Driver is Deprecated + --------------------------------------- -Timer Group driver has been redesigned into :doc:`GPTimer <../../../api-reference/peripherals/gptimer>`, which aims to unify and simplify the usage of general purpose timer. + Timer Group driver has been redesigned into :doc:`GPTimer <../../../api-reference/peripherals/gptimer>`, which aims to unify and simplify the usage of general purpose timer. -Although it is recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/timer.h``. However, by default, including ``driver/timer.h`` triggers the build warning below. The warning can be suppressed by the Kconfig option ``CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN``. + Although it is recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/timer.h``. However, by default, including ``driver/timer.h`` triggers the build warning below. The warning can be suppressed by the Kconfig option ``CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN``. -.. code-block:: text + .. code-block:: text - legacy timer group driver is deprecated, please migrate to driver/gptimer.h + legacy timer group driver is deprecated, please migrate to driver/gptimer.h -The major breaking changes in concept and usage are listed as follows: + The major breaking changes in concept and usage are listed as follows: -Breaking Changes in Concepts -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Breaking Changes in Concepts + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- ``timer_group_t`` and ``timer_idx_t`` which used to identify the hardware timer are removed from user's code. In the new driver, a timer is represented by :cpp:type:`gptimer_handle_t`. -- Definition of timer clock source is moved to :cpp:type:`gptimer_clock_source_t`, the previous ``timer_src_clk_t`` is not used. -- Definition of timer count direction is moved to :cpp:type:`gptimer_count_direction_t`, the previous ``timer_count_dir_t`` is not used. -- Only level interrupt is supported, ``timer_intr_t`` and ``timer_intr_mode_t`` are not used. -- Auto-reload is enabled by set the :cpp:member:`gptimer_alarm_config_t::auto_reload_on_alarm` flag. ``timer_autoreload_t`` is not used. + - ``timer_group_t`` and ``timer_idx_t`` which used to identify the hardware timer are removed from user's code. In the new driver, a timer is represented by :cpp:type:`gptimer_handle_t`. + - Definition of timer clock source is moved to :cpp:type:`gptimer_clock_source_t`, the previous ``timer_src_clk_t`` is not used. + - Definition of timer count direction is moved to :cpp:type:`gptimer_count_direction_t`, the previous ``timer_count_dir_t`` is not used. + - Only level interrupt is supported, ``timer_intr_t`` and ``timer_intr_mode_t`` are not used. + - Auto-reload is enabled by set the :cpp:member:`gptimer_alarm_config_t::auto_reload_on_alarm` flag. ``timer_autoreload_t`` is not used. -Breaking Changes in Usage -^^^^^^^^^^^^^^^^^^^^^^^^^ + Breaking Changes in Usage + ^^^^^^^^^^^^^^^^^^^^^^^^^ -- Timer initialization is done by creating a timer instance from :cpp:func:`gptimer_new_timer`. Basic configurations like clock source, resolution and direction should be set in :cpp:type:`gptimer_config_t`. Note that, specific configurations of alarm events are not needed during the installation stage of the driver. -- Alarm event is configured by :cpp:func:`gptimer_set_alarm_action`, with parameters set in the :cpp:type:`gptimer_alarm_config_t`. -- Setting and getting count value are done by :cpp:func:`gptimer_set_raw_count` and :cpp:func:`gptimer_get_raw_count`. The driver does not help convert the raw value into UTC time-stamp. Instead, the conversion should be done from user's side as the timer resolution is also known to the user. -- The driver will install the interrupt service as well if :cpp:member:`gptimer_event_callbacks_t::on_alarm` is set to a valid callback function. In the callback, users do not have to deal with the low level registers (like "clear interrupt status", "re-enable alarm event" and so on). So functions like ``timer_group_get_intr_status_in_isr`` and ``timer_group_get_auto_reload_in_isr`` are not used anymore. -- To update the alarm configurations when alarm event happens, one can call :cpp:func:`gptimer_set_alarm_action` in the interrupt callback, then the alarm will be re-enabled again. -- Alarm will always be re-enabled by the driver if :cpp:member:`gptimer_alarm_config_t::auto_reload_on_alarm` is set to true. + - Timer initialization is done by creating a timer instance from :cpp:func:`gptimer_new_timer`. Basic configurations like clock source, resolution and direction should be set in :cpp:type:`gptimer_config_t`. Note that, specific configurations of alarm events are not needed during the installation stage of the driver. + - Alarm event is configured by :cpp:func:`gptimer_set_alarm_action`, with parameters set in the :cpp:type:`gptimer_alarm_config_t`. + - Setting and getting count value are done by :cpp:func:`gptimer_set_raw_count` and :cpp:func:`gptimer_get_raw_count`. The driver does not help convert the raw value into UTC time-stamp. Instead, the conversion should be done from user's side as the timer resolution is also known to the user. + - The driver will install the interrupt service as well if :cpp:member:`gptimer_event_callbacks_t::on_alarm` is set to a valid callback function. In the callback, users do not have to deal with the low level registers (like "clear interrupt status", "re-enable alarm event" and so on). So functions like ``timer_group_get_intr_status_in_isr`` and ``timer_group_get_auto_reload_in_isr`` are not used anymore. + - To update the alarm configurations when alarm event happens, one can call :cpp:func:`gptimer_set_alarm_action` in the interrupt callback, then the alarm will be re-enabled again. + - Alarm will always be re-enabled by the driver if :cpp:member:`gptimer_alarm_config_t::auto_reload_on_alarm` is set to true. UART ---- diff --git a/docs/en/migration-guides/release-6.x/6.0/peripherals.rst b/docs/en/migration-guides/release-6.x/6.0/peripherals.rst index 3b41d19f01..f90158262a 100644 --- a/docs/en/migration-guides/release-6.x/6.0/peripherals.rst +++ b/docs/en/migration-guides/release-6.x/6.0/peripherals.rst @@ -116,3 +116,10 @@ SDMMC ------------------------------------------- The legacy temperature sensor driver ``driver/temp_sensor.h`` is deprecated since version 5.0 (see :ref:`deprecate_tsens_legacy_driver`). Starting from version 6.0, the legacy driver is completely removed. The new driver is placed in the :component:`esp_driver_tsens`, and the header file path is ``driver/temperature_sensor.h``. + +.. only:: SOC_SDM_SUPPORTED + + Legacy Sigma-Delta Modulator Driver is Removed + ---------------------------------------------- + + The legacy Sigma-Delta Modulator driver ``driver/sigmadelta.h`` is deprecated since version 5.0 (see :ref:`deprecate_sdm_legacy_driver`). Starting from version 6.0, the legacy driver is completely removed. The new driver is placed in the :component:`esp_driver_sdm`, and the header file path is ``driver/sdm.h``. diff --git a/docs/zh_CN/migration-guides/release-5.x/5.0/peripherals.rst b/docs/zh_CN/migration-guides/release-5.x/5.0/peripherals.rst index 49750f0f42..9ee9dd71b9 100644 --- a/docs/zh_CN/migration-guides/release-5.x/5.0/peripherals.rst +++ b/docs/zh_CN/migration-guides/release-5.x/5.0/peripherals.rst @@ -90,15 +90,17 @@ GPIO .. only:: SOC_SDM_SUPPORTED - Sigma-Delta 调制器 - --------------------------------- + .. _deprecate_sdm_legacy_driver: + + 旧版 Sigma-Delta 调制器驱动已被弃用 + -------------------------------------------------- Sigma-Delta 调制器的驱动现已更新为 :doc:`SDM <../../../api-reference/peripherals/sdm>`。 - 新驱动中实现了工厂模式,SDM 通道都位于内部通道池中,因此用户无需手动将 SDM 通道配置到 GPIO 管脚。 - SDM 通道会被自动分配。 - 尽管我们推荐用户使用新的驱动 API,旧版驱动仍然可用,位于头文件引用路径 ``driver/sigmadelta.h`` 中。但是,引用 ``driver/sigmadelta.h`` 会默认触发如下编译警告,可通过配置 Kconfig 选项 :ref:`CONFIG_SDM_SUPPRESS_DEPRECATE_WARN` 关闭该警告。 + 尽管我们推荐用户使用新的驱动 API,旧版驱动仍然可用,位于头文件引用路径 ``driver/sigmadelta.h`` 中。但是,引用 ``driver/sigmadelta.h`` 会默认触发如下编译警告,可通过配置 Kconfig 选项 ``CONFIG_SDM_SUPPRESS_DEPRECATE_WARN`` 关闭该警告。 .. code-block:: text @@ -121,43 +123,41 @@ GPIO - 更新前,通道配置由通道分配在 :cpp:func:`sdm_new_channel` 完成。在新驱动中,只有 ``density`` 可在运行时由 :cpp:func:`sdm_channel_set_pulse_density` 更新。其他参数如 ``gpio number``、 ``prescale`` 只能在通道分配时进行设置。 - 在进行下一步通道操作前,用户应通过调用 :cpp:func:`sdm_channel_enable` 提前 **使能** 该通道。该函数有助于管理一些系统级服务,如 **电源管理**。 - .. _deprecate_gptimer_legacy_driver: - -.. only:: not SOC_SDM_SUPPORTED +.. only:: SOC_GPTIMER_SUPPORTED .. _deprecate_gptimer_legacy_driver: -旧版定时器组驱动被弃用 ----------------------- + 旧版定时器组驱动被弃用 + ---------------------- -为统一和简化通用定时器的使用,定时器组驱动已更新为 :doc:`GPTimer <../../../api-reference/peripherals/gptimer>`。 + 为统一和简化通用定时器的使用,定时器组驱动已更新为 :doc:`GPTimer <../../../api-reference/peripherals/gptimer>`。 -尽管我们推荐使用新的驱动 API, 旧版驱动仍然可用,其头文件引用路径为 ``driver/timer.h``。但是,引用 ``driver/timer.h`` 会默认触发如下编译警告,可通过配置 Kconfig 选项 ``CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN`` 关闭该警告。 + 尽管我们推荐使用新的驱动 API, 旧版驱动仍然可用,其头文件引用路径为 ``driver/timer.h``。但是,引用 ``driver/timer.h`` 会默认触发如下编译警告,可通过配置 Kconfig 选项 ``CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN`` 关闭该警告。 -.. code-block:: text + .. code-block:: text - legacy timer group driver is deprecated, please migrate to driver/gptimer.h + legacy timer group driver is deprecated, please migrate to driver/gptimer.h -概念和使用方法上的主要更新如下所示: + 概念和使用方法上的主要更新如下所示: -主要概念更新 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 主要概念更新 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- 用于识别定时器的 ``timer_group_t`` 和 ``timer_idx_t`` 已被删除。在新驱动中,定时器用参数 :cpp:type:`gptimer_handle_t` 表示。 -- 更新后,定时器的时钟源由 :cpp:type:`gptimer_clock_source_t` 定义,之前的时钟源参数 ``timer_src_clk_t`` 不再使用。 -- 更新后,定时器计数方向由 :cpp:type:`gptimer_count_direction_t` 定义,之前的计数方向参数 ``timer_count_dir_t`` 不再使用。 -- 更新后,仅支持电平触发的中断, ``timer_intr_t`` 和 ``timer_intr_mode_t`` 不再使用。 -- 更新后,通过设置标志位 :cpp:member:`gptimer_alarm_config_t::auto_reload_on_alarm`, 可以使能自动加载。 ``timer_autoreload_t`` 不再使用。 + - 用于识别定时器的 ``timer_group_t`` 和 ``timer_idx_t`` 已被删除。在新驱动中,定时器用参数 :cpp:type:`gptimer_handle_t` 表示。 + - 更新后,定时器的时钟源由 :cpp:type:`gptimer_clock_source_t` 定义,之前的时钟源参数 ``timer_src_clk_t`` 不再使用。 + - 更新后,定时器计数方向由 :cpp:type:`gptimer_count_direction_t` 定义,之前的计数方向参数 ``timer_count_dir_t`` 不再使用。 + - 更新后,仅支持电平触发的中断, ``timer_intr_t`` 和 ``timer_intr_mode_t`` 不再使用。 + - 更新后,通过设置标志位 :cpp:member:`gptimer_alarm_config_t::auto_reload_on_alarm`, 可以使能自动加载。 ``timer_autoreload_t`` 不再使用。 -主要使用方法更新 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 主要使用方法更新 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- 更新后,通过从 :cpp:func:`gptimer_new_timer` 创建定时器示例可以初始化定时器。用户可以在 :cpp:type:`gptimer_config_t` 进行一些基本设置,如时钟源,分辨率和计数方向。请注意,无需在驱动安装阶段进行报警事件的特殊设置。 -- 更新后,报警事件在 :cpp:func:`gptimer_set_alarm_action` 中进行设置,参数在 :cpp:type:`gptimer_alarm_config_t` 中进行设置。 -- 更新后,通过 :cpp:func:`gptimer_set_raw_count` 设置计数数值,通过 :cpp:func:`gptimer_get_raw_count` 获取计数数值。驱动不会自动将原始数据同步到 UTC 时间戳。由于定时器的分辨率已知,用户可以自行转换数据。 -- 更新后,如果 :cpp:member:`gptimer_event_callbacks_t::on_alarm` 被设置为有效的回调函数,驱动程序也会安装中断服务。在回调函数中,用户无需配置底层寄存器,如用于“清除中断状态”,“重新使能事件”的寄存器等。因此, ``timer_group_get_intr_status_in_isr`` 与 ``timer_group_get_auto_reload_in_isr`` 这些函数不再使用。 -- 更新后,当报警事件发生时,为更新报警配置,用户可以在中断回调中调用 :cpp:func:`gptimer_set_alarm_action`,这样报警事件会被重新使能。 -- 更新后,如果用户将 :cpp:member:`gptimer_alarm_config_t::auto_reload_on_alarm` 设置为 true,报警事件将会一直被驱动程序使能。 + - 更新后,通过从 :cpp:func:`gptimer_new_timer` 创建定时器示例可以初始化定时器。用户可以在 :cpp:type:`gptimer_config_t` 进行一些基本设置,如时钟源,分辨率和计数方向。请注意,无需在驱动安装阶段进行报警事件的特殊设置。 + - 更新后,报警事件在 :cpp:func:`gptimer_set_alarm_action` 中进行设置,参数在 :cpp:type:`gptimer_alarm_config_t` 中进行设置。 + - 更新后,通过 :cpp:func:`gptimer_set_raw_count` 设置计数数值,通过 :cpp:func:`gptimer_get_raw_count` 获取计数数值。驱动不会自动将原始数据同步到 UTC 时间戳。由于定时器的分辨率已知,用户可以自行转换数据。 + - 更新后,如果 :cpp:member:`gptimer_event_callbacks_t::on_alarm` 被设置为有效的回调函数,驱动程序也会安装中断服务。在回调函数中,用户无需配置底层寄存器,如用于“清除中断状态”,“重新使能事件”的寄存器等。因此, ``timer_group_get_intr_status_in_isr`` 与 ``timer_group_get_auto_reload_in_isr`` 这些函数不再使用。 + - 更新后,当报警事件发生时,为更新报警配置,用户可以在中断回调中调用 :cpp:func:`gptimer_set_alarm_action`,这样报警事件会被重新使能。 + - 更新后,如果用户将 :cpp:member:`gptimer_alarm_config_t::auto_reload_on_alarm` 设置为 true,报警事件将会一直被驱动程序使能。 UART ------------ diff --git a/docs/zh_CN/migration-guides/release-6.x/6.0/peripherals.rst b/docs/zh_CN/migration-guides/release-6.x/6.0/peripherals.rst index 94960f5520..a2f65540d4 100644 --- a/docs/zh_CN/migration-guides/release-6.x/6.0/peripherals.rst +++ b/docs/zh_CN/migration-guides/release-6.x/6.0/peripherals.rst @@ -115,3 +115,10 @@ SDMMC ------------------------------------ 旧版的温度传感器驱动 ``driver/temp_sensor.h`` 在 5.1 的版本中就已经被弃用(请参考 :ref:`deprecate_tsens_legacy_driver`)。从 6.0 版本开始,旧版驱动被完全移除。新驱动位于 :component:`esp_driver_tsens` 组件中,头文件引用路径为 ``driver/temperature_sensor.h``。 + +.. only:: SOC_SDM_SUPPORTED + + 旧版 Sigma-Delta 调制器驱动被移除 + --------------------------------- + + 旧版的 Sigma-Delta 调制器驱动 ``driver/sigmadelta.h`` 在 5.0 的版本中就已经被弃用(请参考 :ref:`deprecate_sdm_legacy_driver`)。从 6.0 版本开始,旧版驱动被完全移除。新驱动位于 :component:`esp_driver_sdm` 组件中,头文件引用路径为 ``driver/sdm.h``。 diff --git a/tools/idf_py_actions/hints.yml b/tools/idf_py_actions/hints.yml index 260d16eed6..c795d3b37d 100644 --- a/tools/idf_py_actions/hints.yml +++ b/tools/idf_py_actions/hints.yml @@ -519,3 +519,6 @@ - re_variables: ['driver/mcpwm.h'] hint_variables: ['legacy MCPWM', 'driver/mcpwm_prelude', 'esp_driver_mcpwm'] + - + re_variables: ['driver/sigmadelta.h'] + hint_variables: ['legacy Sigma-Delta', 'driver/sdm.h', 'esp_driver_sdm']