hdc1080

Crates.iohdc1080
lib.rshdc1080
version0.1.0
sourcesrc
created_at2018-12-18 23:29:35.611953
updated_at2018-12-18 23:29:35.611953
descriptionPlatform-agnostic Rust driver for the HDC1080 digital humidity and temperature sensor.
homepagehttps://github.com/iohe/hdc1080-rs
repositoryhttps://github.com/iohe/hdc1080-rs
max_upload_size
id102611
size28,899
Ioan Herisanu (iohe)

documentation

https://docs.rs/hdc1080

README

Rust HDC1080 Temperature and Humidity Sensor

crates.io Docs Build Status Coverage Status Maintenance Intention

This is based on LM75 work of Diego Barrios Romero

This is a platform agnostic Rust driver for the HDC1080 temperature and humidity sensor, based on the I2CDevice traits.

This driver allows you to:

  • Enable/disable the device.
  • Read the temperature.

The device

The HDC1080 temperature sensor includes a delta-sigma analog-to-digital converter, and a digital overtemperature detector. The host can query the HDC1080 through its I2C interface to read temperature at any time.

Datasheet:

Usage

extern crate i2cdev;
extern crate hdc1080;

use hal::I2cdev;
use hdc1080::{ Hdc1080, SlaveAddr };

const HDC1080_SLAVE_ADDR: u16 = 0x40;

fn main() {
    let dev = LinuxI2CDevice::new("/dev/i2c-0", HDC1080_SLAVE_ADDR).unwrap();
    let mut sensor = Hdc1080::new(dev);

    sensor.read_temperature_start().unwrap();
    thread::sleep(time::Duration::from_millis(500u64));
    let temp_celsius = sensor.read_temperature_finish().unwrap();
    println!("Temperature: {}ÂșC", temp_celsius);
}

License

Licensed under either of

Contributing

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.

Commit count: 2

cargo fmt