Crates.io | hdc20xx |
lib.rs | hdc20xx |
version | 0.1.0 |
source | src |
created_at | 2020-03-01 21:17:52.834915 |
updated_at | 2020-03-01 21:17:52.834915 |
description | Platform-agnostic Rust driver for the HDC2080, HDC2010 and HDC2021 low-power humidity and temperature digital sensor. |
homepage | https://github.com/eldruin/hdc20xx-rs |
repository | https://github.com/eldruin/hdc20xx-rs |
max_upload_size | |
id | 214252 |
size | 47,671 |
This is a platform agnostic Rust driver for the HDC2080, HDC2021 and HDC2010
low-power humidity and temperature digital sensor using the embedded-hal
traits.
This driver allows you to:
set_measurement_mode()
.read()
.status()
.software_reset()
.manufacturer_id()
.device_id()
.The HDC2080 device is an integrated humidity and temperature sensor that provides high accuracy measurements with very low power consumption in a small DFN package. The capacitive-based sensor includes new integrated digital features and a heating element to dissipate condensation and moisture.
The HDC2080 digital features include programmable interrupt thresholds to provide alerts and system wake-ups without requiring a microcontroller to be continuously monitoring the system. Combined with programmable sampling intervals, a low power consumption, and a support for a 1.8-V supply voltage, the HDC2080 is designed for battery-operated systems.
This driver is compatible with HDC2080, HDC2021 and HDC2010.
Datasheets: HDC2080, HDC2021, HDC2010
To use this driver, import this crate and an embedded_hal
implementation,
then instantiate the device.
Please find additional examples using hardware in this repository: driver-examples
extern crate linux_embedded_hal as hal;
use hdc20xx::{Hdc20xx, SlaveAddr};
use nb::block;
fn main() {
let dev = hal::I2cdev::new("/dev/i2c-1").unwrap();
let address = SlaveAddr::default();
let mut sensor = Hdc20xx::new(dev, address);
loop {
let data = block!(sensor.read()).unwrap();
println!(
"Temperature: {:2}°C, Humidity: {:2}%",
data.temperature,
data.humidity.unwrap()
);
}
}
For questions, issues, feature requests, and other changes, please file an issue in the github project.
Licensed under either of
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.