diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2011-10-21 11:54:11 -0400 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2011-10-21 11:54:11 -0400 |
commit | d3fa070d10331727b9094b4976a94a8143dcba30 (patch) | |
tree | 2faa5fbc0f3962a8992e6c80de338c4dc738abcf /cores/arduino | |
parent | 4387ea19901b1bc29481dc176843037b9584d55a (diff) |
Lowering timer 1 prescale factor (to 8 from 64) for F_CPU less than 8 MHz.
Otherwise, you can see flicker on an LED.
Diffstat (limited to 'cores/arduino')
-rwxr-xr-x | cores/arduino/wiring.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c index 1b3fd44..bc01949 100755 --- a/cores/arduino/wiring.c +++ b/cores/arduino/wiring.c @@ -221,11 +221,15 @@ void init() // set timer 1 prescale factor to 64 sbi(TCCR1B, CS11); +#if F_CPU >= 8000000L sbi(TCCR1B, CS10); +#endif #elif defined(TCCR1) && defined(CS11) && defined(CS10) sbi(TCCR1, CS11); +#if F_CPU >= 8000000L sbi(TCCR1, CS10); #endif +#endif // put timer 1 in 8-bit phase correct pwm mode #if defined(TCCR1A) && defined(WGM10) sbi(TCCR1A, WGM10); |