diff options
Diffstat (limited to 'cores/arduino/wiring.c')
-rwxr-xr-x | cores/arduino/wiring.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c index aaf7b86..73c26f2 100755 --- a/cores/arduino/wiring.c +++ b/cores/arduino/wiring.c @@ -196,6 +196,17 @@ void init() sbi(TCCR2A, WGM20); #endif +#if defined(__AVR_ATmega1280__) + // set timer 3, 4, 5 prescale factor to 64 + sbi(TCCR3B, CS31); sbi(TCCR3B, CS30); + sbi(TCCR4B, CS41); sbi(TCCR4B, CS40); + sbi(TCCR5B, CS51); sbi(TCCR5B, CS50); + // put timer 3, 4, 5 in 8-bit phase correct pwm mode + sbi(TCCR3A, WGM30); + sbi(TCCR4A, WGM40); + sbi(TCCR5A, WGM50); +#endif + // set a2d prescale factor to 128 // 16 MHz / 128 = 125 KHz, inside the desired 50-200 KHz range. // XXX: this will not work properly for other clock speeds, and |