From de4710abc813016d8a2bddcc2fb1a19be43c01de Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Sat, 1 Nov 2008 22:06:13 +0000 Subject: Switching tests for __AVR_ATmega168__ to tests for __AVR_ATmega8__ so that less changes are needed to support other processors. --- cores/arduino/wiring_analog.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'cores/arduino/wiring_analog.c') diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index de0372e..f3767d2 100755 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -87,7 +87,13 @@ void analogWrite(uint8_t pin, int val) sbi(TCCR1A, COM1B1); // set pwm duty OCR1B = val; -#if defined(__AVR_ATmega168__) +#if defined(__AVR_ATmega8__) + } else if (digitalPinToTimer(pin) == TIMER2) { + // connect pwm to pin on timer 2, channel B + sbi(TCCR2, COM21); + // set pwm duty + OCR2 = val; +#else } else if (digitalPinToTimer(pin) == TIMER0A) { if (val == 0) { digitalWrite(pin, LOW); @@ -116,12 +122,6 @@ void analogWrite(uint8_t pin, int val) sbi(TCCR2A, COM2B1); // set pwm duty OCR2B = val; -#else - } else if (digitalPinToTimer(pin) == TIMER2) { - // connect pwm to pin on timer 2, channel B - sbi(TCCR2, COM21); - // set pwm duty - OCR2 = val; #endif } else if (val < 128) digitalWrite(pin, LOW); -- cgit v1.2.3-18-g5258