fix(ledc): fix ledc_get_freq calculation err due to overflow

Closes https://github.com/espressif/esp-idf/pull/14882
This commit is contained in:
Song Ruo Jing
2024-12-26 18:51:12 +08:00
parent 16101fd7f2
commit 7ec010c1ae
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -864,7 +864,7 @@ uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_timer_t timer_num)
ledc_hal_get_clock_divider(&(p_ledc_obj[speed_mode]->ledc_hal), timer_num, &clock_divider);
ledc_hal_get_duty_resolution(&(p_ledc_obj[speed_mode]->ledc_hal), timer_num, &duty_resolution);
ledc_hal_get_clk_cfg(&(p_ledc_obj[speed_mode]->ledc_hal), timer_num, &clk_cfg);
uint32_t precision = (0x1 << duty_resolution);
uint64_t precision = (0x1 << duty_resolution);
uint32_t src_clk_freq = 0;
esp_clk_tree_src_get_freq_hz((soc_module_clk_t)clk_cfg, LEDC_CLK_SRC_FREQ_PRECISION, &src_clk_freq);
portEXIT_CRITICAL(&ledc_spinlock);