Skip to content

Pwm trait requires real-world time knowledge #226

Open
@eldruin

Description

@eldruin

The Pwm trait is cumbersome to implement in a driver like the PCA9685 driver due to the try_set_period and try_get_period methods, which depend on knowledge of the "real-world" frequency on which everything is running.

This can even be an external input and thus subject to external change plus configurable through a prescaler or power configuration and so on.

Even when solving this (e.g. by having the user provide the value directly), in the try_set_period implementation the driver will need to calculate an approximation to a combination of prescaler and/or other configs. This may be possible but I feel this is something that the driver user would rather determine themselves so that the authoritatively provided frequency is followed exactly.

Additionally, choosing a Time type seems difficult because of precision and conversion issues.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions