diff --git a/esp-hal/src/lib.rs b/esp-hal/src/lib.rs index 27f6d555da4..45879e1b749 100644 --- a/esp-hal/src/lib.rs +++ b/esp-hal/src/lib.rs @@ -736,13 +736,6 @@ pub struct Config { pub fn init(config: Config) -> Peripherals { let mut peripherals = Peripherals::take(); - Clocks::init(config.cpu_clock); - - #[cfg(xtensa)] - crate::interrupt::setup_interrupts(); - #[cfg(esp32)] - crate::time::time_init(); - // RTC domain must be enabled before we try to disable let mut rtc = crate::rtc_cntl::Rtc::new(&mut peripherals.LPWR); #[cfg(not(any(esp32, esp32s2)))] @@ -755,5 +748,12 @@ pub fn init(config: Config) -> Peripherals { crate::timer::timg::Wdt::::set_wdt_enabled(false); } + Clocks::init(config.cpu_clock); + + #[cfg(xtensa)] + crate::interrupt::setup_interrupts(); + #[cfg(esp32)] + crate::time::time_init(); + peripherals }