July 4 pattern test, buffering for less glitching

This commit is contained in:
Tangent 128 2019-06-13 23:43:22 -04:00
parent 2aab355fff
commit e06017e7c3

View file

@ -0,0 +1,45 @@
#![no_std]
#![no_main]
use core::iter::repeat;
use lights::{
gamma::GammaCorrector,
PixelIterator,
rgb::{
Rgb
}
};
use lights_hal::{boot, delay, entry};
#[entry]
fn main() -> ! {
let mut lights = GammaCorrector(boot());
let pattern =
repeat(&Rgb(255,0,0)).take(5)
.chain(
repeat(&Rgb(255,255,255)).take(5)
).cycle().take(60)
.chain(
repeat(&Rgb(255,0,0)).take(5)
)
.chain(
[
Rgb(0,0,255),
Rgb(255,255,255),
Rgb(0,0,255),
].iter().cycle().take(85)
);
let mut buffer = [Rgb(255,0,255); 150];
loop {
for (i, pixel) in pattern.clone().take(150).enumerate() {
buffer[i] = *pixel;
}
buffer.iter().render_to(&mut lights);
//pattern.next();
delay(1_000_000);
}
}