提交 2bbb27c2 编写于 作者: 还_没_想_好's avatar 还_没_想_好

[drivers]修复定时器驱动框架单次长时间定时不准确的问题

上级 8f2588d6
......@@ -192,14 +192,15 @@ static rt_size_t rt_hwtimer_write(struct rt_device *dev, rt_off_t pos, const voi
if (size != sizeof(rt_hwtimerval_t))
return 0;
timer->ops->stop(timer);
timer->overflow = 0;
t = timeout_calc(timer, (rt_hwtimerval_t*)buffer);
if ((timer->cycles <= 1) && (timer->mode == HWTIMER_MODE_ONESHOT))
{
opm = HWTIMER_MODE_ONESHOT;
}
timer->ops->stop(timer);
timer->overflow = 0;
t = timeout_calc(timer, (rt_hwtimerval_t*)buffer);
if (timer->ops->start(timer, t, opm) != RT_EOK)
size = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册