summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src/chrono.c
diff options
context:
space:
mode:
authorJérémy Dufour2009-05-19 17:58:54 +0200
committerJérémy Dufour2009-05-19 17:58:54 +0200
commit8165b73c801f5a946b093319703f513aa07a7559 (patch)
tree1fa894c42965430587bedcf22999e0a843b6057d /digital/io/src/chrono.c
parent1a48d1ffd069b227656779553cd85c75f8d6fa29 (diff)
* digital/io/src:
- fix chrono for the count of match duration.
Diffstat (limited to 'digital/io/src/chrono.c')
-rw-r--r--digital/io/src/chrono.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/digital/io/src/chrono.c b/digital/io/src/chrono.c
index 7b9a6936..579ed4bf 100644
--- a/digital/io/src/chrono.c
+++ b/digital/io/src/chrono.c
@@ -46,8 +46,9 @@
* Number of overflows of the timer/counter 0 to wait before the match is
* over.
* Basically, it is match_duration / timer_counter_0_overflow_duration.
+ * Minus one is here for safety reason (because rounding is done at plus one).
*/
-#define CHRONO_MATCH_OVERFLOW_COUNT (MATCH_DURATION_MS / MT_TC0_PERIOD)
+#define CHRONO_MATCH_OVERFLOW_COUNT (MATCH_DURATION_MS / MT_TC0_PERIOD - 1)
/**
* Duration of a loop to emulate from the original behaviour, in ms.