mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/lsm303agr: Use version 1.0 of driver
This commit is contained in:
parent
96af920a12
commit
3c5a540d01
@ -11,7 +11,5 @@ license = "LGPL-2.1-only"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
lsm303agr = "0.3.0"
|
||||
lsm303agr = "1.0"
|
||||
riot-wrappers = "^0.8"
|
||||
# Whatever lsm uses
|
||||
nb = "*"
|
||||
|
@ -1,4 +1,4 @@
|
||||
USEMODULE += rust_riotmodules
|
||||
USEMODULE += ztimer_usec
|
||||
USEMODULE += ztimer_msec
|
||||
|
||||
FEATURES_REQUIRED += periph_i2c
|
||||
|
@ -59,7 +59,7 @@ fn init() -> Result<(), &'static str> {
|
||||
for (&i2cdev, (lsm, (reg, reg_mag))) in I2C_DEVICES.iter().zip(lsm.iter_mut().zip(reg.iter_mut().zip(reg_mag.iter_mut()))) {
|
||||
let mut device = Lsm303agr::new_with_i2c(i2c::I2CDevice::new(i2cdev));
|
||||
|
||||
let mut init_clock = riot_wrappers::ztimer::Clock::usec();
|
||||
let mut init_clock = riot_wrappers::ztimer::Clock::msec();
|
||||
|
||||
device.init()
|
||||
.map_err(|_| "Device initialization failed")?;
|
||||
@ -117,9 +117,8 @@ impl registration::Drivable for MagAspect {
|
||||
let mut device = self.0.device.try_lock()
|
||||
.ok_or(registration::Error)?;
|
||||
|
||||
let data = nb::block!(device.magnetic_field())
|
||||
let data = device.magnetic_field()
|
||||
.map_err(|_| registration::Error)?;
|
||||
// Original data is in nanotesla
|
||||
return Ok(Phydat::fit(&[data.x_nt(), data.y_nt(), data.z_nt()], Some(saul::Unit::T), -9))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user