Make a mess while debugging the light signals. This code still turns every pixel white.
This commit is contained in:
parent
b67339abe0
commit
88236f5966
1 changed files with 33 additions and 9 deletions
|
@ -2,20 +2,26 @@
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
use core::iter::repeat;
|
use core::iter::repeat;
|
||||||
|
use core::sync::atomic::{
|
||||||
|
compiler_fence,
|
||||||
|
Ordering::SeqCst
|
||||||
|
};
|
||||||
use lights::{
|
use lights::{
|
||||||
gamma::GammaCorrector,
|
gamma::correct,
|
||||||
|
HardwareRgb,
|
||||||
PixelIterator,
|
PixelIterator,
|
||||||
rgb::{
|
rgb::{
|
||||||
Rgb
|
Rgb
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
use lights_hal::{boot, delay, entry};
|
use lights_hal::{boot, delay, entry, OutputPin};
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let mut lights = GammaCorrector(boot());
|
let mut lights = boot();
|
||||||
|
lights.red_led.set_high().unwrap();
|
||||||
|
|
||||||
let pattern =
|
let mut pattern =
|
||||||
repeat(&Rgb(255,0,0)).take(5)
|
repeat(&Rgb(255,0,0)).take(5)
|
||||||
.chain(
|
.chain(
|
||||||
repeat(&Rgb(255,255,255)).take(5)
|
repeat(&Rgb(255,255,255)).take(5)
|
||||||
|
@ -29,17 +35,35 @@ fn main() -> ! {
|
||||||
Rgb(255,255,255),
|
Rgb(255,255,255),
|
||||||
Rgb(0,0,255),
|
Rgb(0,0,255),
|
||||||
].iter().cycle().take(85)
|
].iter().cycle().take(85)
|
||||||
);
|
).cycle();
|
||||||
|
|
||||||
let mut buffer = [Rgb(255,0,255); 150];
|
let mut buffer = [HardwareRgb(255,255,0); 150];
|
||||||
|
let mut light = false;
|
||||||
|
//delay(48_000_000 * 3);
|
||||||
loop {
|
loop {
|
||||||
|
if light {
|
||||||
|
lights.red_led.set_high().unwrap();
|
||||||
|
} else {
|
||||||
|
lights.red_led.set_low().unwrap();
|
||||||
|
}
|
||||||
|
light = !light;
|
||||||
|
|
||||||
for (i, pixel) in pattern.clone().take(150).enumerate() {
|
for (i, pixel) in pattern.clone().take(150).enumerate() {
|
||||||
buffer[i] = *pixel;
|
buffer[i] = correct(pixel);
|
||||||
|
// buffer[i] = HardwareRgb(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.iter().render_to(&mut lights);
|
buffer.iter().render_to(&mut lights);
|
||||||
|
// compiler_fence(SeqCst);
|
||||||
|
// buffer.iter().render_to(&mut lights);
|
||||||
|
// lights.out.set_high();
|
||||||
|
// lights.high_out.set_low();
|
||||||
|
// compiler_fence(SeqCst);
|
||||||
|
// lights.byte(0);
|
||||||
|
// lights.byte(0);
|
||||||
|
// lights.byte(255);
|
||||||
|
|
||||||
//pattern.next();
|
pattern.next();
|
||||||
delay(1_000_000);
|
delay(12_000_000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue