Skip to content

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

@dzimmanck

Description

@dzimmanck

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;

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