From ea48b456d5045cd136c08829d40708eef1cab67a Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Tue, 20 Nov 2018 18:45:32 +0100 Subject: Add method to start continuous conversions --- tests/tier1_i2c.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'tests') 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); +} -- cgit v1.2.3-54-g00ecf