-
Notifications
You must be signed in to change notification settings - Fork 234
Add dummy GPIO pins #237
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
Add dummy GPIO pins #237
Conversation
r? @therealprof (rust_highfive has picked a reviewer for you, use r? to override) |
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.
As usual is missing a CHANGELOG entry.
I think this is nice addition in general which we should take in.
0bcf6f7
to
baf8b22
Compare
I added a changelog entry now, albeit quite short. |
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.
Works for me. Let's wait a bit whether @ryankurte has any concerns.
I mentioned that it is zero-cost and improved the documentation a bit now. Sorry for the re-review. |
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.
No worries, looks even better now. 🎉
hmm i am not so convinced by this approach, it would seem to me to introduce ambiguity that is better expressed via the type system (which does perhaps require more exploration and documentation). as an example, if a driver can use a pin but does not require it, i believe it should be implemented over both conditions in the manner that is correct for the device, rather than via a dummy pin that the driver cannot be aware of. i have an example of this planned, but, haven’t yet had a chance to implement it... for the mentioned SPI case i believe further work is required to accurately represent and abstract over transactions and busses with managed or unmanaged |
Why would the application need to be aware of a dummy pin? In the end it's always the user who needs to decide how to wire the hardware and how to configure it. We do have dummy pins of the required type/implementing the required traits pretty in pretty much any HAL impl which is okay but not great. The larger issue here is that in generic drivers you cannot make use those so either you require the user to provide the correct types or implement the dummy pin themselves. I think having these here provides a nice and coherent addition to the traits which might also be useful to write tests, etc. |
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.
Looks useful to me. Some docs-only nitpicking below.
i wrote a whole thing but i don't have the time / energy to edit it and the majority of the issues are already raised by the author in #141. the cliff-notes follow, i apologise if it comes off as brisk but it's what i can manage at the moment 🙃
i am uncomfortable with the current PR as it would appear to me that the issues with this approach raised in #141 are not adequately addressed, and that there are better mechanisms to represent this without providing a blessed approach to functionally violate the driver type constraints. i would really like to see more discussion of the possible approaches and limitations of each in #141 before landing this (or similar), but my current feeling is:
|
We discussed this controversely in todays meeting and opinons are wildly varying. It doesn't seem like we can easily find a solution which pleases everyone. Unnominating for now but we need to find a good way to resolve such deadlocks in the future. |
Co-authored-by: Danilo Bargen <mail@dbrgn.ch>
Co-authored-by: Danilo Bargen <mail@dbrgn.ch>
Co-authored-by: Danilo Bargen <mail@dbrgn.ch>
Co-authored-by: Danilo Bargen <mail@dbrgn.ch>
Co-authored-by: Danilo Bargen <mail@dbrgn.ch>
Alright, I put this implementation into its own crate: dummy-pin so that people that are interested can use it (compatible with |
This is an implementation of #141 to get the ball rolling.
I put everything into a single
DummyPin
since the level can be put into a typestate for zero cost and then it can be used for cases where the requirement isInputPin + OutputPin
.Alternatives:
DummyOutputPin
,DummyInputPin
,DummyStatefulOutputPin
.DummyInputPin
andDummyStatefulOutputPin
.