Skip to content

Commit

Permalink
fix(ledc): fix ledc_get_freq calculation err due to overflow
Browse files Browse the repository at this point in the history
Closes #14882
  • Loading branch information
songruo committed Dec 5, 2024
1 parent 1e3dbeb commit 83c244e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/esp_driver_ledc/src/ledc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,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);
Expand Down

0 comments on commit 83c244e

Please sign in to comment.