GPIO with `embedded_hal`
David-OConnor opened this issue · 1 comments
David-OConnor commented
Hi. How can we use the GPIO pins with functions that expected embedded_hal
implementations?
What I'm attempting:
Cargo.toml
:
rppal = { version = "0.11.3", features=["hal"] }
Code:
let gpio = Gpio::new().unwrap();
let pin = gpio.get(7).unwrap().into_io(Mode::Alt1); // or into_input()
find_devices(pin);
Error:
the trait bound `rppal::gpio::pin::IoPin: embedded_hal::digital::v1::InputPin` is not satisfied
This file, if I understand correctly, may point to the cause of the error, by omission:
https://github.com/golemparts/rppal/blob/master/src/gpio/hal.rs
edit: It also looks like it would be easy to support StatefulOutputPin
, since the included methods are supported in rppal. Am I missing something re why it's not working? A workaround is to use thin wrappers that impl the hal
traits, and wrap the rppal
methods.
Should I PR this?
David-OConnor commented
It looks like the answer is to use the hal-unproven
feature.