diff options
author | Diego Barrios Romero <eldruin@gmail.com> | 2018-11-11 11:44:24 +0100 |
---|---|---|
committer | Diego Barrios Romero <eldruin@gmail.com> | 2018-11-11 11:44:24 +0100 |
commit | b9b5349b4b78a5d59be4a7e4a11f712e2f6a8256 (patch) | |
tree | 69d3b02ad33c2a6aea9f33c826c6634885b83239 /tests | |
parent | d1723322ec05e3ddfd3a5a8d56ceb5f23fc7d372 (diff) | |
download | ads1x1x-async-b9b5349b4b78a5d59be4a7e4a11f712e2f6a8256.tar.gz ads1x1x-async-b9b5349b4b78a5d59be4a7e4a11f712e2f6a8256.tar.xz ads1x1x-async-b9b5349b4b78a5d59be4a7e4a11f712e2f6a8256.zip |
Move setting the thresholds to tier2 features
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ads1x1x_i2c.rs | 16 | ||||
-rw-r--r-- | tests/tier2_i2c.rs | 7 |
2 files changed, 6 insertions, 17 deletions
diff --git a/tests/ads1x1x_i2c.rs b/tests/ads1x1x_i2c.rs index 2d8e7e2..e3dbf21 100644 --- a/tests/ads1x1x_i2c.rs +++ b/tests/ads1x1x_i2c.rs @@ -9,22 +9,6 @@ mod common; use common::{ new_ads1013, destroy_ads1013, DEVICE_ADDRESS as DEV_ADDR, Register, BitFlags, Config }; -#[test] -fn can_set_low_threshold() { - let transactions = [ I2cTrans::write(DEV_ADDR, vec![Register::LOW_TH, 0x7F, 0xF0]) ]; - let mut dev = new_ads1013(&transactions); - dev.set_low_threshold(2047).unwrap(); - destroy_ads1013(dev); -} - -#[test] -fn can_set_high_threshold() { - let transactions = [ I2cTrans::write(DEV_ADDR, vec![Register::HIGH_TH, 0x7F, 0xF0]) ]; - let mut dev = new_ads1013(&transactions); - dev.set_high_threshold(2047).unwrap(); - destroy_ads1013(dev); -} - macro_rules! test_set_data_rate { ($name:ident, $variant:ident, $config:expr) => { diff --git a/tests/tier2_i2c.rs b/tests/tier2_i2c.rs index b8b15fe..1b01791 100644 --- a/tests/tier2_i2c.rs +++ b/tests/tier2_i2c.rs @@ -9,7 +9,6 @@ mod common; use common::{ new_ads1014, destroy_ads1014, DEVICE_ADDRESS as DEV_ADDR, Register, BitFlags, Config }; - macro_rules! set_value_test { ($name:ident, $method:ident, $value:expr, $reg:ident, $msb:expr, $lsb:expr) => { #[test] @@ -28,6 +27,12 @@ macro_rules! config_test { } } +mod can_set_comparator_thresholds { + use super::*; + set_value_test!(low, set_low_threshold, 2047, LOW_TH, 0x7F, 0xF0); + set_value_test!(high, set_high_threshold, 2047, HIGH_TH, 0x7F, 0xF0); +} + mod can_set_comparator_mode { use super::*; config_test!(traditional, set_comparator_mode, ComparatorMode::Traditional, Config::default().with_low( BitFlags::COMP_MODE)); |