--- ../arduino/hardware/cores/arduino/wiring.c 2008-04-21 15:14:53.000000000 -0400 +++ wiring.c 2008-04-21 20:34:26.000000000 -0400 @@ -127,12 +127,12 @@ // on the ATmega168, timer 0 is also used for fast hardware pwm // (using phase-correct PWM would mean that timer 0 overflowed half as often // resulting in different millis() behavior on the ATmega8 and ATmega168) -#if defined(__AVR_ATmega168__) +#if defined(__AVR_ATmega168__) || defined(__AVR_ATtiny13__) sbi(TCCR0A, WGM01); sbi(TCCR0A, WGM00); #endif // set timer 0 prescale factor to 64 -#if defined(__AVR_ATmega168__) +#if defined(__AVR_ATmega168__) || defined(__AVR_ATtiny13__) sbi(TCCR0B, CS01); sbi(TCCR0B, CS00); #else @@ -140,7 +140,7 @@ sbi(TCCR0, CS00); #endif // enable timer 0 overflow interrupt -#if defined(__AVR_ATmega168__) +#if defined(__AVR_ATmega168__) || defined(__AVR_ATtiny13__) sbi(TIMSK0, TOIE0); #else sbi(TIMSK, TOIE0); @@ -152,19 +152,24 @@ // 8 MHz (with a 16 MHz clock) at 50% duty cycle // set timer 1 prescale factor to 64 +#if defined(__AVR_ATtiny13__) +#else sbi(TCCR1B, CS11); sbi(TCCR1B, CS10); // put timer 1 in 8-bit phase correct pwm mode sbi(TCCR1A, WGM10); +#endif // set timer 2 prescale factor to 64 -#if defined(__AVR_ATmega168__) +#if defined(__AVR_ATtiny13__) +#elif defined(__AVR_ATmega168__) sbi(TCCR2B, CS22); #else sbi(TCCR2, CS22); #endif // configure timer 2 for phase correct pwm (8-bit) -#if defined(__AVR_ATmega168__) +#if defined(__AVR_ATtiny13__) +#elif defined(__AVR_ATmega168__) sbi(TCCR2A, WGM20); #else sbi(TCCR2, WGM20); @@ -184,7 +189,8 @@ // the bootloader connects pins 0 and 1 to the USART; disconnect them // here so they can be used as normal digital i/o; they will be // reconnected in Serial.begin() -#if defined(__AVR_ATmega168__) +#if defined(__AVR_ATtiny13__) +#elif defined(__AVR_ATmega168__) UCSR0B = 0; #else UCSRB = 0;