Merge pull request #1259 from enkiller/development

[drivers]修复硬件定时器驱动框架单次长时间定时不准确的问题
This commit is contained in:
Bernard Xiong 2018-03-06 16:35:28 +08:00 committed by GitHub
commit 2cfb670fa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -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;
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->cycles <= 1) && (timer->mode == HWTIMER_MODE_ONESHOT))
{
opm = HWTIMER_MODE_ONESHOT;
}
if (timer->ops->start(timer, t, opm) != RT_EOK)
size = 0;