-
-
Notifications
You must be signed in to change notification settings - Fork 347
Introduce Clock framework and Polled Timers #1821
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
Conversation
|
Quite a few structuraly rearrangements here but I'm feeling quite confident that it's the right direction in support of ESP32. Moving all the low-level stuff into separate drivers simplifies the class implementations without sacrificing performance or bloating the firmware. This PR has been pulled out of a larger development with some additions for Sming, which I'll summarise briefly so you've got an idea where I'm going:
Polled timers are something that can simplify and streamline driver code so it needs to be somewhere accessible, Core seems like the right place though as always totally open to suggestions. |
|
Note before merging I'll need to update the migration docs. for this and expand on |
Ping me when this PR is ready. |
hw_timer driver and introduce Polled Timershw_timer driver and introduce Polled Timers
|
I'm splitting this PR as it's become quite complex. |
9e1ffb6 to
c4966dd
Compare
hw_timer driver and introduce Polled Timersc4966dd to
04ea8fd
Compare
`NanoTime` provides time calculation support and base template classes for Clocks and Time Sources. `Platform/Clocks.h` parameterises all clock sources `PolledTimer.h` provides template class for implementing polled (elapse and timeout) timers `Platform/Timers.h` defines available timer types Add implementation of `esp_get_count()' to `esp_clk.h`, together with `ets_get_cpu_frequency` declaration.
04ea8fd to
3e92bcd
Compare
|
@slaff Quite a lot of changes here and new concepts so feedback on the general approach very welcome. |
ef6c486 to
b484d6d
Compare
|
@mikee47 Is this PR tested and ready? |
|
@slaff Yes indeed. |
Polled Timers are a new feature, based heavily on the esp8266 Arduino project's PolledTimeout.h
https://github.com/esp8266/Arduino/blob/master/cores/esp8266/PolledTimeout.h.
PR #1830 added muldiv and introduced the use of std::ratio which makes use of C++ language features
to perform compile-time calculations and parameter checking. This PR builds on that using the new
NanoTime library. I felt this warranted new development since existing solutions are either C-based
or not suited for embedded use. This also forms a core part of the Sming timer framework.
This PR moves the existing ElapseTimer and CycleCounter classes into Core. I've taken care to avoid
any extraneous dependencies in these timers which means they're appropriate for use in lower-level
code (Components, drivers, etc.).
The goal is to provide a consistent, logical framework for all timers.
More information can be found in the docs under 'timers'.