Skip to content

add a .set_count(count_value) method to Qei #676

@eZioPan

Description

@eZioPan

There will be 2 benifit of it.

  1. When users call .set_count() on Qei setup, underlying TIM CNT can have value like 0x8_000(for 16bit TIM) or 8_000_000 (for 32bit TIM), thus greatly avoid TIM underflow. Currently CNT of TIM set to 0 at begining, if user try decrease count, then CNT will read as (2^16) - x or (2^32) - x.
  2. Some Rotary Encoders use its shaft as a push button. When it pushed, we can use .set_count() clear/set CNT value. (eg. a volume thumbwheel to set volume to default).

I do a #677 , but there seems some weird problems. I guess the unsafe {} may related to PAC crate?
Don't know if it's a good idea to make a PR with this code quality.
Anyway, I make a PR.

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