From aa7a43efce35fa41d57f9858ee41be0c33e84709 Mon Sep 17 00:00:00 2001 From: Perry Hung Date: Tue, 12 Oct 2010 20:58:48 -0400 Subject: Add selective enabling of channels for pwm channels pinMode(PWM) turns the channel on, other modes should turn it off Fixes bug with conflicting timer for spi1 and timer. This is not well-tested. Conflicts: libmaple/timers.c --- libmaple/timers.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'libmaple/timers.c') diff --git a/libmaple/timers.c b/libmaple/timers.c index 5b97e20..334ec0b 100644 --- a/libmaple/timers.c +++ b/libmaple/timers.c @@ -103,19 +103,15 @@ void timer_init(uint8 timer_num, uint16 prescale) { * we'll worry about that later. */ timer->CCR1 = 0x8FFF; // PWM start value timer->CCMR1 |= 0x68; // PWM mode 1, enable preload register. - timer->CCER |= 0x001; // enable ch timer->CCR2 = 0x8FFF; // PWM start value timer->CCMR1 |= (0x68 << 8);// PWM mode 1, enable preload register. - timer->CCER |= 0x010; // enable ch timer->CCR3 = 0x8FFF; // PWM start value timer->CCMR2 |= 0x68; // PWM mode 1, enable preload register. - timer->CCER |= 0x100; // enable ch timer->CCR4 = 0x8FFF; // PWM start value timer->CCMR2 |= (0x68 << 8);// PWM mode 1, enable preload register. - timer->CCER |= 0x1000; // enable ch /* Advanced timer? */ if (is_advanced) { -- cgit v1.2.3