stm32f1xx-hal icon indicating copy to clipboard operation
stm32f1xx-hal copied to clipboard

Cannot change timer input polarity

Open samueltardieu opened this issue 5 months ago • 0 comments

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.

samueltardieu avatar Jan 25 '24 13:01 samueltardieu