diff options
| author | HubretXie <[email protected]> | 2019-01-08 09:45:54 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-01-08 09:45:54 +0800 |
| commit | adfefdb05f31e4cc2d002a65b96666606273259b (patch) | |
| tree | a8d91ae3e3cb6e32850b8ae6bd3e6335aae0c019 /components/drivers/hwtimer | |
| parent | c51f27797e332cb9a73cfbde7b1370a8ca59684d (diff) | |
| parent | 3d95a0359782157ad266f4bbc55a45dc22465e3e (diff) | |
Merge pull request #2 from RT-Thread/master
sync
Diffstat (limited to 'components/drivers/hwtimer')
| -rw-r--r-- | components/drivers/hwtimer/hwtimer.c | 2 |
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; |
