Migrate to embedded-hal=1.0.0-alpha.5
This commit is contained in:
parent
a4b407d534
commit
4b87e3c2f7
2 changed files with 16 additions and 9 deletions
|
@ -14,16 +14,16 @@ maintenance = { status = "passively-maintained" }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "1.2"
|
bitflags = "1.2"
|
||||||
embedded-hal = "0.2"
|
embedded-hal = "=1.0.0-alpha.5"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.8"
|
env_logger = "0.9"
|
||||||
futures = { version = "0.3" }
|
futures = { version = "0.3" }
|
||||||
i2cdev = "0.4"
|
i2cdev = "0.5"
|
||||||
influx_db_client = { version = "0.5", default-features= false, features = ["rustls-tls"] }
|
influx_db_client = { version = "0.5", default-features= false, features = ["rustls-tls"] }
|
||||||
tokio = {version = "1.5", features = ["full"] }
|
tokio = {version = "1.5", features = ["full"] }
|
||||||
url = "2.1"
|
url = "2.1"
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dev-dependencies]
|
[target.'cfg(target_os = "linux")'.dev-dependencies]
|
||||||
linux-embedded-hal = "0.3"
|
linux-embedded-hal = "0.4.0-alpha.1"
|
17
src/lib.rs
17
src/lib.rs
|
@ -93,8 +93,8 @@ mod calc;
|
||||||
mod settings;
|
mod settings;
|
||||||
|
|
||||||
use crate::calc::Calc;
|
use crate::calc::Calc;
|
||||||
use crate::hal::blocking::delay::DelayMs;
|
use crate::hal::delay::blocking::DelayMs;
|
||||||
use crate::hal::blocking::i2c::{Read, Write};
|
use crate::hal::i2c::blocking::{Read, Write};
|
||||||
|
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
use core::{marker::PhantomData, result};
|
use core::{marker::PhantomData, result};
|
||||||
|
@ -172,6 +172,7 @@ pub enum Error<R, W> {
|
||||||
///
|
///
|
||||||
I2CWrite(W),
|
I2CWrite(W),
|
||||||
I2CRead(R),
|
I2CRead(R),
|
||||||
|
Delay,
|
||||||
///
|
///
|
||||||
/// aka BME680_E_DEV_NOT_FOUND
|
/// aka BME680_E_DEV_NOT_FOUND
|
||||||
///
|
///
|
||||||
|
@ -459,7 +460,9 @@ where
|
||||||
i2c.write(dev_id.addr(), &tmp_buff)
|
i2c.write(dev_id.addr(), &tmp_buff)
|
||||||
.map_err(Error::I2CWrite)?;
|
.map_err(Error::I2CWrite)?;
|
||||||
|
|
||||||
delay.delay_ms(BME680_RESET_PERIOD);
|
delay
|
||||||
|
.delay_ms(BME680_RESET_PERIOD)
|
||||||
|
.map_err(|_| Error::Delay)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -725,7 +728,9 @@ where
|
||||||
tmp_pow_mode &= !BME680_MODE_MSK;
|
tmp_pow_mode &= !BME680_MODE_MSK;
|
||||||
debug!("Setting to sleep tmp_pow_mode: {}", tmp_pow_mode);
|
debug!("Setting to sleep tmp_pow_mode: {}", tmp_pow_mode);
|
||||||
self.bme680_set_regs(&[(BME680_CONF_T_P_MODE_ADDR, tmp_pow_mode)])?;
|
self.bme680_set_regs(&[(BME680_CONF_T_P_MODE_ADDR, tmp_pow_mode)])?;
|
||||||
delay.delay_ms(BME680_POLL_PERIOD_MS);
|
delay
|
||||||
|
.delay_ms(BME680_POLL_PERIOD_MS)
|
||||||
|
.map_err(|_| Error::Delay)?;
|
||||||
} else {
|
} else {
|
||||||
// TODO do while in Rust?
|
// TODO do while in Rust?
|
||||||
break;
|
break;
|
||||||
|
@ -990,7 +995,9 @@ where
|
||||||
return Ok((data, FieldDataCondition::NewData));
|
return Ok((data, FieldDataCondition::NewData));
|
||||||
}
|
}
|
||||||
|
|
||||||
delay.delay_ms(BME680_POLL_PERIOD_MS);
|
delay
|
||||||
|
.delay_ms(BME680_POLL_PERIOD_MS)
|
||||||
|
.map_err(|_| Error::Delay)?;
|
||||||
}
|
}
|
||||||
Ok((data, FieldDataCondition::Unchanged))
|
Ok((data, FieldDataCondition::Unchanged))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue