Merge pull request #1259 from enkiller/development
[drivers]修复硬件定时器驱动框架单次长时间定时不准确的问题
This commit is contained in:
commit
2cfb670fa3
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue