summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-08 19:08:57 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-08 19:08:57 +0100
commitdf30ade977dceef79b69fa8d7fe193bcc23d35c3 (patch)
tree98ceee01369a5a2ebd9f1e80f8b09bc271c3f01f /src/lib.rs
parente316baaf8ca226caa2447041e1d895fb72ed4f19 (diff)
downloadads1x1x-async-df30ade977dceef79b69fa8d7fe193bcc23d35c3.tar.gz
ads1x1x-async-df30ade977dceef79b69fa8d7fe193bcc23d35c3.tar.xz
ads1x1x-async-df30ade977dceef79b69fa8d7fe193bcc23d35c3.zip
Add support for setting the comparator mode
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 5d4c3fa..a35f8f7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -98,6 +98,24 @@ pub enum DataRate {
Sps3300
}
+/// Comparator mode (only for ADS1x14, ADS1x15)
+#[derive(Debug, Clone)]
+pub enum ComparatorMode {
+ /// Traditional comparator (default)
+ ///
+ /// In this mode the ALERT/RDY pin asserts (according to selected active
+ /// polarity) when the conversion data exceeds the limit set as *high*
+ /// threshold and remains active until the conversion data falls below the
+ /// value set as *low* threshold.
+ Traditional,
+ /// Window comparator
+ ///
+ /// In this mode the ALERT/RDY pin asserts (according to selected active
+ /// polarity) when the conversion data exceeds the value set as *high*
+ /// threshold or goes below the value set as *low* temperature threshold.
+ Window
+}
+
/// Possible slave addresses
#[derive(Debug, Clone)]
pub enum SlaveAddr {
@@ -141,6 +159,7 @@ impl BitFlags {
const DR2 : u16 = 0b0000_0000_1000_0000;
const DR1 : u16 = 0b0000_0000_0100_0000;
const DR0 : u16 = 0b0000_0000_0010_0000;
+ const COMP_MODE : u16 = 0b0000_0000_0001_0000;
}