Skip to content
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

Implemented InputPin trait for output pins #105

Closed
wants to merge 5 commits into from
Closed

Implemented InputPin trait for output pins #105

wants to merge 5 commits into from

Conversation

David-OConnor
Copy link
Contributor

This enables things like OneWire. Equiv of this PR from the 4xx lib.

@jeru
Copy link

jeru commented Jun 16, 2020

+1. I also need this functionality, to implement a weird "bidirectional" SPI for ST7735 TFT.

And it is already implemented in the "brother" crate stm32f4xx-hal (https://github.com/stm32-rs/stm32f4xx-hal/blob/b6f010538a4f86db207b23440d3053339ce08397/src/gpio.rs#L179).

@David-OConnor
Copy link
Contributor Author

David-OConnor commented Jul 11, 2020

Status? This is the sort of functionality that is required to support a relatively-common protocol, and ommitting it fragments the ecosystem with people using forks etc instead of crates.io.

@Sh3Rm4n
Copy link
Member

Sh3Rm4n commented Jul 14, 2020

Sorry for the long delay. I'll hope to catch up again in the next days :)

What about this concern: #84 (comment)?

I havn't thought it through myself. Implementing for OpenDrain seems fine though. Maybe we could mark the PushPull implementation unsafe or at least add a comment to use this function with caution.

src/rcc.rs Outdated Show resolved Hide resolved
src/gpio.rs Show resolved Hide resolved
@teskje
Copy link
Collaborator

teskje commented Jul 17, 2020

Please run rustfmt on the code again. It's currently complaining about one superfluous newline. This is what makes the Travis jobs fail.

@teskje
Copy link
Collaborator

teskje commented Jul 17, 2020

I also noticed that since the GPIO refactoring to use variants was merged, this should also be adapted in this PR. I've quickly done this myself, hope you don't mind me going off your changes @David-OConnor.

I had to create a new PR since I cannot just push to a branch in your repo: #114. Would be cool if you could check it out and report if it works for your use-case. You'll notice that I restricted the InputPin impls to Output<OpenDrain> only, based on what was discussed in #84. Looking at the onewire lib they are using OpenDrain too, so that shouldn't be an issue.

@teskje teskje closed this Jul 18, 2020
@teskje
Copy link
Collaborator

teskje commented Jul 18, 2020

Closed in favor of #114.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants