From f5ce807e2579d2492f22fdd14f9dc5c582015862 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Fri, 2 Jul 2021 13:54:07 -0400 Subject: [PATCH] Let's adjust i2c the correct way, removing the correct APBesque frequency, not the i2c periph speed. --- embassy-stm32/src/i2c/v1.rs | 4 ++-- embassy-stm32/src/i2c/v2.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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| {