diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2008-11-01 22:06:13 +0000 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2008-11-01 22:06:13 +0000 |
commit | de4710abc813016d8a2bddcc2fb1a19be43c01de (patch) | |
tree | fa2dc220559eb9d577e2f2354c0ec02660d6ab6b /cores/arduino/wiring_analog.c | |
parent | e42b8d7ef811df7f552582c57cda66a275670fe4 (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_analog.c')
-rwxr-xr-x | cores/arduino/wiring_analog.c | 14 |
1 files changed, 7 insertions, 7 deletions
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); |