aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/wiring.c
diff options
context:
space:
mode:
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