diff --git a/Cargo.toml b/Cargo.toml index 6fe10d1..35a8ada 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ cortex-m = "0.6.0" cortex-m-rt = "0.6.10" cortex-m-semihosting = "0.3.3" panic-halt = "0.2.0" -metro_m0 = "0.6.0" +metro_m0 = { version = "0.6.0", features = ["default", "unproven"] } # Uncomment for the panic example. # panic-itm = "0.4.1" diff --git a/src/main.rs b/src/main.rs index 27b8625..61a012b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,10 +27,16 @@ fn main() -> ! { ); let mut pins = hal::Pins::new(peripherals.PORT); let mut red_led = pins.d13.into_push_pull_output(&mut pins.port); + let switch = pins.d3.into_pull_down_input(&mut pins.port); let mut delay = Delay::new(core.SYST, &mut clocks); + loop { - delay.delay_ms(1000u16); - red_led.toggle(); + // delay.delay_ms(255u8); + if switch.is_high().unwrap() { + red_led.set_high().unwrap(); + } else { + red_led.set_low().unwrap(); + } } }