From eb0c438e9dbad47a9cf2c24610233b0224f7e269 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Wed, 21 Nov 2018 08:11:15 +0100 Subject: Make function to read if a measurement is in progress public --- tests/tier1_i2c.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') 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 @@ -111,6 +111,24 @@ mod data_rate_16bit { test!(sps860, Sps860, Config::default().with_high(BitFlags::DR2).with_high(BitFlags::DR1).with_high(BitFlags::DR0)); } +#[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(&[]); -- cgit v1.2.3-54-g00ecf