summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-21 08:11:15 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-21 08:11:15 +0100
commiteb0c438e9dbad47a9cf2c24610233b0224f7e269 (patch)
tree6f897520ce5bc9d5963d760f99173b6ce50fc2ae /tests
parent0ae97c430f4082e94730a1b220f75db1add65270 (diff)
downloadads1x1x-async-eb0c438e9dbad47a9cf2c24610233b0224f7e269.tar.gz
ads1x1x-async-eb0c438e9dbad47a9cf2c24610233b0224f7e269.tar.xz
ads1x1x-async-eb0c438e9dbad47a9cf2c24610233b0224f7e269.zip
Make function to read if a measurement is in progress public
Diffstat (limited to 'tests')
-rw-r--r--tests/tier1_i2c.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/tier1_i2c.rs b/tests/tier1_i2c.rs
index b26312f..b91575e 100644
--- a/tests/tier1_i2c.rs
+++ b/tests/tier1_i2c.rs
@@ -112,6 +112,24 @@ mod data_rate_16bit {
}
#[test]
+fn can_read_measurement_in_progress() {
+ let config_os = Config::default().with_low(BitFlags::OS);
+ let transactions = [ I2cTrans::write_read(DEV_ADDR, vec![Register::CONFIG], vec![config_os.msb(), config_os.lsb()]) ];
+ let mut dev = new_ads1013(&transactions);
+ assert!(dev.is_measurement_in_progress().unwrap());
+ destroy_ads1013(dev);
+}
+
+#[test]
+fn can_read_measurement_not_in_progress() {
+ let config_os = Config::default().with_high(BitFlags::OS);
+ let transactions = [ I2cTrans::write_read(DEV_ADDR, vec![Register::CONFIG], vec![config_os.msb(), config_os.lsb()]) ];
+ let mut dev = new_ads1013(&transactions);
+ assert!(!dev.is_measurement_in_progress().unwrap());
+ destroy_ads1013(dev);
+}
+
+#[test]
fn can_convert_to_continuous() {
let dev = new_ads1013(&[]);
let dev = dev.into_continuous().unwrap();