Crate tmp117

Source
Expand description

§Tmp117

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.

§Usage

// 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();

§MSRV

Currently 1.75 and up is supported, but some previous nightly version may work

§License

Licensed under either of

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.

License: MIT OR Apache-2.0

Re-exports§

pub use error::Error;

Modules§

asynchronous
Async drivers of the tmp117
error
Errors used for the driver
register
The definitions of drivers of the TMP117
tmp117_ll
The low level driver of the TPM117

Structs§

ContinuousConfig
The continuous config
ContinuousHandler
Handler for the continuous mode
Id
Represents the ID of the device.
Tmp117
The TMP117 driver. Note that the alert pin is not used in this driver, see the async implementation if you want the driver to use the alert pin in the drive

Enums§

Alert
The types of alerts possible

Constants§

CELCIUS_CONVERSION
Conversion factor used by the device. One lsb is this value