added set_auto_set_reset function

This commit is contained in:
2026-02-10 12:15:15 +01:00
parent c96d00f5e3
commit 8b19f784e1

View File

@@ -269,6 +269,10 @@ where
self.magnet_set_reset().await?;
self.set_continuous_mode(false).await?;
// According to the datasheet this is recommended to
// be set to true
self.set_auto_set_reset(true).await?;
Ok(())
}
@@ -345,6 +349,14 @@ where
self.write_reg_controll_1(bandwidth.to_flags()).await
}
/// Enable or disable the automatic set/reset. This also impacts the maximum data rate.
pub async fn set_auto_set_reset(&mut self, enable: bool) -> Result<(), Error<I::Error>> {
self.ctrl0
.set(Control0RegisterFlags::AUTO_SET_RESET_EN, enable);
self.write_reg_controll_0(self.ctrl0).await?;
Ok(())
}
/// Read temperature in Celcius with steps of 0.8 C
pub async fn read_temperature(&mut self) -> Result<f32, Error<I::Error>> {
if self.is_continuous_mode() {