Crates.io | w1_therm_reader |
lib.rs | w1_therm_reader |
version | 0.1.0 |
source | src |
created_at | 2019-09-01 13:32:31.79656 |
updated_at | 2019-09-01 13:32:31.79656 |
description | A simple parser for w1_therm file on linux |
homepage | |
repository | https://github.com/gaetronik/w1_therm_reader |
max_upload_size | |
id | 161338 |
size | 6,768 |
This lib aims at providing a simple way to read temperature out of a w1_therm
compatible sensor connected to a linux machine. See the kernel documentation to know which devices are compatibles.
If you want a complete OneWire library, this crate is not the one you're looking for. Maybe Onewire.
It was a way to give nom a try.
This lib as passed the "work for me stage" but it has not been thoroughly tested. This is developed on my free tim and I'm not a seasoned developer. Feel free to create PRs.
extern crate w1_therm_reader;
use w1_therm_reader::{read_from_file, read_from_device, convert_to_metric};
fn main() {
// get the temperature from a file
let t = read_from_file("/path/to/w1/").unwrap();
// get the temperature from device
let t = read_from_file("10-000001").unwrap();
// get the temperature in °C instead of m°C
let t_metric = convert_to_metric(t);
}