mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/timer_example_crashed_not_calling_timer_group_set_alarm_value_in_isr_v4.3' into 'release/v4.3'
driver/timer: fixed auto reload problem in default isr callback (backport to 4.3) See merge request espressif/esp-idf!13529
This commit is contained in:
commit
8732cc6c6b
@ -216,8 +216,12 @@ static void IRAM_ATTR timer_isr_default(void *arg)
|
||||
is_awoken = timer_obj->timer_isr_fun.fn(timer_obj->timer_isr_fun.args);
|
||||
//Clear intrrupt status
|
||||
timer_hal_clear_intr_status(&(timer_obj->hal));
|
||||
//After the alarm has been triggered, we need enable it again, so it is triggered the next time.
|
||||
timer_hal_set_alarm_enable(&(timer_obj->hal), TIMER_ALARM_EN);
|
||||
//If the timer is set to auto reload, we need enable it again, so it is triggered the next time.
|
||||
if (timer_hal_get_auto_reload(&timer_obj->hal)) {
|
||||
timer_hal_set_alarm_enable(&(timer_obj->hal), TIMER_ALARM_EN);
|
||||
} else {
|
||||
timer_hal_set_alarm_enable(&(timer_obj->hal), TIMER_ALARM_DIS);
|
||||
}
|
||||
}
|
||||
}
|
||||
TIMER_EXIT_CRITICAL(&timer_spinlock[timer_obj->timer_isr_fun.isr_timer_group]);
|
||||
|
@ -28,11 +28,7 @@ def test_examples_timergroup(env, extra_data): # type: (Any, Any) -> None
|
||||
dut.expect('Timer Group without auto reload', timeout=5)
|
||||
dut.expect('EVENT TIME')
|
||||
event_time0 = dut.expect(re.compile(r'Time\s+:\s+(\d+\.\d+)\s+s'))[0]
|
||||
dut.expect('Timer Group without auto reload', timeout=6)
|
||||
dut.expect('EVENT TIME')
|
||||
event_time1 = dut.expect(re.compile(r'Time\s+:\s+(\d+\.\d+)\s+s'))[0]
|
||||
print('event0={}, event1={}'.format(event_time0, event_time1))
|
||||
assert float(event_time1) - float(event_time0) < 5.001
|
||||
print('event0={}'.format(event_time0))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user