aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/wiring.c
diff options
context:
space:
mode:
authorZach Eveland <zeveland@blacklabel-development.com>2011-12-18 14:18:38 -0500
committerZach Eveland <zeveland@blacklabel-development.com>2011-12-18 14:18:38 -0500
commit177641003c53844ad73584553a9d44f2da4648e2 (patch)
tree49cd8fcc2f9957a2d69db21891252de3a707d680 /cores/arduino/wiring.c
parent9bd7761e3a77e939b54dc05241a57c64f1c55b74 (diff)
fixed digitalWrite on timer 4 pins (D6 and D13)
Diffstat (limited to 'cores/arduino/wiring.c')
-rw-r--r--cores/arduino/wiring.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c
index 9c264d0..fb447eb 100644
--- a/cores/arduino/wiring.c
+++ b/cores/arduino/wiring.c
@@ -281,11 +281,15 @@ void init()
#if defined(TCCR4A) && defined(TCCR4B) && defined(TCCR4D) /* beginning of timer4 block for 32U4 and similar */
sbi(TCCR4A, COM4A1); // clear channel A on output compare match
+ cbi(TCCR4A, COM4A0);
sbi(TCCR4C, COM4D1); // clear channel D on output compare match
+ cbi(TCCR4C, COM4D0);
sbi(TCCR4B, CS42); // set timer4 prescale factor to 64
sbi(TCCR4B, CS41);
sbi(TCCR4B, CS40);
sbi(TCCR4D, WGM40); // put timer 4 in phase- and frequency-correct PWM mode
+ sbi(TCCR4A, PWM4A); // enable PWM mode for comparator OCR4A
+ sbi(TCCR4C, PWM4D); // enable PWM mode for comparator OCR4D
#else /* beginning of timer4 block for ATMEGA1280 and ATMEGA2560 */
#if defined(TCCR4B) && defined(CS41) && defined(WGM40)
sbi(TCCR4B, CS41); // set timer 4 prescale factor to 64