Skip to content

time-driver and tick-hz selection is difficult and often incorrect #70

@d3zd3z

Description

@d3zd3z

Our zephyr crate provides a feature time-driver that provides an implementation of embassy-time's time driver. However, this functionality requires a tick rate to be set for the clock.

Zephyr supports fairly widely diverse tick rates, as does embassy-time. The challenge is getting them to the time driver. Right now, the tick rate must be set in Cargo.toml, which makes it uncorrelated with the actual tick rate. I could detect this, and possibly even fail at compile time (both are constants), at least forcing the user to set them correctly, but then any tests would fail to build across multiple targets.

Another suggestion was to set the tick rate to something like 1Mhz, and do conversions whenever converting to/from a Zephyr tick. Unfortunately, this can be challenging as the Zephyr tick values are fairly diverse (one target uses 993Hz, most are powers of 2, or small-factor multiples of 10).

Thoughts would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions