fix(ledc): fix frequency calculation

ledc.c: Fix frequency calculation.
Round int instead of truncate.

Merges https://github.com/espressif/esp-idf/pull/11810
This commit is contained in:
IhorNehrutsa
2023-07-10 11:45:09 +08:00
committed by Song Ruo Jing
parent 6f3e07d97b
commit 909d8b6db5
3 changed files with 3 additions and 3 deletions
@@ -10,7 +10,7 @@
#include "esp_heap_caps.h"
// Some resources are lazy allocated in LEDC driver, the threshold is left for that case
#define TEST_MEMORY_LEAK_THRESHOLD (150)
#define TEST_MEMORY_LEAK_THRESHOLD (230)
static size_t before_free_8bit;
static size_t before_free_32bit;
@@ -553,7 +553,7 @@ static void timer_frequency_test(ledc_channel_t channel, ledc_timer_bit_t timer_
uint32_t clk_src_freq = 0;
esp_clk_tree_src_get_freq_hz((soc_module_clk_t)TEST_DEFAULT_CLK_CFG, ESP_CLK_TREE_SRC_FREQ_PRECISION_EXACT, &clk_src_freq);
if (clk_src_freq == 80 * 1000 * 1000) {
theoretical_freq = 8992;
theoretical_freq = 8993;
} else if (clk_src_freq == 96 * 1000 * 1000) {
theoretical_freq = 9009;
}