diff options
author | Matthijs Kooijman <matthijs@stdin.nl> | 2014-05-16 18:53:17 +0200 |
---|---|---|
committer | Matthijs Kooijman <matthijs@stdin.nl> | 2014-05-16 18:57:04 +0200 |
commit | 3a48c9240d33a32f7afdcb06ac345fa24d4aa46b (patch) | |
tree | 5bd0dd1d4a47bea93304a6c35564799ec85e0992 /cores/arduino/wiring_analog.c | |
parent | 6d4273609b2f8d8c71ff30bda6e075f3d50e335a (diff) |
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.
Diffstat (limited to 'cores/arduino/wiring_analog.c')
-rw-r--r-- | cores/arduino/wiring_analog.c | 8 |
1 files changed, 8 insertions, 0 deletions
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 |