mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/default_clock_source_can_leave_empty_v5.1' into 'release/v5.1'
feat(mcpwm): default clock source setting can leave empty (v5.1) See merge request espressif/esp-idf!25548
This commit is contained in:
commit
ce6d7ba1bb
@ -669,7 +669,7 @@ static adc_atten_t s_atten2_single[ADC2_CHANNEL_MAX]; //Array saving attenuat
|
||||
|
||||
static int8_t adc_digi_get_io_num(adc_unit_t adc_unit, uint8_t adc_channel)
|
||||
{
|
||||
assert(adc_unit <= SOC_ADC_PERIPH_NUM);
|
||||
assert(adc_unit < SOC_ADC_PERIPH_NUM);
|
||||
uint8_t adc_n = (adc_unit == ADC_UNIT_1) ? 0 : 1;
|
||||
return adc_channel_io_map[adc_n][adc_channel];
|
||||
}
|
||||
|
@ -96,13 +96,14 @@ esp_err_t mcpwm_new_capture_timer(const mcpwm_capture_timer_config_t *config, mc
|
||||
mcpwm_group_t *group = cap_timer->group;
|
||||
int group_id = group->group_id;
|
||||
|
||||
mcpwm_capture_clock_source_t clk_src = config->clk_src ? config->clk_src : MCPWM_CAPTURE_CLK_SRC_DEFAULT;
|
||||
#if SOC_MCPWM_CAPTURE_CLK_FROM_GROUP
|
||||
// capture timer clock source is same as the MCPWM group
|
||||
ESP_GOTO_ON_ERROR(mcpwm_select_periph_clock(group, (soc_module_clk_t)config->clk_src), err, TAG, "set group clock failed");
|
||||
ESP_GOTO_ON_ERROR(mcpwm_select_periph_clock(group, (soc_module_clk_t)clk_src), err, TAG, "set group clock failed");
|
||||
cap_timer->resolution_hz = group->resolution_hz;
|
||||
#else
|
||||
// capture timer has independent clock source selection
|
||||
switch (config->clk_src) {
|
||||
switch (clk_src) {
|
||||
case MCPWM_CAPTURE_CLK_SRC_APB:
|
||||
cap_timer->resolution_hz = esp_clk_apb_freq();
|
||||
#if CONFIG_PM_ENABLE
|
||||
|
@ -101,7 +101,8 @@ esp_err_t mcpwm_new_timer(const mcpwm_timer_config_t *config, mcpwm_timer_handle
|
||||
mcpwm_hal_context_t *hal = &group->hal;
|
||||
int timer_id = timer->timer_id;
|
||||
// select the clock source
|
||||
ESP_GOTO_ON_ERROR(mcpwm_select_periph_clock(group, (soc_module_clk_t)config->clk_src), err, TAG, "set group clock failed");
|
||||
mcpwm_timer_clock_source_t clk_src = config->clk_src ? config->clk_src : MCPWM_TIMER_CLK_SRC_DEFAULT;
|
||||
ESP_GOTO_ON_ERROR(mcpwm_select_periph_clock(group, (soc_module_clk_t)clk_src), err, TAG, "set group clock failed");
|
||||
// reset the timer to a determined state
|
||||
mcpwm_hal_timer_reset(hal, timer_id);
|
||||
// set timer resolution
|
||||
|
@ -67,7 +67,7 @@ static void adc_dma_intr_handler(void *arg);
|
||||
|
||||
static int8_t adc_digi_get_io_num(adc_unit_t adc_unit, uint8_t adc_channel)
|
||||
{
|
||||
assert(adc_unit <= SOC_ADC_PERIPH_NUM);
|
||||
assert(adc_unit < SOC_ADC_PERIPH_NUM);
|
||||
uint8_t adc_n = (adc_unit == ADC_UNIT_1) ? 0 : 1;
|
||||
return adc_channel_io_map[adc_n][adc_channel];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user