Skip to content

Add a Timer type/trait #20

@PTaylor-us

Description

@PTaylor-us

I think it's important to make a distinction between a clock and a timer. These are my current working definitions:

  • Clock: Any entity that periodically counts (ie a hardware timer/counter peripheral). Generally, this needs to be monotonic. A wrapping clock is considered monotonic in this context as long as it fulfills the other requirements.
  • Timer: An entity that counts toward an expiration.

In terms of a Clock interrupt/wake feature I was working on, a timer is based on a clock and holds the instant at which the timer expires. Upon expiration a number of different things could happen including an interrupt/wake, a semaphore, etc.

Features I would expect for a clock:

  • get an instant

Features I would expect from a timer:

  • set the duration
  • start
  • restart (not resume)
  • poll the status (not-running, running-enabled, running-disabled, expired)
  • set the action to be taken upon expiration
  • enable/disable action (enable/disable interrupt)
  • block until expired (wait/delay)

Metadata

Metadata

Assignees

No one assigned

    Labels

    WIPWork-In-ProgressdiscussionSomething that needs more discussionenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions