prepare v0.9.0
This commit is contained in:
parent
64e5c06c83
commit
ffa9bf9b5b
3 changed files with 8 additions and 61 deletions
11
Cargo.toml
11
Cargo.toml
|
@ -5,19 +5,22 @@ documentation = "https://github.com/dnutiu/bme680-rust"
|
|||
license = "MIT"
|
||||
name = "bme680"
|
||||
repository = "https://github.com/dnutiu/bme680-rust"
|
||||
version = "0.8.0"
|
||||
version = "0.9.0"
|
||||
edition = "2021"
|
||||
|
||||
[badges]
|
||||
maintenance = { status = "passively-maintained" }
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.2"
|
||||
bitflags = "2.6.0"
|
||||
embedded-hal = "=1.0.0"
|
||||
log = "0.4"
|
||||
serde = { version = "1.0", optional = true, default-features = false, features = ["derive"] }
|
||||
linux-embedded-hal = "0.4.0"
|
||||
anyhow = "1.0.80"
|
||||
anyhow = { version = "1.0.80" , default-features = false}
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = "0.9"
|
||||
env_logger = "0.11.5"
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
linux-embedded-hal = "0.4.0"
|
|
@ -10,7 +10,7 @@ To use this library, create a new project and add it as a dependency:
|
|||
|
||||
```toml
|
||||
[dependencies]
|
||||
bme680 = {git = "https://github.com/dnutiu/bme680-rust.git", version = "0.8.0"}
|
||||
bme680 = {git = "https://github.com/dnutiu/bme680-rust.git", version = "0.9.0"}
|
||||
```
|
||||
|
||||
# Alternative
|
||||
|
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
56
src/lib.rs
56
src/lib.rs
|
@ -3,62 +3,6 @@
|
|||
//!
|
||||
//! The library uses the embedded-hal crate to abstract reading and writing via I²C.
|
||||
//! In the examples you can find a demo how to use the library in Linux using the linux-embedded-hal crate (e.g. on a RPI).
|
||||
//! ```no_run
|
||||
|
||||
//! use bme680::{Bme680, IIRFilterSize, OversamplingSetting, PowerMode, SettingsBuilder};
|
||||
//! use core::time::Duration;
|
||||
//! use embedded_hal::delay::DelayNs;
|
||||
//! use linux_embedded_hal as hal;
|
||||
//! use linux_embedded_hal::Delay;
|
||||
//! use log::info;
|
||||
//! use bme680::i2c::Address;
|
||||
//!
|
||||
//! // Please export RUST_LOG=info in order to see logs in the console.
|
||||
//! fn main() -> Result<(), anyhow::Error>
|
||||
//! {
|
||||
//! env_logger::init();
|
||||
//!
|
||||
//! let i2c = hal::I2cdev::new("/dev/i2c-1").unwrap();
|
||||
//! let mut delayer = Delay {};
|
||||
//!
|
||||
//! let mut dev = Bme680::init(i2c, &mut delayer, Address::Primary)?;
|
||||
//! let mut delay = Delay {};
|
||||
//!
|
||||
//! let settings = SettingsBuilder::new()
|
||||
//! .with_humidity_oversampling(OversamplingSetting::OS2x)
|
||||
//! .with_pressure_oversampling(OversamplingSetting::OS4x)
|
||||
//! .with_temperature_oversampling(OversamplingSetting::OS8x)
|
||||
//! .with_temperature_filter(IIRFilterSize::Size3)
|
||||
//! .with_gas_measurement(Duration::from_millis(1500), 320, 25)
|
||||
//! .with_temperature_offset(-2.2)
|
||||
//! .with_run_gas(true)
|
||||
//! .build();
|
||||
//!
|
||||
//! let profile_dur = dev.get_profile_duration(&settings.0)?;
|
||||
//! info!("Profile duration {:?}", profile_dur);
|
||||
//! info!("Setting sensor settings");
|
||||
//! dev.set_sensor_settings(&mut delayer, settings)?;
|
||||
//! info!("Setting forced power modes");
|
||||
//! dev.set_sensor_mode(&mut delayer, PowerMode::ForcedMode)?;
|
||||
//!
|
||||
//! let sensor_settings = dev.get_sensor_settings(settings.1);
|
||||
//! info!("Sensor settings: {:?}", sensor_settings);
|
||||
//!
|
||||
//! loop {
|
||||
//! let _ = delay.delay_ms(5000u32);
|
||||
//! let power_mode = dev.get_sensor_mode();
|
||||
//! info!("Sensor power mode: {:?}", power_mode);
|
||||
//! info!("Setting forced power modes");
|
||||
//! dev.set_sensor_mode(&mut delayer, PowerMode::ForcedMode)?;
|
||||
//! info!("Retrieving sensor data");
|
||||
//! let (data, _state) = dev.get_measurement(&mut delayer)?;
|
||||
//! info!("Sensor Data {:?}", data);
|
||||
//! info!("Temperature {}°C", data.temperature_celsius());
|
||||
//! info!("Pressure {}hPa", data.pressure_hpa());
|
||||
//! info!("Humidity {}%", data.humidity_percent());
|
||||
//! info!("Gas Resistence {}Ω", data.gas_resistance_ohm());
|
||||
//! }
|
||||
//! }
|
||||
|
||||
#![no_std]
|
||||
#![forbid(unsafe_code)]
|
||||
|
|
Loading…
Reference in a new issue