Overridable Options - Part 5
Apply `ENABLED` / `DISABLED` macros to files needing only a small number of changes.
This commit is contained in:
committed by
Richard Wackerbarth
parent
5e834352a9
commit
58cfcd4239
@ -42,10 +42,10 @@
|
||||
attached() - Returns true if there is a servo attached.
|
||||
detach() - Stops an attached servos from pulsing its i/o pin.
|
||||
|
||||
*/
|
||||
*/
|
||||
#include "Configuration.h"
|
||||
|
||||
#ifdef NUM_SERVOS
|
||||
#if HAS_SERVOS
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <Arduino.h>
|
||||
@ -103,29 +103,29 @@ static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t
|
||||
#ifndef WIRING // Wiring pre-defines signal handlers so don't define any if compiling for the Wiring platform
|
||||
|
||||
// Interrupt handlers for Arduino
|
||||
#ifdef _useTimer1
|
||||
#if ENABLED(_useTimer1)
|
||||
SIGNAL (TIMER1_COMPA_vect) { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
|
||||
#endif
|
||||
|
||||
#ifdef _useTimer3
|
||||
#if ENABLED(_useTimer3)
|
||||
SIGNAL (TIMER3_COMPA_vect) { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
|
||||
#endif
|
||||
|
||||
#ifdef _useTimer4
|
||||
#if ENABLED(_useTimer4)
|
||||
SIGNAL (TIMER4_COMPA_vect) { handle_interrupts(_timer4, &TCNT4, &OCR4A); }
|
||||
#endif
|
||||
|
||||
#ifdef _useTimer5
|
||||
#if ENABLED(_useTimer5)
|
||||
SIGNAL (TIMER5_COMPA_vect) { handle_interrupts(_timer5, &TCNT5, &OCR5A); }
|
||||
#endif
|
||||
|
||||
#else //!WIRING
|
||||
|
||||
// Interrupt handlers for Wiring
|
||||
#ifdef _useTimer1
|
||||
#if ENABLED(_useTimer1)
|
||||
void Timer1Service() { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
|
||||
#endif
|
||||
#ifdef _useTimer3
|
||||
#if ENABLED(_useTimer3)
|
||||
void Timer3Service() { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
|
||||
#endif
|
||||
|
||||
@ -133,7 +133,7 @@ static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t
|
||||
|
||||
|
||||
static void initISR(timer16_Sequence_t timer) {
|
||||
#ifdef _useTimer1
|
||||
#if ENABLED(_useTimer1)
|
||||
if (timer == _timer1) {
|
||||
TCCR1A = 0; // normal counting mode
|
||||
TCCR1B = _BV(CS11); // set prescaler of 8
|
||||
@ -152,7 +152,7 @@ static void initISR(timer16_Sequence_t timer) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _useTimer3
|
||||
#if ENABLED(_useTimer3)
|
||||
if (timer == _timer3) {
|
||||
TCCR3A = 0; // normal counting mode
|
||||
TCCR3B = _BV(CS31); // set prescaler of 8
|
||||
@ -170,7 +170,7 @@ static void initISR(timer16_Sequence_t timer) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _useTimer4
|
||||
#if ENABLED(_useTimer4)
|
||||
if (timer == _timer4) {
|
||||
TCCR4A = 0; // normal counting mode
|
||||
TCCR4B = _BV(CS41); // set prescaler of 8
|
||||
@ -180,7 +180,7 @@ static void initISR(timer16_Sequence_t timer) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _useTimer5
|
||||
#if ENABLED(_useTimer5)
|
||||
if (timer == _timer5) {
|
||||
TCCR5A = 0; // normal counting mode
|
||||
TCCR5B = _BV(CS51); // set prescaler of 8
|
||||
|
Reference in New Issue
Block a user