Improve and use timer abstractions
Thank you for your contribution!
We appreciate the time and effort you've put into this pull request. To help us review it efficiently, please ensure you've gone through the following checklist:
Submission Checklist 📝
- [x] I have updated existing examples or added new ones (if applicable).
- [x] I have used
cargo xtask fmt-packagescommand to ensure that all changed code is formatted correctly. - [x] My changes were added to the
CHANGELOG.mdin the proper section. - [x] My changes are in accordance to the esp-rs API guidelines
Extra:
- [x] I have read the CONTRIBUTING.md guide and followed its instructions.
Pull Request Details 📖
Description
- make esp-wifi::initialize take a
PeriodicTimer<ErasedTimer> - make the embassy time-driver take
OneShotTimer<ErasedTimer>references
This enables the user to use any hw-timer for esp-wifi (no matter if from TIMG0, TIMG1 or SYSTIMER) and use any combination of hw-timers for the embassy-time-driver. It also gets rid of the features to select the embassy time-driver implementation.
Testing
Run the (changed) examples ideally at least on ESP32, ESP32-S2 and any other chip
Side note: The underlying timers probably should wrap modifications on shared registers in a critical-section (#1739 already addresses that for SYSTIMER). That is out of scope for this PR
Sorry for the huge amount of changed code here but I think it makes sense to have this in one PR - fortunately much of the changes are just adapted examples. BTW the examples use different timers and patterns for initialization - that's to show the flexibility of the API and on purpose