ESP32 定时器 计数器
环境是esp-idf v4.4.3,用的是官方的
timer_group例程
修改如下
Code: [Select all] [Expand/Collapse]
- 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);
更多回帖