Crates.io | sht4x-ng |
lib.rs | sht4x-ng |
version | |
source | src |
created_at | 2024-09-29 23:34:35.57949+00 |
updated_at | 2025-03-03 22:31:31.07853+00 |
description | DEPRECATED - please use sht4x crate |
homepage | |
repository | |
max_upload_size | |
id | 1391165 |
Cargo.toml error: | TOML parse error at line 26, column 1 | 26 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
https://github.com/sirhcel/sht4x/
This was a fork of sirhcel's sht4x library which at the time did not have async support or use embedded-hal-1.0.0. The original library now supports both starting with version 0.2.0. Please use the sht4x crate instead of this one.
It is better for the community at large not to have forks when not needed.
A platform agnostic device driver for the Sensirion SHT4x temperature and
humidity sensor
family.
It is based on embedded-hal
traits and works in no_std
environments.
In theory, it supports all of the sensor family's devices but has only been tested with the SHT40-AD1B so far.
async
feature is specifiedDelayNs
for command execution so that it could be shared
(among multiple sensors)I16F16
from the fixed
cratedefmt
use embedded_hal::delay::DelayNs;
use sht4x_ng::Sht4x;
// Device-specific use declarations.
let mut delay = // Device-specific initialization of delay.
let i2c = // Device-specific initialization of I2C peripheral.
let mut sht40 = Sht4x::new(i2c);
let serial = sht40.serial_number(&mut delay);
defmt::info!("serial number: {}", serial);
let measurement = sht40.measure(Precision::Low, &mut delay);
defmt::info!("measurement: {}", &measurement);
if let Ok(measurement) = measurement {
// Convert temperature measurand into different formats for further
// processing.
let int: i32 = measurement.temperature_milli_celsius();
let fixed: I16F16 = measurement.temperature_celsius();
let float: f32 = measurement.temperature_celsius().to_num();
}
sensor-temp-humidity-sht40 is another driver for this sensor family.
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 discretion.
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.