修改如下
- 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);