提交 c985f318 编写于 作者: M Mr.M 提交者: mysterywolf

overflow is invalid in oneshot mode

上级 f2063388
......@@ -165,6 +165,10 @@ static rt_ssize_t rt_hwtimer_read(struct rt_device *dev, rt_off_t pos, void *buf
{
cnt = (rt_uint32_t)(timer->freq * timer->period_sec) - cnt;
}
if (timer->mode == HWTIMER_MODE_ONESHOT)
{
overflow = 0;
}
t = overflow * timer->period_sec + cnt/(float)timer->freq;
tv.sec = (rt_int32_t)t;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册