Merge branch 'refactor/remove_io_loop_back' into 'master'

refactor(drivers)!: remove unnecessary io_loop_back config option

Closes IDF-11274

See merge request espressif/esp-idf!39062
This commit is contained in:
morris
2025-05-26 14:09:28 +08:00
58 changed files with 115 additions and 232 deletions

View File

@@ -227,9 +227,10 @@ void app_main(void)
.gpio_num = BLDC_DRV_FAULT_GPIO,
.group_id = 0,
.flags.active_level = 0, // low level means fault, refer to DRV8302 datasheet
.flags.pull_up = true, // internally pull up
};
ESP_ERROR_CHECK(mcpwm_new_gpio_fault(&gpio_fault_config, &over_cur_fault));
// pull up the GPIO internally
ESP_ERROR_CHECK(gpio_set_pull_mode(BLDC_DRV_FAULT_GPIO, GPIO_PULLUP_ONLY));
ESP_LOGI(TAG, "Set brake mode on the fault event");
mcpwm_brake_config_t brake_config = {
@@ -311,7 +312,6 @@ void app_main(void)
mcpwm_cap_channel_handle_t cap_channels[3];
mcpwm_capture_channel_config_t cap_channel_config = {
.prescale = 1,
.flags.pull_up = true,
.flags.neg_edge = true,
.flags.pos_edge = true,
};
@@ -319,6 +319,8 @@ void app_main(void)
for (int i = 0; i < 3; i++) {
cap_channel_config.gpio_num = cap_chan_gpios[i];
ESP_ERROR_CHECK(mcpwm_new_capture_channel(cap_timer, &cap_channel_config, &cap_channels[i]));
// pull up the GPIO internally
ESP_ERROR_CHECK(gpio_set_pull_mode(cap_chan_gpios[i], GPIO_PULLUP_ONLY));
}
ESP_LOGI(TAG, "Register event callback for capture channels");

View File

@@ -71,10 +71,10 @@ void app_main(void)
// capture on both edge
.flags.neg_edge = true,
.flags.pos_edge = true,
// pull up internally
.flags.pull_up = true,
};
ESP_ERROR_CHECK(mcpwm_new_capture_channel(cap_timer, &cap_ch_conf, &cap_chan));
// pull up the GPIO internally
ESP_ERROR_CHECK(gpio_set_pull_mode(HC_SR04_ECHO_GPIO, GPIO_PULLUP_ONLY));
ESP_LOGI(TAG, "Register capture callback");
TaskHandle_t cur_task = xTaskGetCurrentTaskHandle();

View File

@@ -39,10 +39,11 @@ static void example_setup_sync_strategy(mcpwm_timer_handle_t timers[])
mcpwm_gpio_sync_src_config_t gpio_sync_config = {
.group_id = 0, // GPIO fault should be in the same group of the above timers
.gpio_num = EXAMPLE_SYNC_GPIO,
.flags.pull_down = true,
.flags.active_neg = false, // by default, a posedge pulse can trigger a sync event
};
ESP_ERROR_CHECK(mcpwm_new_gpio_sync_src(&gpio_sync_config, &gpio_sync_source));
// pull-down the GPIO to ensure a stable posedge pulse
ESP_ERROR_CHECK(gpio_set_pull_mode(EXAMPLE_SYNC_GPIO, GPIO_PULLDOWN_ONLY));
ESP_LOGI(TAG, "Set timers to sync on the GPIO");
mcpwm_timer_sync_phase_config_t sync_phase_config = {

View File

@@ -7,6 +7,7 @@
#include "freertos/task.h"
#include "esp_log.h"
#include "esp_check.h"
#include "driver/gpio.h"
#include "onewire_bus.h"
#include "ds18b20.h"
@@ -28,6 +29,9 @@ void app_main(void)
ESP_ERROR_CHECK(onewire_new_bus_rmt(&bus_config, &rmt_config, &bus));
ESP_LOGI(TAG, "1-Wire bus installed on GPIO%d", EXAMPLE_ONEWIRE_BUS_GPIO);
// in case the external device didn't have a pull-up resistor, we also enable the internal pull-up resistor
ESP_ERROR_CHECK(gpio_pullup_en(EXAMPLE_ONEWIRE_BUS_GPIO));
int ds18b20_device_num = 0;
ds18b20_device_handle_t ds18b20s[EXAMPLE_ONEWIRE_MAX_DS18B20];
onewire_device_iter_handle_t iter = NULL;