1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-01 23:29:28 +01:00

added support for TIMER4D used for PWM on Leonardo and Micro D6

This commit is contained in:
Zach Eveland 2011-09-16 16:36:42 -04:00
parent b898a35f76
commit 30fc9919e1
2 changed files with 12 additions and 3 deletions

View File

@ -169,9 +169,10 @@ extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
#define TIMER4A 11 #define TIMER4A 11
#define TIMER4B 12 #define TIMER4B 12
#define TIMER4C 13 #define TIMER4C 13
#define TIMER5A 14 #define TIMER4D 14
#define TIMER5B 15 #define TIMER5A 15
#define TIMER5C 16 #define TIMER5B 16
#define TIMER5C 17
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"

View File

@ -226,6 +226,14 @@ void analogWrite(uint8_t pin, int val)
break; break;
#endif #endif
#if defined(TCCR4A) && defined(COM4D1)
case TIMER4D:
// connect pwm to pin on timer 4, channel D
sbi(TCCR4A, COM4D1);
OCR4D = val; // set pwm duty
break;
#endif
#if defined(TCCR5A) && defined(COM5A1) #if defined(TCCR5A) && defined(COM5A1)
case TIMER5A: case TIMER5A:
// connect pwm to pin on timer 5, channel A // connect pwm to pin on timer 5, channel A