diff --git a/hello_gradient/src/bin/mardi_gras.rs b/hello_gradient/src/bin/mardi_gras.rs index 60cbf2f..ecc0208 100644 --- a/hello_gradient/src/bin/mardi_gras.rs +++ b/hello_gradient/src/bin/mardi_gras.rs @@ -1,19 +1,17 @@ #![no_std] #![no_main] -use lights::{ - gamma::correct, - rgb::{linear_gradient, Rgb}, - HardwareRgb, PixelIterator, -}; +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 YELLOW: Rgb = Rgb(255, 255, 0); const GREEN: Rgb = Rgb(100, 255, 0); const PURPLE: Rgb = Rgb(196, 0, 255); const SEGMENT_LEN: usize = 50; -const BUFFER_LEN: usize = 300; #[entry] fn main() -> ! { @@ -25,16 +23,14 @@ fn main() -> ! { .chain(linear_gradient(PURPLE, YELLOW, SEGMENT_LEN)) .cycle(); - let mut buffer = [HardwareRgb(255, 255, 0); BUFFER_LEN]; loop { // blink light to demonstrate loop is still running lights.heartbeat(); - for (i, pixel) in gradient.clone().take(BUFFER_LEN).enumerate() { - buffer[i] = correct(&pixel); - } - - buffer.iter().render_to(&mut lights); + Harrogate { + porch_back: gradient.clone(), + porch_front: repeat(OFF), + }.render_to(&mut lights); gradient.next(); delay(500_000);