/** * \file * * * \brief Some simple delay routines. * * Simple serial driver * \author Francesco Sacchi */ #warning FIXME:This module is obsolete, yuo must refactor it. #if 0 #include #include "timer_simple_avr.h" #include #include #include /* BV() */ #include #define MS_PER_SEC 1000UL #define TIMER_PRESCALER 64UL #define TIMER_DELAY_1MS (255 - CPU_FREQ / TIMER_PRESCALER / MS_PER_SEC) /** * Wait \a time ms using timer 0. * */ void timer_delay(mtime_t time) { /* Set timer clock to clock_freq/64 */ TCCR0 = BV(CS02); while (time--) { /* Initialize timer counter register */ TCNT0 = TIMER_DELAY_1MS; /* Clear overflow bit. */ TIFR |= BV(TOV0); /* Wait overflow. */ while (!(TIFR & BV(TOV0))); #if CONFIG_WATCHDOG wdt_reset(); #endif } } #endif