#![no_std] #![no_main] use grand_central_m4 as bsp; use bsp::hal; use bsp::pac; #[cfg(not(feature = "use_semihosting"))] use panic_halt as _; #[cfg(feature = "use_semihosting")] use panic_semihosting as _; use bsp::{entry, pin_alias}; use hal::clock::GenericClockController; use hal::prelude::*; use pac::{CorePeripherals, Peripherals}; use hal::delay::Delay; #[entry] fn main() -> ! { let mut peripherals = Peripherals::take().unwrap(); let core = CorePeripherals::take().unwrap(); let mut clocks = GenericClockController::with_external_32kosc( peripherals.gclk, &mut peripherals.mclk, &mut peripherals.osc32kctrl, &mut peripherals.oscctrl, &mut peripherals.nvmctrl, ); let pins = bsp::Pins::new(peripherals.port); let mut red_led: bsp::RedLed = pin_alias!(pins.red_led).into(); let mut delay = Delay::new(core.SYST, &mut clocks); loop { delay.delay_ms(200u8); red_led.set_high().unwrap(); delay.delay_ms(200u8); red_led.set_low().unwrap(); } }