Conversation
Contributor
Author
|
Update: PCA9554 async functionality added |
|
Not really a WIP anymore, I have been testing this for the past 6 months and it works great. Any feedback would be greatly appreciated |
|
Hi, what's the status of this? This sounds very useful and I would like to use it. Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds asynchronous pin-waiting support using embedded-hal-async to the port-expander crate. It introduces a new PinAsync type that implements digital::Wait, along with a shared AsyncPortState and an InterruptHandler to be invoked from a hardware ISR.
Its a WIP and in its current state works for my specific use-case - So far, I've only provided async support for the PCA9702 driver. I plan to extend this to other drivers (e.g., PCA9554A and MCP23S17) which I am actively using in my own projects.
@Rahix previously mentioned not wanting to force embedded-hal-async on users. My intention is not to force an async model on all users, but rather to provide an additional optional layer for those who do want to rely on embedded-hal-async for pin interrupt handling. The current approach still keeps the “wait for interrupt” part separate from the actual hardware ISR. Instead, the crate user can call into the InterruptHandler via their own ISR or background task, whichever pattern they choose. The interrupt handling logic remains in their domain.
I look forward to feedback and any suggestions on how to better integrate or scope this functionality. Even if this PR ends up serving only as a reference implementation or a starting point for future work, I hope it can be useful as an example of how embedded-hal-async might be integrated in this crate. Let me know what you think—happy to discuss other design approaches as well!