diff --git a/embassy-stm32/src/rcc/l0/mod.rs b/embassy-stm32/src/rcc/l0/mod.rs index 978d373a..fc8a9488 100644 --- a/embassy-stm32/src/rcc/l0/mod.rs +++ b/embassy-stm32/src/rcc/l0/mod.rs @@ -1,6 +1,6 @@ use crate::pac; use crate::peripherals::{self, CRS, RCC, SYSCFG}; -use crate::rcc::{get_freqs, set_freqs, Clocks}; +use crate::rcc::{get_freqs, set_freqs}; use crate::time::Hertz; use crate::time::U32Ext; use core::marker::PhantomData; @@ -12,6 +12,14 @@ use pac::rcc::vals::{Hpre, Msirange, Plldiv, Pllmul, Pllsrc, Ppre, Sw}; /// Most of clock setup is copied from stm32l0xx-hal, and adopted to the generated PAC, /// and with the addition of the init function to configure a system clock. +#[derive(Clone, Copy)] +pub struct Clocks { + pub sys: Hertz, + pub ahb: Hertz, + pub apb1: Hertz, + pub apb2: Hertz, +} + /// System clock mux source #[derive(Clone, Copy)] pub enum ClockSrc { diff --git a/embassy-stm32/src/rcc/mod.rs b/embassy-stm32/src/rcc/mod.rs index 132b50b0..7271030a 100644 --- a/embassy-stm32/src/rcc/mod.rs +++ b/embassy-stm32/src/rcc/mod.rs @@ -1,20 +1,11 @@ #![macro_use] use crate::peripherals; -use crate::time::Hertz; use core::mem::MaybeUninit; /// Frozen clock frequencies /// /// The existence of this value indicates that the clock configuration can no longer be changed -#[derive(Clone, Copy)] -pub struct Clocks { - pub sys: Hertz, - pub ahb: Hertz, - pub apb1: Hertz, - pub apb2: Hertz, -} - static mut CLOCK_FREQS: MaybeUninit = MaybeUninit::uninit(); /// Sets the clock frequencies @@ -36,6 +27,37 @@ cfg_if::cfg_if! { } else if #[cfg(rcc_l0)] { mod l0; pub use l0::*; + } else if #[cfg(rcc_l4)] { + // TODO: Implement + use crate::time::Hertz; + + #[derive(Clone, Copy)] + pub struct Clocks { + pub apb1: Hertz, + pub apb2: Hertz, + pub ahb2: Hertz, + } + + #[derive(Default)] + pub struct Config {} + pub unsafe fn init(_config: Config) { + } + } else if #[cfg(rcc_f4)] { + // TODO: Implement + use crate::time::Hertz; + + #[derive(Clone, Copy)] + pub struct Clocks { + pub apb1: Hertz, + pub apb2: Hertz, + pub ahb2: Hertz, + } + + #[derive(Default)] + pub struct Config {} + pub unsafe fn init(_config: Config) { + } + } else { #[derive(Default)] pub struct Config {}