Remove the frequency argument for i2c, move to using RccPeripheral.

This commit is contained in:
Bob McWhirter
2021-07-01 13:53:57 -04:00
parent e7a4a72977
commit 9f5d35d891
4 changed files with 9 additions and 6 deletions

View File

@ -22,13 +22,14 @@ impl<'d, T: Instance> I2c<'d, T> {
_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>,
{
unborrow!(scl, sda);
T::enable();
unsafe {
Self::configure_pin(scl.block(), scl.pin() as _, scl.af_num());
Self::configure_pin(sda.block(), sda.pin() as _, sda.af_num());
@ -41,7 +42,7 @@ impl<'d, T: Instance> I2c<'d, T> {
});
}
let timings = Timings::new(pclk, freq.into());
let timings = Timings::new(pclk, T::frequency().into());
unsafe {
T::regs().cr2().modify(|reg| {