mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
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.
This commit is contained in:
parent
c12e24a826
commit
02135349a9
@ -194,20 +194,21 @@ extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
|
||||
#define TIMER0B 2
|
||||
#define TIMER1A 3
|
||||
#define TIMER1B 4
|
||||
#define TIMER2 5
|
||||
#define TIMER2A 6
|
||||
#define TIMER2B 7
|
||||
#define TIMER1C 5
|
||||
#define TIMER2 6
|
||||
#define TIMER2A 7
|
||||
#define TIMER2B 8
|
||||
|
||||
#define TIMER3A 8
|
||||
#define TIMER3B 9
|
||||
#define TIMER3C 10
|
||||
#define TIMER4A 11
|
||||
#define TIMER4B 12
|
||||
#define TIMER4C 13
|
||||
#define TIMER4D 14
|
||||
#define TIMER5A 15
|
||||
#define TIMER5B 16
|
||||
#define TIMER5C 17
|
||||
#define TIMER3A 9
|
||||
#define TIMER3B 10
|
||||
#define TIMER3C 11
|
||||
#define TIMER4A 12
|
||||
#define TIMER4B 13
|
||||
#define TIMER4C 14
|
||||
#define TIMER4D 15
|
||||
#define TIMER5A 16
|
||||
#define TIMER5B 17
|
||||
#define TIMER5C 18
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "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
|
||||
|
@ -84,6 +84,9 @@ static void turnOffPWM(uint8_t timer)
|
||||
#if defined(TCCR1A) && defined(COM1B1)
|
||||
case TIMER1B: cbi(TCCR1A, COM1B1); break;
|
||||
#endif
|
||||
#if defined(TCCR1A) && defined(COM1C1)
|
||||
case TIMER1C: cbi(TCCR1A, COM1C1); break;
|
||||
#endif
|
||||
|
||||
#if defined(TCCR2) && defined(COM21)
|
||||
case TIMER2: cbi(TCCR2, COM21); break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user