gpiocdev-embedded-hal
A Rust library implementing embedded-hal traits for GPIO lines on Linux platforms using the GPIO character device using gpiocdev.
Example Usage
Reading line value:
use InputPin;
// request the line
let mut pin = new?;
// get the value
if pin.is_high?
Setting a line:
use OutputPin;
use PinState;
// request the line
let mut pin = new?;
// do something...
// change value later
pin.set_low?;
Requesting a line by name:
use InputPin;
let mut pin = from_name?;
Waiting for events on a line:
use InputPin;
use Wait;
// request the line
let mut pin = new?;
// wait for line edge events
pin.wait_for_any_edge.await?;
Working examples can be found in the examples directory.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.