diff --git a/embassy-stm32/src/spi/v1.rs b/embassy-stm32/src/spi/v1.rs index 227a36a8..01cbf86b 100644 --- a/embassy-stm32/src/spi/v1.rs +++ b/embassy-stm32/src/spi/v1.rs @@ -29,7 +29,6 @@ pub struct Spi<'d, T: Instance> { impl<'d, T: Instance> Spi<'d, T> { pub fn new( - pclk: Hertz, _peri: impl Unborrow + 'd, sck: impl Unborrow>, mosi: impl Unborrow>, @@ -58,6 +57,7 @@ impl<'d, T: Instance> Spi<'d, T> { }); } + let pclk = T::frequency(); let br = Self::compute_baud_rate(pclk, freq.into()); unsafe { diff --git a/embassy-stm32/src/spi/v3.rs b/embassy-stm32/src/spi/v3.rs index 6073616b..0b4a7145 100644 --- a/embassy-stm32/src/spi/v3.rs +++ b/embassy-stm32/src/spi/v3.rs @@ -37,7 +37,6 @@ pub struct Spi<'d, T: Instance> { impl<'d, T: Instance> Spi<'d, T> { pub fn new( - pclk: Hertz, _peri: impl Unborrow + 'd, sck: impl Unborrow>, mosi: impl Unborrow>, @@ -62,6 +61,7 @@ impl<'d, T: Instance> Spi<'d, T> { let mosi = mosi.degrade(); let miso = miso.degrade(); + let pclk = T::frequency(); let br = Self::compute_baud_rate(pclk, freq.into()); unsafe { T::enable();