channel output disabled in non pwm-mode

pwmMode disables the channel output in non pwm modes.
Attached ISRs are left unchanged
This commit is contained in:
MicroBahner 2017-05-20 16:11:00 +02:00
parent 20fbc3613d
commit ba4f3808c2
1 changed files with 6 additions and 2 deletions

View File

@ -79,10 +79,14 @@ void pinMode(uint8 pin, WiringPinMode mode) {
gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_bit, outputMode);
if (pwm && PIN_MAP[pin].timer_device != NULL) {
/* Enable/disable timer channels if we're switching into PWM. */
if (PIN_MAP[pin].timer_device != NULL) {
if ( pwm ) { // we're switching into PWM, enable timer channels
timer_set_mode(PIN_MAP[pin].timer_device,
PIN_MAP[pin].timer_channel,
TIMER_PWM );
} else { // disable channel output in non pwm-Mode
timer_cc_disable(PIN_MAP[pin].timer_device,
PIN_MAP[pin].timer_channel);
}
}
}