From 3ee29b41f9c896299c058f0a4d8cd3bd284aae91 Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Tue, 17 Mar 2020 00:08:23 -0400 Subject: [PATCH] St. Patrick's Day = green --- harrogate/Cargo.toml | 1 + harrogate/src/main.rs | 4 ++++ harrogate/src/st_patricks_day.rs | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 harrogate/src/st_patricks_day.rs diff --git a/harrogate/Cargo.toml b/harrogate/Cargo.toml index 906327f..285d7be 100644 --- a/harrogate/Cargo.toml +++ b/harrogate/Cargo.toml @@ -18,6 +18,7 @@ december-01-2019 = ["replace-default"] december-21-2019 = ["replace-default"] december-24-2019 = ["replace-default"] valentines-2020 = ["replace-default"] +st-patricks-day = ["replace-default"] [dependencies] house = { path = "../house" } diff --git a/harrogate/src/main.rs b/harrogate/src/main.rs index e168ca8..056cdc4 100644 --- a/harrogate/src/main.rs +++ b/harrogate/src/main.rs @@ -9,6 +9,7 @@ mod december_01_2019; mod december_21_2019; mod december_24_2019; mod valentines_2020; +mod st_patricks_day; mod door_light; #[entry] @@ -27,6 +28,9 @@ fn main() -> ! { #[cfg(feature = "valentines-2020")] valentines_2020::run(&mut lights); + #[cfg(feature = "st-patricks-day")] + st_patricks_day::run(&mut lights); + #[cfg(not(feature = "replace-default"))] door_light::run(&mut lights); } diff --git a/harrogate/src/st_patricks_day.rs b/harrogate/src/st_patricks_day.rs new file mode 100644 index 0000000..d9200d5 --- /dev/null +++ b/harrogate/src/st_patricks_day.rs @@ -0,0 +1,22 @@ +use super::delay; +use core::iter::repeat; +use house::Harrogate; +use lights::rgb::Rgb; +use lights::{HardwareRgb, Lights}; + +const GREEN: Rgb = Rgb(0, 255, 0); + +#[allow(dead_code)] +#[inline(always)] +pub fn run(lights: &mut impl Lights) -> ! { + let pattern = Harrogate { + porch_back: repeat(GREEN), + porch_front: repeat(GREEN), + }; + + loop { + pattern.clone().render_to(lights); + + delay(48_000_000); + } +}