diff --git a/Cargo.toml b/Cargo.toml index f301cf3..f9e2295 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "i2c-pio" -version = "0.6.0" +version = "0.7.0" edition = "2021" license = "Apache-2.0" description = "I2C driver implementation using the RP2040's PIO peripheral." @@ -11,14 +11,11 @@ repository = "https://github.com/rp-rs/i2c-pio-rs" [dependencies] cortex-m = "0.7.3" -eh1_0_alpha = { version = "=1.0.0-alpha.9", package = "embedded-hal", optional = true } +eh1_0_alpha = { version = "=1.0.0-alpha.11", package = "embedded-hal", optional = true } embedded-hal = "0.2.6" nb = "1.0.0" pio = "0.2.0" pio-proc = "0.2.0" -rp2040-hal = "0.8.0" +rp2040-hal = "0.9.0" fugit = "0.3.5" defmt = { version = "0.3.0", optional = true } - -[patch.crates-io] -rp2040-hal = { git = "https://github.com/rp-rs/rp-hal" } diff --git a/src/lib.rs b/src/lib.rs index 39487e2..4141416 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -45,7 +45,7 @@ use embedded_hal::blocking::i2c::{self, AddressMode, Operation, SevenBitAddress, use fugit::HertzU32; use pio::{Instruction, InstructionOperands, SideSet}; use rp2040_hal::{ - gpio::{Disabled, DisabledConfig, Function, FunctionConfig, Pin, PinId, ValidPinMode}, + gpio::{AnyPin, FunctionNull, Pin, PullUp, ValidFunction}, pio::{ PIOExt, PinDir, PinState, Rx, ShiftDirection, StateMachine, StateMachineIndex, Tx, UninitStateMachine, PIO, @@ -102,42 +102,45 @@ pub enum Error { /// Instance of I2C Controller. pub struct I2C<'pio, P, SMI, SDA, SCL> where - P: PIOExt + FunctionConfig, + P: PIOExt, SMI: StateMachineIndex, - SDA: PinId, - SCL: PinId, - Function
: ValidPinMode ,
sm: StateMachine<(P, SMI), rp2040_hal::pio::Running>,
tx: Tx<(P, SMI)>,
rx: Rx<(P, SMI)>,
- _sda: Pin : ValidPinMode ,
- sda: rp2040_hal::gpio::Pin : ValidPinMode : ValidPinMode : ValidPinMode : ValidPinMode : ValidPinMode : ValidPinMode : ValidPinMode : ValidPinMode eh1_0_alpha::i2c::ErrorType for I2C<'_, P, SMI, SDA, SCL>
+ impl I2C<'_, P, SMI, SDA, SCL>
where
- P: PIOExt + FunctionConfig,
+ P: PIOExt,
SMI: StateMachineIndex,
- SDA: PinId,
- SCL: PinId,
- Function : ValidPinMode : ValidPinMode eh1_0_alpha::i2c::ErrorType for I2C<'_, P, SMI, SDA, SCL>
+ where
+ P: PIOExt,
+ SMI: StateMachineIndex,
+ SDA: AnyPin,
+ SCL: AnyPin,
+ {
+ type Error = super::Error;
+ }
+
+ impl eh1_0_alpha::i2c::I2c for I2C<'_, P, SMI, SDA, SCL>
+ where
+ A: AddressMode + Into