-
Notifications
You must be signed in to change notification settings - Fork 225
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
Initial embassy support #225
Conversation
Awesome! Just out of curiosity: do you know of a roadmap when those git dependencies will get published on crates.io? |
726c6b9
to
1b09b1c
Compare
embassy-time and embassy-sync have both been published on crates.io. |
59d7306
to
17aa6a6
Compare
I've rebased this on |
ca925e4
to
9a0d099
Compare
This is now ready for review! Still looking into the S2 issue, but I don't think it's related to the implementation here. It's either a bug in the atomic emulation crate or a codegen issue. |
03809f2
to
2c6b9af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a handful of comments, but overall it's looking quite good to me. Thanks again for your work on this!
I'm not super excited about the changes required for the ESP32-S2, though that's not your fault at all. I hope we can find a more elegant solution in the future.
#[cfg_attr( | ||
all( | ||
feature = "embassy-time-timg", | ||
any(feature = "esp32", feature = "esp32s3", feature = "esp32s2") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this isn't supported for all chips? We should state that somewhere if there is, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the timg on the c3 (and I think c2) only has one configurable alarm, so the systick should be used instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that's fine for now then. I do think we either need to document this or define a new configuration symbol in our build script just because it's not immediately clear what's going on by looking at the code. But this can be done later, won't block the PR on it.
Great job! Jesse already did a careful code-review so not too much from my side
Seems like the build failures are just network issues? |
c2f14d8
to
77c847c
Compare
I don't think we can do this because the time driver is a choice for some chips, like the s2 & s3. Maybe it's possible to improve the error message if a time driver is not selected. |
Ah I thought we could make a choice for the user 😄 in general it would be great if every user can get a sample to run at the second attempt (i.e. after learning some feature needs to be specified) |
I suppose we could but it then makes testing CI harder.
I think I will do a follow up PR soon which should address this, but for now I want to get the baseline embassy support in so we can start messing around with some drivers :) |
77c847c
to
4ea4316
Compare
- read_raw on timg renamed to now() - timg initialized and stored in static for use in the embassy driver - timg sets alarm value - untested whether alarms actually trigger
- Adds the timg timer block as a time driver for embassy - Not enabled on the C3 as it only has one timer block, better to use systimer - s2 example added but can't build due to atomic requirements in futures-core
- Fix intr prio array being off by one - emabssy time prio interrupt set to max prio - use cfg instead of feature for systick detection
4ea4316
to
39d78c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and verified for all chips, so I think we're good to go! Thanks again for your work on this, very excited to move forward with async
support!
* wip: timg embassy driver - read_raw on timg renamed to now() - timg initialized and stored in static for use in the embassy driver - timg sets alarm value - untested whether alarms actually trigger * TIMG timer driver for esp32, esp32s3 - Adds the timg timer block as a time driver for embassy - Not enabled on the C3 as it only has one timer block, better to use systimer - s2 example added but can't build due to atomic requirements in futures-core * Add S2 atomic support with emulation, fixup embassy support for the S2 * Move executor & static-cell to dev deps. Make eha optional * Add c2 support, run fmt * Update to crates.io embassy releases * Update eha * update timg time driver to new trait * Remove exception feature of esp-backtrace and use the user handler for backtracing * Add async testing workflow * Update systick example * Fix S2 examples * Update xtensa-toolchain * set rustflags for s2 target * Disable systick for esp32s2 until we can fix the noted issues * review improvements - Fix intr prio array being off by one - emabssy time prio interrupt set to max prio - use cfg instead of feature for systick detection * Update example time delays
The following features are now available in
esp-hal-common
:async
, enables eh1, eha, and embassy-syncembassy
, enables embassy-time and the base time driver implementationembassy-time-systick
&embassy-time-timg
features add embassy driver support for either the systick or timg peripheralThis PR also enables atomic emulation for the esp32s2 by default, the examples have been updated. I've also implemented Deref for the Timer wrapping structs to allow calling the underlying functions without boilerplate.
Blocked on
Unresolved issues
Closes #231
Closes #232