Skip to content

Commit ec09ead

Browse files
committed
Lowering timer 1 prescale factor (to 8 from 64) for F_CPU less than 8 MHz.
Otherwise, you can see flicker on an LED.
1 parent f684321 commit ec09ead

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

hardware/arduino/cores/arduino/wiring.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,14 @@ void init()
221221

222222
// set timer 1 prescale factor to 64
223223
sbi(TCCR1B, CS11);
224+
#if F_CPU >= 8000000L
224225
sbi(TCCR1B, CS10);
226+
#endif
225227
#elif defined(TCCR1) && defined(CS11) && defined(CS10)
226228
sbi(TCCR1, CS11);
229+
#if F_CPU >= 8000000L
227230
sbi(TCCR1, CS10);
231+
#endif
228232
#endif
229233
// put timer 1 in 8-bit phase correct pwm mode
230234
#if defined(TCCR1A) && defined(WGM10)

0 commit comments

Comments
 (0)