Merge pull request #270 from bobmcwhirter/fix_bungled_i2c
Let's adjust i2c the correct way, removing the correct APBesque frequ…
This commit is contained in:
commit
489ef56dea
@ -18,10 +18,10 @@ pub struct I2c<'d, T: Instance> {
|
|||||||
|
|
||||||
impl<'d, T: Instance> I2c<'d, T> {
|
impl<'d, T: Instance> I2c<'d, T> {
|
||||||
pub fn new<F>(
|
pub fn new<F>(
|
||||||
pclk: Hertz,
|
|
||||||
_peri: impl Unborrow<Target = T> + 'd,
|
_peri: impl Unborrow<Target = T> + 'd,
|
||||||
scl: impl Unborrow<Target = impl SclPin<T>>,
|
scl: impl Unborrow<Target = impl SclPin<T>>,
|
||||||
sda: impl Unborrow<Target = impl SdaPin<T>>,
|
sda: impl Unborrow<Target = impl SdaPin<T>>,
|
||||||
|
freq: F,
|
||||||
) -> Self
|
) -> Self
|
||||||
where
|
where
|
||||||
F: Into<Hertz>,
|
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 {
|
unsafe {
|
||||||
T::regs().cr2().modify(|reg| {
|
T::regs().cr2().modify(|reg| {
|
||||||
|
@ -18,10 +18,10 @@ pub struct I2c<'d, T: Instance> {
|
|||||||
|
|
||||||
impl<'d, T: Instance> I2c<'d, T> {
|
impl<'d, T: Instance> I2c<'d, T> {
|
||||||
pub fn new<F>(
|
pub fn new<F>(
|
||||||
pclk: Hertz,
|
|
||||||
_peri: impl Unborrow<Target = T> + 'd,
|
_peri: impl Unborrow<Target = T> + 'd,
|
||||||
scl: impl Unborrow<Target = impl SclPin<T>>,
|
scl: impl Unborrow<Target = impl SclPin<T>>,
|
||||||
sda: impl Unborrow<Target = impl SdaPin<T>>,
|
sda: impl Unborrow<Target = impl SdaPin<T>>,
|
||||||
|
freq: F,
|
||||||
) -> Self
|
) -> Self
|
||||||
where
|
where
|
||||||
F: Into<Hertz>,
|
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 {
|
unsafe {
|
||||||
T::regs().timingr().write(|reg| {
|
T::regs().timingr().write(|reg| {
|
||||||
|
Loading…
Reference in New Issue
Block a user