fix(mcpwm): reset GPIO used by generator after delete

Closes https://github.com/espressif/esp-idf/issues/12980
pull/13114/head
morris 2024-01-31 16:07:51 +08:00
rodzic d749575648
commit 99fce2fdcb
4 zmienionych plików z 19 dodań i 15 usunięć

Wyświetl plik

@ -1,6 +1,8 @@
menu "Driver Configurations"
menu "Legacy ADC Configuration"
orsource "./twai/Kconfig.twai"
menu "Legacy ADC Driver Configuration"
config ADC_DISABLE_DAC
depends on SOC_DAC_SUPPORTED
@ -58,10 +60,18 @@ menu "Driver Configurations"
If you want to continue using the legacy driver, and don't want to see related
deprecation warnings, you can enable this option.
endmenu
endmenu # Legacy ADC Calibration Configuration
endmenu # Legacy ADC Driver Configuration
endmenu # ADC Configuration
orsource "./twai/Kconfig.twai"
menu "Legacy MCPWM Driver Configurations"
depends on SOC_MCPWM_SUPPORTED
config MCPWM_SUPPRESS_DEPRECATE_WARN
bool "Suppress legacy driver deprecated warning"
default n
help
Wether to suppress the deprecation warnings when using legacy MCPWM driver (driver/mcpwm.h).
If you want to continue using the legacy driver, and don't want to see related deprecation warnings,
you can enable this option.
endmenu # Legacy MCPWM Driver Configurations
endmenu # Driver configurations

Wyświetl plik

@ -27,7 +27,7 @@
#warning "This set of I2S APIs has been deprecated, \
please include 'driver/i2s_std.h', 'driver/i2s_pdm.h' or 'driver/i2s_tdm.h' instead. \
if you want to keep using the old APIs and ignore this warning, \
you can enable 'Suppress leagcy driver deprecated warning' option under 'I2S Configuration' menu in Kconfig"
you can enable 'Suppress legacy driver deprecated warning' option under 'I2S Configuration' menu in Kconfig"
#endif
#ifdef __cplusplus

Wyświetl plik

@ -16,14 +16,6 @@ menu "ESP-Driver:MCPWM Configurations"
so that these functions can be IRAM-safe and able to be called in the other IRAM interrupt context.
Enabling this option can improve driver performance as well.
config MCPWM_SUPPRESS_DEPRECATE_WARN
bool "Suppress leagcy driver deprecated warning"
default n
help
Wether to suppress the deprecation warnings when using legacy MCPWM driver (driver/mcpwm.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 MCPWM_ENABLE_DEBUG_LOG
bool "Enable debug log"
default n

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -118,6 +118,8 @@ esp_err_t mcpwm_del_generator(mcpwm_gen_handle_t gen)
mcpwm_group_t *group = oper->group;
ESP_LOGD(TAG, "del generator (%d,%d,%d)", group->group_id, oper->oper_id, gen->gen_id);
// reset GPIO
gpio_reset_pin(gen->gen_gpio_num);
// recycle memory resource
ESP_RETURN_ON_ERROR(mcpwm_generator_destroy(gen), TAG, "destroy generator failed");
return ESP_OK;