Skip to content

CountDown timer API should be configured with a time period, not a frequency #378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dzimmanck opened this issue Nov 4, 2021 · 3 comments

Comments

@dzimmanck
Copy link

The builder methods (start and start_countdown) accept a variable called timeout, which must be convertible into Hertz. This does not make sense to me. A Countdown should "count down from X" where X is a time duration, not a frequency. This leads to non-sensical looking code like:

let frequency = timeout.into.0

Also, it means you loose A LOT of precision on the timer. You can no longer precisely control the timer delay in increments of cycles due to this division.

let ticks = self.clk.0 / frequency;

@burrbull
Copy link
Member

burrbull commented Nov 5, 2021

Related to rust-embedded/embedded-hal#201

@dbrgn
Copy link
Contributor

dbrgn commented Nov 11, 2021

Related to #235.

Related to rust-embedded/embedded-hal#201

Is there any reason why this couldn't / shouldn't be changed in this HAL without waiting for e-h to specify a unified standard?

@burrbull
Copy link
Member

#381

@burrbull burrbull closed this as completed May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants