Save a working blinkenlight as a test
This commit is contained in:
parent
8171494cce
commit
7a7d5f1a48
3 changed files with 36 additions and 0 deletions
2
hello_gradient/Cargo.lock
generated
2
hello_gradient/Cargo.lock
generated
|
@ -108,8 +108,10 @@ dependencies = [
|
||||||
name = "hello_gradient"
|
name = "hello_gradient"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"itsybitsy_m0 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"itsybitsy_m0_lights 0.1.0",
|
"itsybitsy_m0_lights 0.1.0",
|
||||||
"lights 0.1.0",
|
"lights 0.1.0",
|
||||||
|
"panic-halt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -10,5 +10,7 @@ codegen-units = 1
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
itsybitsy_m0 = "0.5"
|
||||||
lights = { path = "../lights" }
|
lights = { path = "../lights" }
|
||||||
lights_hal = { path = "../itsybitsy_m0_lights", package = "itsybitsy_m0_lights" }
|
lights_hal = { path = "../itsybitsy_m0_lights", package = "itsybitsy_m0_lights" }
|
||||||
|
panic-halt = "0.2"
|
||||||
|
|
32
hello_gradient/src/bin/sanity_test.rs
Normal file
32
hello_gradient/src/bin/sanity_test.rs
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
|
extern crate itsybitsy_m0 as hal;
|
||||||
|
extern crate panic_halt;
|
||||||
|
|
||||||
|
use hal::clock::GenericClockController;
|
||||||
|
use hal::delay::Delay;
|
||||||
|
use hal::prelude::*;
|
||||||
|
use hal::entry;
|
||||||
|
use hal::pac::{CorePeripherals, Peripherals};
|
||||||
|
|
||||||
|
#[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 = hal::Pins::new(peripherals.PORT);
|
||||||
|
let mut red_led = pins.d13.into_open_drain_output(&mut pins.port);
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue