#![no_std] #![no_main] // pick a panicking behavior extern crate panic_halt; // you can put a breakpoint on `rust_begin_unwind` to catch panics // extern crate panic_abort; // requires nightly // extern crate panic_itm; // logs messages over ITM; requires ITM support // extern crate panic_semihosting; // logs messages to the host stderr; requires a debugger use metro_m0 as hal; use hal::clock::GenericClockController; use hal::delay::Delay; use hal::entry; 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_external_32kosc( peripherals.GCLK, &mut peripherals.PM, &mut peripherals.SYSCTRL, &mut peripherals.NVMCTRL, ); let mut pins = hal::Pins::new(peripherals.PORT); let mut red_led = pins.d13.into_push_pull_output(&mut pins.port); let mut delay = Delay::new(core.SYST, &mut clocks); loop { delay.delay_ms(1000u16); red_led.toggle(); } }