From 3b4bb18c06844d2d316123beb1d7f4dcaf52fdec Mon Sep 17 00:00:00 2001 From: misonyo Date: Tue, 25 Dec 2018 09:59:16 +0800 Subject: [PATCH] =?UTF-8?q?[components/drivers/hwtimer]=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E5=99=A8=E5=90=91=E4=B8=8B=E8=AE=A1=E6=95=B0?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E6=97=B6=E6=97=B6=E9=97=B4=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=94=99=E8=AF=AFbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/hwtimer/hwtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- GitLab