From 8b19f784e18c45315c6c285cc9b317ab14315f5a Mon Sep 17 00:00:00 2001 From: Niklas Kapelle Date: Tue, 10 Feb 2026 12:15:15 +0100 Subject: [PATCH] added set_auto_set_reset function --- src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 834e2e6..73b8c9e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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> { + 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> { if self.is_continuous_mode() {