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:
parent
20fbc3613d
commit
ba4f3808c2
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue