diff --git a/embassy-stm32/src/i2c/v1.rs b/embassy-stm32/src/i2c/v1.rs index 62435e8a..8573f01f 100644 --- a/embassy-stm32/src/i2c/v1.rs +++ b/embassy-stm32/src/i2c/v1.rs @@ -18,10 +18,10 @@ pub struct I2c<'d, T: Instance> { impl<'d, T: Instance> I2c<'d, T> { pub fn new( - pclk: Hertz, _peri: impl Unborrow + 'd, scl: impl Unborrow>, sda: impl Unborrow>, + freq: F, ) -> Self where F: Into, @@ -42,7 +42,7 @@ impl<'d, T: Instance> I2c<'d, T> { }); } - let timings = Timings::new(pclk, T::frequency().into()); + let timings = Timings::new(T::frequency(), freq.into()); unsafe { T::regs().cr2().modify(|reg| { diff --git a/embassy-stm32/src/i2c/v2.rs b/embassy-stm32/src/i2c/v2.rs index 7747857b..2f70d426 100644 --- a/embassy-stm32/src/i2c/v2.rs +++ b/embassy-stm32/src/i2c/v2.rs @@ -18,10 +18,10 @@ pub struct I2c<'d, T: Instance> { impl<'d, T: Instance> I2c<'d, T> { pub fn new( - pclk: Hertz, _peri: impl Unborrow + 'd, scl: impl Unborrow>, sda: impl Unborrow>, + freq: F, ) -> Self where F: Into, @@ -42,7 +42,7 @@ impl<'d, T: Instance> I2c<'d, T> { }); } - let timings = Timings::new(pclk, T::frequency().into()); + let timings = Timings::new(T::frequency(), freq.into()); unsafe { T::regs().timingr().write(|reg| {