summaryrefslogtreecommitdiffstats
path: root/src/devices
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-17 07:42:39 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-17 07:42:39 +0100
commit254a0dce912e252e78a42eead98429dc0b27f1ba (patch)
tree156284dd56c362a8563c1b588f360f21115806de /src/devices
parent67d84cc9c4aeef625a6a1c942186dd60069bb329 (diff)
downloadads1x1x-async-254a0dce912e252e78a42eead98429dc0b27f1ba.tar.gz
ads1x1x-async-254a0dce912e252e78a42eead98429dc0b27f1ba.tar.xz
ads1x1x-async-254a0dce912e252e78a42eead98429dc0b27f1ba.zip
Add function to disable comparator
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/features/tier2.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/devices/features/tier2.rs b/src/devices/features/tier2.rs
index 5d7ec92..17502e6 100644
--- a/src/devices/features/tier2.rs
+++ b/src/devices/features/tier2.rs
@@ -58,4 +58,15 @@ where
self.config = config;
Ok(())
}
+ /// Disable comparator (default)
+ ///
+ /// This will set the ALERT/RDY pin to high-impedance.
+ /// The comparator can be enabled by setting the comparator queue.
+ /// See [`set_comparator_queue()`](struct.Ads1x1x.html#method.set_comparator_queue)
+ pub fn disable_comparator(&mut self) -> Result<(), Error<E>> {
+ let config = self.config.with_high(BitFlags::COMP_QUE1).with_high(BitFlags::COMP_QUE0);
+ self.iface.write_register(Register::CONFIG, config.bits)?;
+ self.config = config;
+ Ok(())
+ }
}