summaryrefslogtreecommitdiffstats
path: root/src/interface.rs
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 /src/interface.rs
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 'src/interface.rs')
-rw-r--r--src/interface.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/interface.rs b/src/interface.rs
index 960c7ef..0e665a3 100644
--- a/src/interface.rs
+++ b/src/interface.rs
@@ -1,7 +1,6 @@
//! I2C interface
use crate::{private, Error};
-use embedded_hal::blocking;
/// I2C interface
#[derive(Debug, Default)]
@@ -14,13 +13,14 @@ pub struct I2cInterface<I2C> {
pub trait WriteData: private::Sealed {
/// Error type
type Error;
+
/// Write to an u16 register
fn write_register(&mut self, register: u8, data: u16) -> Result<(), Error<Self::Error>>;
}
impl<I2C, E> WriteData for I2cInterface<I2C>
where
- I2C: blocking::i2c::Write<Error = E>,
+ I2C: embedded_hal::i2c::I2c<Error = E>,
{
type Error = E;
fn write_register(&mut self, register: u8, data: u16) -> Result<(), Error<E>> {
@@ -33,13 +33,14 @@ where
pub trait ReadData: private::Sealed {
/// Error type
type Error;
+
/// Read an u16 register
fn read_register(&mut self, register: u8) -> Result<u16, Error<Self::Error>>;
}
impl<I2C, E> ReadData for I2cInterface<I2C>
where
- I2C: blocking::i2c::WriteRead<Error = E>,
+ I2C: embedded_hal::i2c::I2c<Error = E>,
{
type Error = E;
fn read_register(&mut self, register: u8) -> Result<u16, Error<E>> {