esp32/machine_timer: Fix ESP32C3 timer period doubling.
The original ESP32 only supports timer source clock APB so it doesn't need and doesn't have a clk_src field. The ESP32C3 supports timer source clock APB and XTAL so it does have a clk_src field, and this needs to be configured to get the correct period. Fixes #8084.
This commit is contained in:
parent
a67989aa20
commit
7fe7c55bb8
|
@ -189,6 +189,9 @@ STATIC void machine_timer_enable(machine_timer_obj_t *self) {
|
|||
config.divider = TIMER_DIVIDER;
|
||||
config.intr_type = TIMER_INTR_LEVEL;
|
||||
config.counter_en = TIMER_PAUSE;
|
||||
#if SOC_TIMER_GROUP_SUPPORT_XTAL
|
||||
config.clk_src = TIMER_SRC_CLK_APB;
|
||||
#endif
|
||||
|
||||
check_esp_err(timer_init(self->group, self->index, &config));
|
||||
check_esp_err(timer_set_counter_value(self->group, self->index, 0x00000000));
|
||||
|
|
Loading…
Reference in New Issue