diff --git a/Cargo.toml b/Cargo.toml index b414886..a4b2936 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,4 +15,4 @@ exclude = [ ] [dependencies] -embedded-hal = "0.2.3" +embedded-hal = "1.0" diff --git a/src/lib.rs b/src/lib.rs index 5f95381..174f86c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,7 +25,7 @@ extern crate embedded_hal as ehal; -use ehal::blocking::i2c::{Write, WriteRead}; +use ehal::i2c::I2c; /// The default I2C address of the MCP23017. const DEFAULT_ADDRESS: u8 = 0x20; @@ -38,7 +38,7 @@ const LOW: bool = false; /// See the crate-level documentation for general info on the device and the operation of this /// driver. #[derive(Clone, Copy, Debug)] -pub struct MCP23017 { +pub struct MCP23017 { com: I2C, /// The I2C slave address of this device. pub address: u8, @@ -61,12 +61,12 @@ impl From for Error { impl MCP23017 where - I2C: WriteRead + Write, + I2C: I2c, { /// Creates an expander with the default configuration. pub fn default(i2c: I2C) -> Result, Error> where - I2C: Write + WriteRead, + I2C: I2c, { MCP23017::new(i2c, DEFAULT_ADDRESS) } @@ -74,7 +74,7 @@ where /// Creates an expander with specific address. pub fn new(i2c: I2C, address: u8) -> Result, Error> where - I2C: Write + WriteRead, + I2C: I2c, { let chip = MCP23017 { com: i2c, address };