Skip to content

Commit 6891e40

Browse files
Merge pull request #288 from MicroBahner/pinmodeTimer
Added Pinmode timer fix by @MicroBahner
2 parents bd8ef73 + ba4f380 commit 6891e40

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

STM32F1/cores/maple/stm32f1/wirish_digital_f1.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,13 @@ void pinMode(uint8 pin, WiringPinMode mode) {
8080
gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_bit, outputMode);
8181

8282
if (PIN_MAP[pin].timer_device != NULL) {
83-
/* Enable/disable timer channels if we're switching into or
84-
* out of PWM. */
83+
if ( pwm ) { // we're switching into PWM, enable timer channels
8584
timer_set_mode(PIN_MAP[pin].timer_device,
8685
PIN_MAP[pin].timer_channel,
87-
pwm ? TIMER_PWM : TIMER_DISABLED);
86+
TIMER_PWM );
87+
} else { // disable channel output in non pwm-Mode
88+
timer_cc_disable(PIN_MAP[pin].timer_device,
89+
PIN_MAP[pin].timer_channel);
90+
}
8891
}
8992
}

0 commit comments

Comments
 (0)