未验证 提交 2cfb670f 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #1259 from enkiller/development

[drivers]修复硬件定时器驱动框架单次长时间定时不准确的问题
......@@ -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.
先完成此消息的编辑!
想要评论请 注册