summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-20 18:45:32 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-20 18:45:32 +0100
commitea48b456d5045cd136c08829d40708eef1cab67a (patch)
treeb01cbefeb66b2a7f45950dd953fbec31ab4aa9a8 /tests
parent23f62d84d1232b7ef5ec02483a8090aa5c336fa6 (diff)
downloadads1x1x-async-ea48b456d5045cd136c08829d40708eef1cab67a.tar.gz
ads1x1x-async-ea48b456d5045cd136c08829d40708eef1cab67a.tar.xz
ads1x1x-async-ea48b456d5045cd136c08829d40708eef1cab67a.zip
Add method to start continuous conversions
Diffstat (limited to 'tests')
-rw-r--r--tests/tier1_i2c.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/tier1_i2c.rs b/tests/tier1_i2c.rs
index 5ffff60..9437487 100644
--- a/tests/tier1_i2c.rs
+++ b/tests/tier1_i2c.rs
@@ -100,21 +100,27 @@ mod data_rate_16bit {
#[test]
fn can_convert_to_continuous() {
- let config = Config::default().with_low(BitFlags::OP_MODE);
- let transactions = [ I2cTrans::write(DEV_ADDR, vec![Register::CONFIG, config.msb(), config.lsb()]) ];
- let dev = new_ads1013(&transactions);
+ let dev = new_ads1013(&[]);
let dev = dev.into_continuous().unwrap();
destroy_ads1013(dev);
}
#[test]
fn can_convert_to_one_shot() {
- let config_cont = Config::default().with_low(BitFlags::OP_MODE);
let config_os = Config::default();
- let transactions = [ I2cTrans::write(DEV_ADDR, vec![Register::CONFIG, config_cont.msb(), config_cont.lsb()]),
- I2cTrans::write(DEV_ADDR, vec![Register::CONFIG, config_os.msb(), config_os.lsb()]) ];
+ let transactions = [ I2cTrans::write(DEV_ADDR, vec![Register::CONFIG, config_os.msb(), config_os.lsb()]) ];
let dev = new_ads1013(&transactions);
let dev = dev.into_continuous().unwrap();
let dev = dev.into_one_shot().unwrap();
destroy_ads1013(dev);
}
+
+#[test]
+fn can_start_in_continuous() {
+ let config = Config::default().with_low(BitFlags::OP_MODE);
+ let transactions = [ I2cTrans::write(DEV_ADDR, vec![Register::CONFIG, config.msb(), config.lsb()]) ];
+ let dev = new_ads1013(&transactions);
+ let mut dev = dev.into_continuous().unwrap();
+ dev.start().unwrap();
+ destroy_ads1013(dev);
+}