summaryrefslogtreecommitdiff
path: root/embassy-stm32
diff options
context:
space:
mode:
authorBob McWhirter <bmcwhirt@redhat.com>2021-07-02 13:54:07 -0400
committerBob McWhirter <bmcwhirt@redhat.com>2021-07-02 13:54:07 -0400
commitf5ce807e2579d2492f22fdd14f9dc5c582015862 (patch)
treea54ac851b95128b5797cb4ca36ba684544cc2701 /embassy-stm32
parentd8687b16929abf58fcfe7047b0091b685e12c106 (diff)
downloadembassy-f5ce807e2579d2492f22fdd14f9dc5c582015862.zip
Let's adjust i2c the correct way, removing the correct APBesque frequency, not the i2c periph speed.
Diffstat (limited to 'embassy-stm32')
-rw-r--r--embassy-stm32/src/i2c/v1.rs4
-rw-r--r--embassy-stm32/src/i2c/v2.rs4
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<F>(
- pclk: Hertz,
_peri: impl Unborrow<Target = T> + 'd,
scl: impl Unborrow<Target = impl SclPin<T>>,
sda: impl Unborrow<Target = impl SdaPin<T>>,
+ freq: F,
) -> Self
where
F: Into<Hertz>,
@@ -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<F>(
- pclk: Hertz,
_peri: impl Unborrow<Target = T> + 'd,
scl: impl Unborrow<Target = impl SclPin<T>>,
sda: impl Unborrow<Target = impl SdaPin<T>>,
+ freq: F,
) -> Self
where
F: Into<Hertz>,
@@ -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| {