Skip to content

Commit f504460

Browse files
committed
Fixing Servo library on the ATmega8 by changing assignments to TIMSK and TIFR into bitwise-or's. Otherwise, this broke millis() by disabling the timer 0 overflow interrupt.
1 parent 456d3eb commit f504460

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libraries/Servo/Servo.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ static void initISR(servoTimer_t timer)
128128
TCCR1B = _BV(CS11); // set prescaler of 8
129129
TCNT1 = 0; // clear the timer count
130130
#if defined(__AVR_ATmega8__)
131-
TIFR = _BV(OCF1A); // clear any pending interrupts;
132-
TIMSK = _BV(OCIE1A) ; // enable the output compare interrupt
131+
TIFR |= _BV(OCF1A); // clear any pending interrupts;
132+
TIMSK |= _BV(OCIE1A) ; // enable the output compare interrupt
133133
#else
134-
TIFR1 = _BV(OCF1A); // clear any pending interrupts;
135-
TIMSK1 = _BV(OCIE1A) ; // enable the output compare interrupt
134+
TIFR1 |= _BV(OCF1A); // clear any pending interrupts;
135+
TIMSK1 |= _BV(OCIE1A) ; // enable the output compare interrupt
136136
#endif
137137
}
138138
#if defined(__AVR_ATmega1280__)

0 commit comments

Comments
 (0)