Provide a way for a peripheral to query its clock frequency
Currently this looks up the frequency in the global singleton that must be initialized by the per-chip RCC implementation. At present, this is only done for the L0 family of chips.
This commit is contained in:
@ -37,7 +37,6 @@ pub struct Spi<'d, T: Instance> {
|
||||
|
||||
impl<'d, T: Instance> Spi<'d, T> {
|
||||
pub fn new<F>(
|
||||
pclk: Hertz,
|
||||
_peri: impl Unborrow<Target = T> + 'd,
|
||||
sck: impl Unborrow<Target = impl SckPin<T>>,
|
||||
mosi: impl Unborrow<Target = impl MosiPin<T>>,
|
||||
@ -60,6 +59,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 {
|
||||
|
Reference in New Issue
Block a user