Skip to content

Commit

Permalink
Merge branch 'bugfix/mcpwm_reset_generator_gpio' into 'master'
Browse files Browse the repository at this point in the history
fix(mcpwm): reset GPIO used by generator after delete

Closes IDFGH-11895

See merge request espressif/esp-idf!28804
  • Loading branch information
suda-morris committed Feb 1, 2024
2 parents bb1bc2a + 99fce2f commit fdb597c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
20 changes: 15 additions & 5 deletions components/driver/Kconfig
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 # ADC Configuration
endmenu # Legacy ADC Calibration Configuration
endmenu # Legacy ADC Driver 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
2 changes: 1 addition & 1 deletion components/driver/deprecated/driver/i2s.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions components/esp_driver_mcpwm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion components/esp_driver_mcpwm/src/mcpwm_gen.c
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit fdb597c

Please sign in to comment.