summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarkus Reiter <me@reitermark.us>2024-01-12 20:24:51 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2024-01-19 11:23:31 +0100
commitb3ca672f70c71194da40a7670549a8264c13d971 (patch)
tree1f316806351a059ca5b5fccbcf4d790b94c0b471 /tests
parented4cc1dbc5b048332b68a0ebc1d7113d482a74a2 (diff)
downloadads1x1x-async-b3ca672f70c71194da40a7670549a8264c13d971.tar.gz
ads1x1x-async-b3ca672f70c71194da40a7670549a8264c13d971.tar.xz
ads1x1x-async-b3ca672f70c71194da40a7670549a8264c13d971.zip
Update to `embedded-hal` 1.0.
Diffstat (limited to 'tests')
-rw-r--r--tests/common/mod.rs6
-rw-r--r--tests/mux.rs11
-rw-r--r--tests/tier1.rs7
-rw-r--r--tests/tier2.rs2
4 files changed, 11 insertions, 15 deletions
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index c9ca2a1..429479c 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -1,7 +1,5 @@
-extern crate embedded_hal_mock as hal;
-use self::hal::i2c::{Mock as I2cMock, Transaction as I2cTrans};
-extern crate ads1x1x;
-use self::ads1x1x::{ic, interface, mode, Ads1x1x, SlaveAddr};
+use ads1x1x::{ic, interface, mode, Ads1x1x, SlaveAddr};
+use embedded_hal_mock::eh1::i2c::{Mock as I2cMock, Transaction as I2cTrans};
#[allow(unused)]
pub const DEVICE_ADDRESS: u8 = 0b100_1000;
diff --git a/tests/mux.rs b/tests/mux.rs
index b539ebe..ac335b5 100644
--- a/tests/mux.rs
+++ b/tests/mux.rs
@@ -1,5 +1,5 @@
use ads1x1x::channel;
-use embedded_hal_mock::i2c::Transaction as I2cTrans;
+use embedded_hal_mock::eh1::i2c::Transaction as I2cTrans;
use nb::block;
mod common;
@@ -12,7 +12,6 @@ macro_rules! mux_test {
($name:ident, $CS:ident, $config_bits:expr, $other_CS:ident, $other_config_bits:expr) => {
mod $name {
use super::*;
- use embedded_hal::adc::OneShot;
#[test]
fn can_read() {
@@ -33,7 +32,7 @@ macro_rules! mux_test {
I2cTrans::write_read(DEV_ADDR, vec![Register::CONVERSION], vec![0x80, 0x00]),
];
let mut dev = new(&transactions);
- let measurement = block!(dev.read(&mut channel::$CS)).unwrap();
+ let measurement = block!(dev.read(channel::$CS)).unwrap();
assert_eq!(-2048, measurement);
destroy(dev);
}
@@ -67,8 +66,8 @@ macro_rules! mux_test {
I2cTrans::write_read(DEV_ADDR, vec![Register::CONVERSION], vec![0x80, 0x00]),
];
let mut dev = new(&transactions);
- assert_would_block!(dev.read(&mut channel::$CS));
- let measurement = block!(dev.read(&mut channel::$other_CS)).unwrap();
+ assert_would_block!(dev.read(channel::$CS));
+ let measurement = block!(dev.read(channel::$other_CS)).unwrap();
assert_eq!(-2048, measurement);
destroy(dev);
}
@@ -89,7 +88,7 @@ macro_rules! mux_test {
];
let dev = new(&transactions);
let mut dev = dev.into_continuous().ok().unwrap();
- dev.select_channel(&mut channel::$CS).unwrap();
+ dev.select_channel(channel::$CS).unwrap();
destroy(dev);
}
}
diff --git a/tests/tier1.rs b/tests/tier1.rs
index 1f1a542..bbe9d6f 100644
--- a/tests/tier1.rs
+++ b/tests/tier1.rs
@@ -1,5 +1,5 @@
use ads1x1x::{channel, DataRate12Bit, DataRate16Bit};
-use embedded_hal_mock::i2c::Transaction as I2cTrans;
+use embedded_hal_mock::eh1::i2c::Transaction as I2cTrans;
use nb::block;
mod common;
@@ -12,7 +12,6 @@ macro_rules! measure_tests {
($IC:ident, $create:ident, $destroy:ident, $expected:expr) => {
mod $IC {
use super::*;
- use embedded_hal::adc::OneShot;
mod would_block {
use super::*;
@@ -26,7 +25,7 @@ macro_rules! measure_tests {
vec![config.msb(), config.lsb()],
)];
let mut dev = $create(&transactions);
- assert_would_block!(dev.read(&mut channel::DifferentialA0A1));
+ assert_would_block!(dev.read(channel::DifferentialA0A1));
$destroy(dev);
}
}
@@ -53,7 +52,7 @@ macro_rules! measure_tests {
I2cTrans::write_read(DEV_ADDR, vec![Register::CONVERSION], vec![0x80, 0x00]),
];
let mut dev = $create(&transactions);
- let measurement = block!(dev.read(&mut channel::DifferentialA0A1)).unwrap();
+ let measurement = block!(dev.read(channel::DifferentialA0A1)).unwrap();
assert_eq!($expected, measurement);
$destroy(dev);
}
diff --git a/tests/tier2.rs b/tests/tier2.rs
index 15a7865..7d3a54f 100644
--- a/tests/tier2.rs
+++ b/tests/tier2.rs
@@ -1,7 +1,7 @@
use ads1x1x::{
ComparatorLatching, ComparatorMode, ComparatorPolarity, ComparatorQueue, FullScaleRange,
};
-use embedded_hal_mock::i2c::Transaction as I2cTrans;
+use embedded_hal_mock::eh1::i2c::Transaction as I2cTrans;
mod common;
use crate::common::{