File tree Expand file tree Collapse file tree 4 files changed +34
-14
lines changed Expand file tree Collapse file tree 4 files changed +34
-14
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ typedef uint8_t boolean;
118118typedef uint8_t byte ;
119119
120120void init (void );
121+ void initVariant (void );
121122
122123void pinMode (uint8_t , uint8_t );
123124void digitalWrite (uint8_t , uint8_t );
@@ -194,20 +195,21 @@ extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
194195#define TIMER0B 2
195196#define TIMER1A 3
196197#define TIMER1B 4
197- #define TIMER2 5
198- #define TIMER2A 6
199- #define TIMER2B 7
200-
201- #define TIMER3A 8
202- #define TIMER3B 9
203- #define TIMER3C 10
204- #define TIMER4A 11
205- #define TIMER4B 12
206- #define TIMER4C 13
207- #define TIMER4D 14
208- #define TIMER5A 15
209- #define TIMER5B 16
210- #define TIMER5C 17
198+ #define TIMER1C 5
199+ #define TIMER2 6
200+ #define TIMER2A 7
201+ #define TIMER2B 8
202+
203+ #define TIMER3A 9
204+ #define TIMER3B 10
205+ #define TIMER3C 11
206+ #define TIMER4A 12
207+ #define TIMER4B 13
208+ #define TIMER4C 14
209+ #define TIMER4D 15
210+ #define TIMER5A 16
211+ #define TIMER5B 17
212+ #define TIMER5C 18
211213
212214#ifdef __cplusplus
213215} // extern "C"
Original file line number Diff line number Diff line change 1919
2020#include < Arduino.h>
2121
22+ // Weak empty variant initialization function.
23+ // May be redefined by variant files.
24+ void initVariant () __attribute__((weak));
25+ void initVariant () { }
26+
2227int main (void )
2328{
2429 init ();
2530
31+ initVariant ();
32+
2633#if defined(USBCON)
2734 USBDevice.attach ();
2835#endif
Original file line number Diff line number Diff line change @@ -160,6 +160,14 @@ void analogWrite(uint8_t pin, int val)
160160 break ;
161161 #endif
162162
163+ #if defined(TCCR1A ) && defined(COM1C1 )
164+ case TIMER1C :
165+ // connect pwm to pin on timer 1, channel B
166+ sbi (TCCR1A , COM1C1 );
167+ OCR1C = val ; // set pwm duty
168+ break ;
169+ #endif
170+
163171 #if defined(TCCR2 ) && defined(COM21 )
164172 case TIMER2 :
165173 // connect pwm to pin on timer 2
Original file line number Diff line number Diff line change @@ -84,6 +84,9 @@ static void turnOffPWM(uint8_t timer)
8484 #if defined(TCCR1A ) && defined(COM1B1 )
8585 case TIMER1B : cbi (TCCR1A , COM1B1 ); break ;
8686 #endif
87+ #if defined(TCCR1A ) && defined(COM1C1 )
88+ case TIMER1C : cbi (TCCR1A , COM1C1 ); break ;
89+ #endif
8790
8891 #if defined(TCCR2 ) && defined(COM21 )
8992 case TIMER2 : cbi (TCCR2 , COM21 ); break ;
You can’t perform that action at this time.
0 commit comments