From 3a48c9240d33a32f7afdcb06ac345fa24d4aa46b Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Fri, 16 May 2014 18:53:17 +0200 Subject: Support TIMER1C Some devices, such as the atmega2560 or the atmega256rfr2 have a timer1c output. It seems this output is not connected to anything on the Arduino Mega, but this allows using it on third party hardware nonetheless. --- cores/arduino/wiring_analog.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cores/arduino/wiring_analog.c') diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index 8feead9..48a9ef5 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -160,6 +160,14 @@ void analogWrite(uint8_t pin, int val) break; #endif + #if defined(TCCR1A) && defined(COM1C1) + case TIMER1C: + // connect pwm to pin on timer 1, channel B + sbi(TCCR1A, COM1C1); + OCR1C = val; // set pwm duty + break; + #endif + #if defined(TCCR2) && defined(COM21) case TIMER2: // connect pwm to pin on timer 2 -- cgit v1.2.3-18-g5258