summaryrefslogtreecommitdiff
path: root/components/drivers/hwtimer
diff options
context:
space:
mode:
authormisonyo <[email protected]>2018-12-25 09:59:16 +0800
committermisonyo <[email protected]>2018-12-25 09:59:16 +0800
commit3b4bb18c06844d2d316123beb1d7f4dcaf52fdec (patch)
tree96d68ead5e655f163bc3dfd852676b5259ca956c /components/drivers/hwtimer
parent0b79f45075ee36ce66ffd1a3c493530906cdafe1 (diff)
[components/drivers/hwtimer]修复定时器向下计数模式时时间获取错误bug
Diffstat (limited to 'components/drivers/hwtimer')
-rw-r--r--components/drivers/hwtimer/hwtimer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/components/drivers/hwtimer/hwtimer.c b/components/drivers/hwtimer/hwtimer.c
index cd85b3baef..83a76c7b9d 100644
--- a/components/drivers/hwtimer/hwtimer.c
+++ b/components/drivers/hwtimer/hwtimer.c
@@ -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;