summaryrefslogtreecommitdiffstats
path: root/tests
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 /tests
parent67d84cc9c4aeef625a6a1c942186dd60069bb329 (diff)
downloadads1x1x-async-254a0dce912e252e78a42eead98429dc0b27f1ba.tar.gz
ads1x1x-async-254a0dce912e252e78a42eead98429dc0b27f1ba.tar.xz
ads1x1x-async-254a0dce912e252e78a42eead98429dc0b27f1ba.zip
Add function to disable comparator
Diffstat (limited to 'tests')
-rw-r--r--tests/common/mod.rs2
-rw-r--r--tests/tier2_i2c.rs8
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index 140941e..dc66431 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -27,6 +27,8 @@ impl BitFlags {
pub const COMP_MODE : u16 = 0b0000_0000_0001_0000;
pub const COMP_POL : u16 = 0b0000_0000_0000_1000;
pub const COMP_LAT : u16 = 0b0000_0000_0000_0100;
+ pub const COMP_QUE1 : u16 = 0b0000_0000_0000_0010;
+ pub const COMP_QUE0 : u16 = 0b0000_0000_0000_0001;
}
pub struct Config {
diff --git a/tests/tier2_i2c.rs b/tests/tier2_i2c.rs
index 956aeb2..75c4b5f 100644
--- a/tests/tier2_i2c.rs
+++ b/tests/tier2_i2c.rs
@@ -50,3 +50,11 @@ mod can_set_comparator_latching {
config_test!(lat, set_comparator_latching, ComparatorLatching::Latching, Config::default().with_high(BitFlags::COMP_LAT));
}
+#[test]
+fn can_disable_comparator() {
+ let config = Config::default().with_high(BitFlags::COMP_QUE1).with_high(BitFlags::COMP_QUE0);
+ let transactions = [ I2cTrans::write(DEV_ADDR, vec![Register::CONFIG, config.msb(), config.lsb()]) ];
+ let mut dev = new_ads1014(&transactions);
+ dev.disable_comparator().unwrap();
+ destroy_ads1014(dev);
+}