Skip to content

Add a Timer type/trait #20

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
PTaylor-us opened this issue Jun 22, 2020 · 0 comments · Fixed by #21
Closed

Add a Timer type/trait #20

PTaylor-us opened this issue Jun 22, 2020 · 0 comments · Fixed by #21
Labels
discussion Something that needs more discussion enhancement New feature or request WIP Work-In-Progress

Comments

@PTaylor-us
Copy link
Member

PTaylor-us commented Jun 22, 2020

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)
@PTaylor-us PTaylor-us added enhancement New feature or request WIP Work-In-Progress discussion Something that needs more discussion labels Jun 22, 2020
@PTaylor-us PTaylor-us linked a pull request Jun 25, 2020 that will close this issue
@PTaylor-us PTaylor-us added discussion Something that needs more discussion enhancement New feature or request WIP Work-In-Progress and removed WIP Work-In-Progress discussion Something that needs more discussion enhancement New feature or request labels Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Something that needs more discussion enhancement New feature or request WIP Work-In-Progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant