Skip to content

Provide the ability to choose a timer for megaavr #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions src/megaavr/ServoTimers.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,18 @@

#include <avr/io.h>

//#define USE_TIMERB1 // interferes with PWM on pin 3
#define USE_TIMERB2 // interferes with PWM on pin 11
//#define USE_TIMERB0 // interferes with PWM on pin 6

#if !defined(USE_TIMERB1) && !defined(USE_TIMERB2) && !defined(USE_TIMERB0)
# error "No timers allowed for Servo"
/* Please uncomment a timer above and rebuild */
#define USE_TIMERB2 // default timer
#endif

static volatile TCB_t* _timer =
#if defined(USE_TIMERB0)
#if defined(USE_TIMERB0) // interferes with PWM on pin 6
&TCB0;
#endif
#if defined(USE_TIMERB1)
#if defined(USE_TIMERB1) // interferes with PWM on pin 3
&TCB1;
#endif
#if defined(USE_TIMERB2)
#if defined(USE_TIMERB2) // interferes with PWM on pin 11
&TCB2;
#endif

Expand Down