aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/wiring.c
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2008-11-01 22:06:13 +0000
committerDavid A. Mellis <d.mellis@arduino.cc>2008-11-01 22:06:13 +0000
commitde4710abc813016d8a2bddcc2fb1a19be43c01de (patch)
treefa2dc220559eb9d577e2f2354c0ec02660d6ab6b /cores/arduino/wiring.c
parente42b8d7ef811df7f552582c57cda66a275670fe4 (diff)
Switching tests for __AVR_ATmega168__ to tests for __AVR_ATmega8__ so that less changes are needed to support other processors.
Diffstat (limited to 'cores/arduino/wiring.c')
-rwxr-xr-xcores/arduino/wiring.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c
index 31e0247..19f348c 100755
--- a/cores/arduino/wiring.c
+++ b/cores/arduino/wiring.c
@@ -130,23 +130,23 @@ void init()
// 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_ATmega8__)
sbi(TCCR0A, WGM01);
sbi(TCCR0A, WGM00);
#endif
// set timer 0 prescale factor to 64
-#if defined(__AVR_ATmega168__)
- sbi(TCCR0B, CS01);
- sbi(TCCR0B, CS00);
-#else
+#if defined(__AVR_ATmega8__)
sbi(TCCR0, CS01);
sbi(TCCR0, CS00);
+#else
+ sbi(TCCR0B, CS01);
+ sbi(TCCR0B, CS00);
#endif
// enable timer 0 overflow interrupt
-#if defined(__AVR_ATmega168__)
- sbi(TIMSK0, TOIE0);
-#else
+#if defined(__AVR_ATmega8__)
sbi(TIMSK, TOIE0);
+#else
+ sbi(TIMSK0, TOIE0);
#endif
// timers 1 and 2 are used for phase-correct hardware pwm
@@ -161,16 +161,16 @@ void init()
sbi(TCCR1A, WGM10);
// set timer 2 prescale factor to 64
-#if defined(__AVR_ATmega168__)
- sbi(TCCR2B, CS22);
-#else
+#if defined(__AVR_ATmega8__)
sbi(TCCR2, CS22);
+#else
+ sbi(TCCR2B, CS22);
#endif
// configure timer 2 for phase correct pwm (8-bit)
-#if defined(__AVR_ATmega168__)
- sbi(TCCR2A, WGM20);
-#else
+#if defined(__AVR_ATmega8__)
sbi(TCCR2, WGM20);
+#else
+ sbi(TCCR2A, WGM20);
#endif
// set a2d prescale factor to 128
@@ -187,9 +187,9 @@ void init()
// 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__)
- UCSR0B = 0;
-#else
+#if defined(__AVR_ATmega8__)
UCSRB = 0;
+#else
+ UCSR0B = 0;
#endif
} \ No newline at end of file