#1-wire #one-wire #w1

owfs

Rust SDK for OWFS (1-Wire file system)

8 releases

0.0.8 Jun 3, 2022
0.0.7 Jun 3, 2022

#728 in Filesystem

41 downloads per month

MIT license

10KB
256 lines

owfs-rs

Rust SDK for OWFS (1-Wire file system)

Example:

unsafe {
    owfs::init("localhost:4304").unwrap();
    let devices = owfs::scan(owfs::ScanOptions::default()).unwrap();
    for d in devices {
        dbg!(&d.info());
        if d.attrs().contains(&"PIO.1") {
            d.set("PIO.1", "1").unwrap();
        }
    }
    owfs::finish();
}

Requires linking with owcapi lib, build.rs example:

fn main() {
    let os = env::var("CARGO_CFG_TARGET_OS").unwrap();
    match os.as_str() {
        "linux" => {
            println!("cargo:rustc-link-lib=ow");
            println!("cargo:rustc-link-lib=owcapi");
        }
        _ => unimplemented!(),
    };
    println!("cargo:rustc-link-search=/usr/lib/x86_64-linux-gnu");
}

Dependencies

~42KB