added set_auto_set_reset function
This commit is contained in:
12
src/lib.rs
12
src/lib.rs
@@ -269,6 +269,10 @@ where
|
|||||||
self.magnet_set_reset().await?;
|
self.magnet_set_reset().await?;
|
||||||
self.set_continuous_mode(false).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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,6 +349,14 @@ where
|
|||||||
self.write_reg_controll_1(bandwidth.to_flags()).await
|
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
|
/// Read temperature in Celcius with steps of 0.8 C
|
||||||
pub async fn read_temperature(&mut self) -> Result<f32, Error<I::Error>> {
|
pub async fn read_temperature(&mut self) -> Result<f32, Error<I::Error>> {
|
||||||
if self.is_continuous_mode() {
|
if self.is_continuous_mode() {
|
||||||
|
|||||||
Reference in New Issue
Block a user