diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2009-03-25 10:50:00 +0000 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2009-03-25 10:50:00 +0000 |
commit | a42326aba2fd9696a4b2e1239a5a222014056ff5 (patch) | |
tree | 69288e62749704d81d7ab11079e5868022bdc174 /cores/arduino/wiring.c | |
parent | b89ee8da481d7b9c360b689f367b7a234ec7cb11 (diff) |
Adding support for the Arduino Mega (ATmega1280) to the core and bootloader.
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 |