esp32 硬件定时器计数器设置向下计数,会无限重启是怎么回事?

hello_galaxy
Posts: 10
Joined: Mon Jul 19, 2021 12:20 pm

esp32 硬件定时器计数器设置向下计数,会无限重启是怎么回事?

Postby hello_galaxy » Sat Dec 17, 2022 9:13 am

环境是esp-idf v4.4.3,用的是官方的timer_group例程
修改如下

Code: Untitled.c Select all


timer_config_t config = {
.divider = TIMER_DIVIDER,
.counter_dir = TIMER_COUNT_DOWN,
.counter_en = TIMER_PAUSE,
.alarm_en = TIMER_ALARM_EN,
.auto_reload = auto_reload,
}; // default clock source is APB
timer_init(group, timer, &config);
...
timer_set_counter_value(group, timer, timer_interval_sec * TIMER_SCALE);

Who is online

Users browsing this forum: Amazon [Bot], YisouSpider and 1 guest