Let's adjust i2c the correct way, removing the correct APBesque frequency, not the i2c periph speed.

This commit is contained in:
Bob McWhirter 2021-07-02 13:54:07 -04:00
parent d8687b1692
commit f5ce807e25
2 changed files with 4 additions and 4 deletions

View File

@ -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| {

View File

@ -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| {