stm32f1xx-hal
stm32f1xx-hal copied to clipboard
Cannot change timer input polarity
While working with an QEI encoder, I could not find a safe way of changing the polarity of one of the encoders inputs. I had to use
unsafe {
stm32f1xx_hal::pac::Peripherals::steal()
.TIM2
.ccer
.modify(|_, w| w.cc2p().set_bit());
}
after Timer::new()
since this method resets the timer to its default configuration, so it is not possible to configure CCER
in advance.
There should be a way of changing the polarity either from the Timer
object or from the Qei
one.