From 3571393a074331bc7b7a7ceca35e7b4010011fc7 Mon Sep 17 00:00:00 2001 From: Nikita Sivakov Date: Sun, 5 Nov 2023 01:51:12 +0100 Subject: [PATCH] Make Clippy happy --- src/main.rs | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index c7fc27f..c7b0393 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,35 @@ use bsp::entry; use defmt_rtt as _; use panic_probe as _; +use bsp::hal::{ + clocks::{init_clocks_and_plls, Clock}, + pac, + watchdog::Watchdog, +}; + +const DELAY_MS: u32 = 1_000; + #[entry] fn main() -> ! { - loop {} + let mut pac = pac::Peripherals::take().unwrap(); + let core = pac::CorePeripherals::take().unwrap(); + let mut watchdog = Watchdog::new(pac.WATCHDOG); + + let clocks = init_clocks_and_plls( + bsp::XOSC_CRYSTAL_FREQ, + pac.XOSC, + pac.CLOCKS, + pac.PLL_SYS, + pac.PLL_USB, + &mut pac.RESETS, + &mut watchdog, + ) + .ok() + .unwrap(); + + let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz()); + + loop { + delay.delay_ms(DELAY_MS); + } }