Merge pull request #2114 from misonyo/dev

[components/drivers/hwtimer]修复定时器向下计数模式时时间获取错误bug
This commit is contained in:
Bernard Xiong 2018-12-25 14:18:29 +08:00 committed by GitHub
commit fefbea7b7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -153,7 +153,7 @@ static rt_size_t rt_hwtimer_read(struct rt_device *dev, rt_off_t pos, void *buff
cnt = timer->ops->count_get(timer);
if (timer->info->cntmode == HWTIMER_CNTMODE_DW)
{
cnt = timer->info->maxcnt - cnt;
cnt = (timer->freq * timer->period_sec) - cnt;
}
t = timer->overflow * timer->period_sec + cnt/(float)timer->freq;