Make Mardi Gras code use Harrogate helper
This commit is contained in:
parent
1ad2db3960
commit
6cf0ea27e9
1 changed files with 8 additions and 12 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue