#![no_std] #![no_main] use bsp::hal; use serpente as bsp; #[cfg(not(feature = "use_semihosting"))] use panic_halt as _; #[cfg(feature = "use_semihosting")] use panic_semihosting as _; use bsp::entry; use hal::clock::GenericClockController; use hal::delay::Delay; use hal::pac::{CorePeripherals, Peripherals}; use hal::prelude::*; #[entry] fn main() -> ! { let mut peripherals = Peripherals::take().unwrap(); let core = CorePeripherals::take().unwrap(); let mut clocks = GenericClockController::with_internal_32kosc( peripherals.GCLK, &mut peripherals.PM, &mut peripherals.SYSCTRL, &mut peripherals.NVMCTRL, ); let mut pins = bsp::Pins::new(peripherals.PORT); let mut red_led = pins.led_r.into_open_drain_output(&mut pins.port); let mut blue_led = pins.led_b.into_open_drain_output(&mut pins.port); blue_led.set_high().unwrap(); 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(); } }