Skip to content

Cannot change timer input polarity #478

@samueltardieu

Description

@samueltardieu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions