This commit is contained in:
Tangent Wantwight 2020-07-04 19:56:50 -04:00
parent 3ee29b41f9
commit b31c7beaa0
3 changed files with 47 additions and 0 deletions

View File

@ -19,6 +19,7 @@ december-21-2019 = ["replace-default"]
december-24-2019 = ["replace-default"]
valentines-2020 = ["replace-default"]
st-patricks-day = ["replace-default"]
july-4 = ["replace-default"]
[dependencies]
house = { path = "../house" }

42
harrogate/src/july_4.rs Normal file
View File

@ -0,0 +1,42 @@
//! 50-star USA Flag, stars on front, stripes on back.
use super::delay;
use core::iter::repeat;
use house::Harrogate;
use lights::rgb::Rgb;
use lights::{HardwareRgb, Lights};
const OFF: Rgb = Rgb(0, 0, 0);
const RED: Rgb = Rgb(255, 0, 0);
const WHITE: Rgb = Rgb(255, 255, 255);
const BLUE: Rgb = Rgb(0, 0, 200);
const FULL_PORCH: usize = 150;
#[allow(dead_code)]
#[inline(always)]
pub fn run(lights: &mut impl Lights<Pixel = HardwareRgb>) -> ! {
let stars = [BLUE, WHITE, BLUE]
.iter()
.cycle()
.take(FULL_PORCH)
.cloned();
let stripes = repeat(RED)
.take(11)
.chain(repeat(WHITE).take(11))
.cycle()
.take(11 * 12)
.chain(repeat(RED).take(11))
.chain(repeat(OFF))
.take(FULL_PORCH);
let pattern = Harrogate {
porch_back: stripes,
porch_front: stars,
};
loop {
pattern.clone().render_to(lights);
delay(1_000_000);
}
}

View File

@ -10,6 +10,7 @@ mod december_21_2019;
mod december_24_2019;
mod valentines_2020;
mod st_patricks_day;
mod july_4;
mod door_light;
#[entry]
@ -31,6 +32,9 @@ fn main() -> ! {
#[cfg(feature = "st-patricks-day")]
st_patricks_day::run(&mut lights);
#[cfg(feature = "july-4")]
july_4::run(&mut lights);
#[cfg(not(feature = "replace-default"))]
door_light::run(&mut lights);
}