27 #define MICROSECONDS_PER_TIMER0_OVERFLOW (clockCyclesToMicroseconds(64 * 256)) 30 #define MILLIS_INC (MICROSECONDS_PER_TIMER0_OVERFLOW / 1000) 35 #define FRACT_INC ((MICROSECONDS_PER_TIMER0_OVERFLOW % 1000) >> 3) 36 #define FRACT_MAX (1000 >> 3) 42 #if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) 68 uint8_t oldSREG = SREG;
81 uint8_t oldSREG = SREG,
t;
90 #error TIMER 0 not defined 94 if ((TIFR0 & _BV(TOV0)) && (t < 255))
97 if ((TIFR & _BV(TOV0)) && (t < 255))
112 while ( ms > 0 && (
micros() - start) >= 1000) {
127 #if F_CPU >= 24000000L 143 #elif F_CPU >= 20000000L 148 __asm__ __volatile__ (
165 #elif F_CPU >= 16000000L 182 #elif F_CPU >= 12000000L 199 #elif F_CPU >= 8000000L 220 if (us <= 16)
return;
221 if (us <= 25)
return;
234 __asm__ __volatile__ (
235 "1: sbiw %0,1" "\n\t" 236 "brne 1b" :
"=w" (us) :
"0" (us)
250 #if defined(TCCR0A) && defined(WGM01) 256 #if defined(__AVR_ATmega128__) 259 #elif defined(TCCR0) && defined(CS01) && defined(CS00) 263 #elif defined(TCCR0B) && defined(CS01) && defined(CS00) 267 #elif defined(TCCR0A) && defined(CS01) && defined(CS00) 272 #error Timer 0 prescale factor 64 not set correctly 276 #if defined(TIMSK) && defined(TOIE0) 278 #elif defined(TIMSK0) && defined(TOIE0) 281 #error Timer 0 overflow interrupt not set correctly 289 #if defined(TCCR1B) && defined(CS11) && defined(CS10) 294 #if F_CPU >= 8000000L 297 #elif defined(TCCR1) && defined(CS11) && defined(CS10) 299 #if F_CPU >= 8000000L 304 #if defined(TCCR1A) && defined(WGM10) 309 #if defined(TCCR2) && defined(CS22) 311 #elif defined(TCCR2B) && defined(CS22) 318 #if defined(TCCR2) && defined(WGM20) 320 #elif defined(TCCR2A) && defined(WGM20) 326 #if defined(TCCR3B) && defined(CS31) && defined(WGM30) 332 #if defined(TCCR4A) && defined(TCCR4B) && defined(TCCR4D) 340 #if defined(TCCR4B) && defined(CS41) && defined(WGM40) 347 #if defined(TCCR5B) && defined(CS51) && defined(WGM50) 355 #if F_CPU >= 16000000 // 16 MHz / 128 = 125 KHz 359 #elif F_CPU >= 8000000 // 8 MHz / 64 = 125 KHz 363 #elif F_CPU >= 4000000 // 4 MHz / 32 = 125 KHz 367 #elif F_CPU >= 2000000 // 2 MHz / 16 = 125 KHz 371 #elif F_CPU >= 1000000 // 1 MHz / 8 = 125 KHz 375 #else // 128 kHz / 2 = 64 KHz -> This is the closest you can get, the prescaler is 2 389 #elif defined(UCSR0B) void delay(unsigned long ms)
volatile unsigned long timer0_overflow_count
#define clockCyclesPerMicrosecond()
volatile unsigned long timer0_millis
static unsigned char timer0_fract
void delayMicroseconds(unsigned int us)
GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble f