esp32 硬件定时器计数器设置向下计数,会无限重启是怎么回事?
Posted: Sat Dec 17, 2022 9:13 am
环境是esp-idf v4.4.3,用的是官方的timer_group例程
修改如下
修改如下
- 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);