Create "normal" light-up-the-front-door pattern.
This commit is contained in:
parent
560476ea14
commit
7455a35053
3 changed files with 46 additions and 0 deletions
8
hello_gradient/Cargo.lock
generated
8
hello_gradient/Cargo.lock
generated
|
@ -108,12 +108,20 @@ dependencies = [
|
||||||
name = "hello_gradient"
|
name = "hello_gradient"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"house 0.1.0",
|
||||||
"itsybitsy_m0 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"panic-halt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "house"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"lights 0.1.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itsybitsy_m0"
|
name = "itsybitsy_m0"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
|
|
|
@ -10,6 +10,7 @@ codegen-units = 1
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
house = { path = "../house" }
|
||||||
itsybitsy_m0 = "0.5"
|
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" }
|
||||||
|
|
37
hello_gradient/src/bin/door_light.rs
Normal file
37
hello_gradient/src/bin/door_light.rs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
|
use core::iter::repeat;
|
||||||
|
use house::Harrogate;
|
||||||
|
use lights::rgb::{linear_gradient, Rgb};
|
||||||
|
use lights_hal::{boot, delay, entry};
|
||||||
|
|
||||||
|
const OFF: Rgb = Rgb(0, 0, 0);
|
||||||
|
const ON: Rgb = Rgb(255, 255, 255);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 20 fade + 25 ON + 20 fade = 65 dots
|
||||||
|
* 85 OFF + 65 door = 150 dots
|
||||||
|
*/
|
||||||
|
|
||||||
|
#[entry]
|
||||||
|
fn main() -> ! {
|
||||||
|
let mut lights = boot();
|
||||||
|
lights.heartbeat();
|
||||||
|
|
||||||
|
loop {
|
||||||
|
// blink light to demonstrate loop is still running
|
||||||
|
lights.heartbeat();
|
||||||
|
|
||||||
|
let door_highlight = linear_gradient(OFF, ON, 20)
|
||||||
|
.chain(repeat(ON).take(25))
|
||||||
|
.chain(linear_gradient(ON, OFF, 20));
|
||||||
|
|
||||||
|
Harrogate {
|
||||||
|
porch_back: repeat(OFF).take(85).chain(door_highlight),
|
||||||
|
porch_front: repeat(OFF),
|
||||||
|
}.render_to(&mut lights);
|
||||||
|
|
||||||
|
delay(48_000_000);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue