-
Notifications
You must be signed in to change notification settings - Fork 139
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
Implement a polling async SPI interface #129
base: master
Are you sure you want to change the base?
Conversation
Thank you for the pull request, @dflemstr! It seems that nobody (including me) has the time to look into it right now. Sorry! Feel free to ping @nrf-rs/nrf52 and @nrf-rs/nrf91, to remind us, if you feel it's taken too long. |
Pinging @nrf-rs/nrf52 and @nrf-rs/nrf91 :) |
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.
This LGTM, but I haven't tested it.
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.
Haven't reviewed this in-depth (in particulat for soundness regarding lifetime variance etc.), but left a few comments. Sorry this is taking so long, I'd love to spend a lot of time I don't have to work on this HAL.
This comment has been minimized.
This comment has been minimized.
I think this looks basically fine now. Have you tested this on real hardware? |
I have tested it on a Particle Argon, but the SPI slave device (which is custom made...) has a few power glitches (even when using a different master device) so I would appreciate some secondary testing by someone with a more reliable SPI slave device |
Isn't this API susceptible to the |
@thalesfragoso how would you recommend that we fix it in this case? |
Right now, I see two solutions:
|
@thalesfragoso @jonas-schievink as you might see from the PR metadata, I've decided to get some clarity around async HAL in rust-embedded/embedded-hal#206 before I'd feel comfortable with picking a direction for how to continue this PR. |
Addresses a part of #128. The existing code was moved around and with an optimizing compiler I expect it to generate the same code as before.
There are also new polling versions of the transfer functions that don't block. The idea is that one could call these from interrupt handlers to get non-blocking/low power SPI transfers. The returned types intentionally don't implement
core::future::Future
since that would require waker management.See https://github.com/dflemstr/embedded-platform/tree/master/platforms/nrf52840 for higher-level async code that could be supported by this change.