timer_simple_avr.c
Go to the documentation of this file.00001
00040 #warning FIXME:This module is obsolete, yuo must refactor it.
00041
00042 #if 0
00043 #include "hw/hw_cpu.h"
00044 #include "timer_simple_avr.h"
00045 #include <drv/wdt.h>
00046 #include <cfg/compiler.h>
00047 #include <cfg/macros.h>
00048 #include <hw_cpu.h>
00049
00050 #include <avr/io.h>
00051
00052
00053 #define MS_PER_SEC 1000UL
00054 #define TIMER_PRESCALER 64UL
00055 #define TIMER_DELAY_1MS (255 - CLOCK_FREQ / TIMER_PRESCALER / MS_PER_SEC)
00056
00061 void timer_delay(mtime_t time)
00062 {
00063
00064 TCCR0 = BV(CS02);
00065
00066 while (time--)
00067 {
00068
00069 TCNT0 = TIMER_DELAY_1MS;
00070
00071 TIFR |= BV(TOV0);
00072
00073 while (!(TIFR & BV(TOV0)));
00074 #if CONFIG_WATCHDOG
00075 wdt_reset();
00076 #endif
00077 }
00078 }
00079 #endif
00080