From 734dd6aa329098105a1a2a744ca73443dab44595 Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Sat, 14 Mar 2009 23:24:12 +0100 Subject: * digital/io: - clean main timer module, - update chrono module to rely on main timer (timer/counter 0). --- digital/io/src/main_timer.avr.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'digital/io/src/main_timer.avr.c') diff --git a/digital/io/src/main_timer.avr.c b/digital/io/src/main_timer.avr.c index 8f343403..bcb185b6 100644 --- a/digital/io/src/main_timer.avr.c +++ b/digital/io/src/main_timer.avr.c @@ -33,11 +33,13 @@ void main_timer_init (void) { - /* Fov = F_io / (prescaler * (TOP + 1)) - * TOP = 0xff - * prescaler = 256 - * Tov = 1 / Fov = 4.444 ms */ - /* Note: if you change this, update MT_TC0_*. */ + /* Configuration of the timer/counter 0: + * - top = 0xff, + * - prescaler = 256, + * -> Fov = F_io / (prescaler * (TOP + 1)) + * -> Tov = 1 / Fov = 4.444 ms. + * Note: if you change the TCCR0 register value, please also update + * MT_TC0_PRESCALER and MT_TC0_TOP. */ TCCR0 = regv (FOC0, WGM00, COM01, COM0, WGM01, CS02, CS01, CS00, 0, 0, 0, 0, 0, 1, 1, 0); } @@ -45,7 +47,7 @@ main_timer_init (void) uint8_t main_timer_wait (void) { - /* We have reached overflow. */ + /* Let's pretend we have reached overflow before calling this function. */ uint8_t count_before_ov = 1; /* Loop until an overflow of the timer occurs. */ while (!(TIFR & _BV (TOV0))) -- cgit v1.2.3