aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/wiring_analog.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_analog.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_analog.c')
-rwxr-xr-xcores/arduino/wiring_analog.c14
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);