Crates.io | tmp117 |
lib.rs | tmp117 |
version | 2.0.0 |
source | src |
created_at | 2024-01-10 15:12:24.841648 |
updated_at | 2024-11-11 15:17:52.965296 |
description | Driver for the tmp117 using the embedded-hal |
homepage | https://github.com/xgroleau/tmp117-rs |
repository | https://github.com/xgroleau/tmp117-rs |
max_upload_size | |
id | 1095299 |
size | 43,348 |
A no_std platform agnostic driver in rust for the TMP117 temperature sensor using the embedded-hal and the device-register library. A Sync and Async API is available, see the examples folder for more complete usage The high level api always makes sure the device is in shutdownmode to save battery. The low level api is always available if needed.
// Pass the address of the tmp device
let tmp = Tmp117::<_, _, _>::new(spi, 0x49);
let delay = Delay;
tmp.reset(delay).unwrap();
// Transition to continuous mode and shutdown after the closure
let mut tmp_cont = tmp.continuous(Default::default(), |t| {
// Get the value continuously in continuous mode
for _ in 0..10 {
/// Can transparently return error ehere
let temp = tmp.wait_temp()?;
info!("Temperature {}", temp);
};
Ok(())
}).unwrap();
Currently 1.75
and up is supported, but some previous nightly version may work
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.
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.
License: MIT OR Apache-2.0