Rename Bme680_dev struct to Bme680
This commit is contained in:
parent
650db10d69
commit
833f892e6b
2 changed files with 7 additions and 7 deletions
|
@ -19,7 +19,7 @@ fn main(
|
||||||
|
|
||||||
let i2c = I2cdev::new("/dev/i2c-1").unwrap();
|
let i2c = I2cdev::new("/dev/i2c-1").unwrap();
|
||||||
|
|
||||||
let mut dev = Bme680_dev::init(i2c, Delay {}, I2CAddress::Primary)?;
|
let mut dev = Bme680::init(i2c, Delay {}, I2CAddress::Primary)?;
|
||||||
|
|
||||||
let settings = SettingsBuilder::new()
|
let settings = SettingsBuilder::new()
|
||||||
.with_humidity_oversampling(OversamplingSetting::OS2x)
|
.with_humidity_oversampling(OversamplingSetting::OS2x)
|
||||||
|
|
12
src/lib.rs
12
src/lib.rs
|
@ -319,7 +319,7 @@ impl I2CUtil {
|
||||||
|
|
||||||
/// Driver for the BME680 environmental sensor
|
/// Driver for the BME680 environmental sensor
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Bme680_dev<I2C, D> {
|
pub struct Bme680<I2C, D> {
|
||||||
i2c: I2C,
|
i2c: I2C,
|
||||||
delay: D,
|
delay: D,
|
||||||
dev_id: I2CAddress,
|
dev_id: I2CAddress,
|
||||||
|
@ -357,7 +357,7 @@ where
|
||||||
Ok(value)
|
Ok(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I2C, D> Bme680_dev<I2C, D>
|
impl<I2C, D> Bme680<I2C, D>
|
||||||
where
|
where
|
||||||
D: DelayMs<u8>,
|
D: DelayMs<u8>,
|
||||||
I2C: Read + Write,
|
I2C: Read + Write,
|
||||||
|
@ -380,8 +380,8 @@ where
|
||||||
mut i2c: I2C,
|
mut i2c: I2C,
|
||||||
mut delay: D,
|
mut delay: D,
|
||||||
dev_id: I2CAddress,
|
dev_id: I2CAddress,
|
||||||
) -> Result<Bme680_dev<I2C, D>, <I2C as Read>::Error, <I2C as Write>::Error> {
|
) -> Result<Bme680<I2C, D>, <I2C as Read>::Error, <I2C as Write>::Error> {
|
||||||
Bme680_dev::soft_reset(&mut i2c, &mut delay, dev_id)?;
|
Bme680::soft_reset(&mut i2c, &mut delay, dev_id)?;
|
||||||
|
|
||||||
debug!("Reading chip id");
|
debug!("Reading chip id");
|
||||||
/* Soft reset to restore it to default values*/
|
/* Soft reset to restore it to default values*/
|
||||||
|
@ -390,9 +390,9 @@ where
|
||||||
|
|
||||||
if chip_id == BME680_CHIP_ID {
|
if chip_id == BME680_CHIP_ID {
|
||||||
debug!("Reading calib data");
|
debug!("Reading calib data");
|
||||||
let calib = Bme680_dev::<I2C, D>::get_calib_data::<I2C>(&mut i2c, dev_id)?;
|
let calib = Bme680::<I2C, D>::get_calib_data::<I2C>(&mut i2c, dev_id)?;
|
||||||
debug!("Calib data {:?}", calib);
|
debug!("Calib data {:?}", calib);
|
||||||
let dev = Bme680_dev {
|
let dev = Bme680 {
|
||||||
i2c: i2c,
|
i2c: i2c,
|
||||||
delay: delay,
|
delay: delay,
|
||||||
dev_id: dev_id,
|
dev_id: dev_id,
|
||||||
|
|
Loading…
Reference in a new issue