-
Notifications
You must be signed in to change notification settings - Fork 28
Parallel OutputBus trait #20
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
|
That's a good improvement, I like it. Nit: Your example impl of NB: I have been meaning to add support for parallel busses to |
|
Looks like a great alternative to me, but I'll have to say that this still doesn't fully fix #18, because the user can still implement a custom |
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.
I think with these changes this would fix #18
Thanks!
Oops, fixed
An
Thanks!
The An implementation of I will be sure to make a note of all of this when I write the docs. |
Yeah I know, I'm not arguing that
This is already the case. A user implementing a Anyway, now that I think about it, with your implementation this is a non-issue, because if such a problem comes up it will be the user's fault and not this crate's fault, since the user has the responsibility of implementing this correctly. |
Exactly 😉 |
|
I think this is a great PR. Is this ready to be merged? |
|
It is now! 👍 Let me know if I should squash anything. |
|
A squash would be nice, yes. |
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.
LGTM, thanks for sticking with me.
OutputBus
This PR changes
PGPIO8BitInterfaceto use a simpleOutputBustrait instead of a bunch of individual pins:Generic8BitBus
This PR also provides an
OutputBusimplementation that can be constructed from 8OutputPins:or
(Note that the construction is fallible because it attempts to set all the pins low, which fixes #18)
Custom OutputBus
For reference, here is an example of an optimized
OutputBusimplementation for an stm32f1 with a bus on pins PB0 through PB7Pros
PGPIO8BitInterfacedoesn't take a million arguments anymoreOutputBuswith much higher performanceCons
OutputBusbefore they can construct aPGPIO8BitInterface. This is slightly more verbose, but it is more readable in my opinionTodo