Skip to content

Commit ba4f380

Browse files
author
MicroBahner
committed
channel output disabled in non pwm-mode
pwmMode disables the channel output in non pwm modes. Attached ISRs are left unchanged
1 parent 20fbc36 commit ba4f380

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

STM32F1/cores/maple/stm32f1/wirish_digital_f1.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,14 @@ void pinMode(uint8 pin, WiringPinMode mode) {
7979

8080
gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_bit, outputMode);
8181

82-
if (pwm && PIN_MAP[pin].timer_device != NULL) {
83-
/* Enable/disable timer channels if we're switching into PWM. */
82+
if (PIN_MAP[pin].timer_device != NULL) {
83+
if ( pwm ) { // we're switching into PWM, enable timer channels
8484
timer_set_mode(PIN_MAP[pin].timer_device,
8585
PIN_MAP[pin].timer_channel,
8686
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+
}
8791
}
8892
}

0 commit comments

Comments
 (0)