Skip to content

Unable to use InputPin #205

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

Closed
David-OConnor opened this issue Apr 18, 2020 · 7 comments
Closed

Unable to use InputPin #205

David-OConnor opened this issue Apr 18, 2020 · 7 comments

Comments

@David-OConnor
Copy link

David-OConnor commented Apr 18, 2020

pub fn f<P: embedded_hal::v2::digitial::InputPin>(pin: &P)  {
};
^^^^^^^^^^^^^^^^^^^^ the trait `embedded_hal::digital::v1::InputPin` is not implemented for `&rppal::gpio::pin::InputPin`

I'm not sure why v1's in there. It's not implemented, but I don't understand what I did to require it to be implemented.

Edit: If I wrap the struct and try to manually impl the v1 trait, it argues I'm impling conflicting implementations; this is a second vote for v1 coming out of v2.

@ryankurte
Copy link
Contributor

hmm, strange. this looks like it could be related to #199 if rppal has not been updated to v2 traits, which you could test with cargo patch / is waiting on me having time to put together a patch release.

@eldruin
Copy link
Member

eldruin commented Apr 25, 2020

rppal is using the v2 traits only in the master branch. This was not released yet.
@David-OConnor can you try using the master branch version of rppal?

@David-OConnor
Copy link
Author

David-OConnor commented Apr 25, 2020

Thank you very much - it sounds like that's it. I'm still getting the same v1 error, but haven't spent much time troubleshooting.

Is this how you specify the dep?

rppal = { git="https://github.com/golemparts/rppal", branch="master", features=["hal-unproven"] }

Of note, I've had good luck with other embedded-hal implementors, so this sounds like a rppal thing.

@David-OConnor
Copy link
Author

David-OConnor commented Apr 25, 2020

Working now using that git.

edit: Nvm, not working. Digging through the rppal source code trying to find where the v1 is sneaking in; nothing yet.

At the core:

note: required because of the requirements on the impl of `embedded_hal::digital::v2::InputPin` for `&rppal::gpio::pin::InputPin`

rppal's code for InputPin is here.

@David-OConnor
Copy link
Author

This seems to have something to due to using the structs directly, vice having them borrowed from a RefCel<Rc<>>. Ie the latter triggers it while the former doesn't. Still can't pin down where the v1 requirement is coming from.

@eldruin
Copy link
Member

eldruin commented Jul 15, 2020

We made some fixes in embedded-hal 0.2.4.
@David-OConnor Could you run cargo update and see if the problem is solved?

@David-OConnor
Copy link
Author

Fixed! Thank you.

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

No branches or pull requests

3 participants