|
|
@ -168,8 +168,8 @@ static void initISR(timer16_Sequence_t timer) {
|
|
|
|
SBI(TIFR, OCF3A); // clear any pending interrupts;
|
|
|
|
SBI(TIFR, OCF3A); // clear any pending interrupts;
|
|
|
|
SBI(ETIMSK, OCIE3A); // enable the output compare interrupt
|
|
|
|
SBI(ETIMSK, OCIE3A); // enable the output compare interrupt
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
TIFR3 = _BV(OCF3A); // clear any pending interrupts;
|
|
|
|
SBI(TIFR3, OCF3A); // clear any pending interrupts;
|
|
|
|
TIMSK3 = _BV(OCIE3A) ; // enable the output compare interrupt
|
|
|
|
SBI(TIMSK3, OCIE3A); // enable the output compare interrupt
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifdef WIRING
|
|
|
|
#ifdef WIRING
|
|
|
|
timerAttach(TIMER3OUTCOMPAREA_INT, Timer3Service); // for Wiring platform only
|
|
|
|
timerAttach(TIMER3OUTCOMPAREA_INT, Timer3Service); // for Wiring platform only
|
|
|
@ -183,7 +183,7 @@ static void initISR(timer16_Sequence_t timer) {
|
|
|
|
TCCR4B = _BV(CS41); // set prescaler of 8
|
|
|
|
TCCR4B = _BV(CS41); // set prescaler of 8
|
|
|
|
TCNT4 = 0; // clear the timer count
|
|
|
|
TCNT4 = 0; // clear the timer count
|
|
|
|
TIFR4 = _BV(OCF4A); // clear any pending interrupts;
|
|
|
|
TIFR4 = _BV(OCF4A); // clear any pending interrupts;
|
|
|
|
TIMSK4 = _BV(OCIE4A) ; // enable the output compare interrupt
|
|
|
|
TIMSK4 = _BV(OCIE4A); // enable the output compare interrupt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -193,7 +193,7 @@ static void initISR(timer16_Sequence_t timer) {
|
|
|
|
TCCR5B = _BV(CS51); // set prescaler of 8
|
|
|
|
TCCR5B = _BV(CS51); // set prescaler of 8
|
|
|
|
TCNT5 = 0; // clear the timer count
|
|
|
|
TCNT5 = 0; // clear the timer count
|
|
|
|
TIFR5 = _BV(OCF5A); // clear any pending interrupts;
|
|
|
|
TIFR5 = _BV(OCF5A); // clear any pending interrupts;
|
|
|
|
TIMSK5 = _BV(OCIE5A) ; // enable the output compare interrupt
|
|
|
|
TIMSK5 = _BV(OCIE5A); // enable the output compare interrupt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -203,21 +203,21 @@ static void finISR(timer16_Sequence_t timer) {
|
|
|
|
#ifdef WIRING
|
|
|
|
#ifdef WIRING
|
|
|
|
if (timer == _timer1) {
|
|
|
|
if (timer == _timer1) {
|
|
|
|
CBI(
|
|
|
|
CBI(
|
|
|
|
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
|
|
|
|
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
|
|
|
|
TIMSK1
|
|
|
|
TIMSK1
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
TIMSK
|
|
|
|
TIMSK
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
, OCIE1A); // disable timer 1 output compare interrupt
|
|
|
|
, OCIE1A); // disable timer 1 output compare interrupt
|
|
|
|
timerDetach(TIMER1OUTCOMPAREA_INT);
|
|
|
|
timerDetach(TIMER1OUTCOMPAREA_INT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (timer == _timer3) {
|
|
|
|
else if (timer == _timer3) {
|
|
|
|
CBI(
|
|
|
|
CBI(
|
|
|
|
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
|
|
|
|
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
|
|
|
|
TIMSK3
|
|
|
|
TIMSK3
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
ETIMSK
|
|
|
|
ETIMSK
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
, OCIE3A); // disable the timer3 output compare A interrupt
|
|
|
|
, OCIE3A); // disable the timer3 output compare A interrupt
|
|
|
|
timerDetach(TIMER3OUTCOMPAREA_INT);
|
|
|
|
timerDetach(TIMER3OUTCOMPAREA_INT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|