unbothered-gpio

Crates.iounbothered-gpio
lib.rsunbothered-gpio
version0.1.0
sourcesrc
created_at2021-11-07 11:19:28.578739
updated_at2021-11-07 11:19:28.578739
descriptionGPIO reader, writer and listener
homepage
repositoryhttps://github.com/Y0GAAAA/unbothered-gpio/
max_upload_size
id478038
size5,493
(Y0GAAAA)

documentation

README

Unbothered gpio

Everything is unwrapped under the hood for the precious prettiness of your code. It's more than a simple Rust crate, it's a philosophy of life.

Reading

use unbothered_gpio::{UnbotheredGpioPin, UnbotheredGpioPinReader};

// Open pin 17 for reading
let mut reader = UnbotheredGpioPinReader::new(17);

let state: bool = reader.read();
println!("Pin 17 state : {}", state);

Writing

use unbothered_gpio::{UnbotheredGpioPin, UnbotheredGpioPinWriter};

// Open pin 17 for writing
let mut writer = UnbotheredGpioPinWriter::new(17);

// Set gpio pin 17 state to true
writer.write(true);

Listening

use unbothered_gpio::UnbotheredGpioPinListener;

UnbotheredGpioPinListener::new(17, |state: bool| {
    println!("New state for pin 17 : {}", state)
}).keep_alive();
Commit count: 0

cargo fmt