Skip to content

Commit 01dce8b

Browse files
authored
Add #include directive for megaAVR dependency
The TCB_t type used in the megaAVR version of the library is declared via avr/io.h, but the Servo library does not contain an #include directive for this file. This is not a problem when the library is used in a .ino file, since Arduino.h does have an #include directive for that file and the sketch preprocessor should insert the #include directive for Arduino.h. However, if the Servo library is instead used from a separate translation unit, the dependency was missing and compilation for megaAVR fails: E:\arduino\libraries\Servo\src/megaavr/ServoTimers.h:36:17: error: 'TCB_t' does not name a type static volatile TCB_t* _timer = ^
1 parent 4c5faae commit 01dce8b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/megaavr/ServoTimers.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#ifndef __SERVO_TIMERS_H__
2525
#define __SERVO_TIMERS_H__
2626

27+
#include <avr/io.h>
28+
2729
#define USE_TIMERB1 // interferes with PWM on pin 3
2830
//#define USE_TIMERB2 // interferes with PWM on pin 11
2931
//#define USE_TIMERB0 // interferes with PWM on pin 6

0 commit comments

Comments
 (0)