Compare commits
1 commit
0a90a2ca5f
...
2016f85fb0
Author | SHA1 | Date | |
---|---|---|---|
2016f85fb0 |
1 changed files with 2 additions and 1 deletions
|
@ -12,6 +12,7 @@ pub const BRIGHTNESS: u8 = 150;
|
||||||
fn main() {
|
fn main() {
|
||||||
let p: RawColor = [0, 0, 0, 0];
|
let p: RawColor = [0, 0, 0, 0];
|
||||||
let lock = Arc::new(RwLock::new([p; LED_SIZE]));
|
let lock = Arc::new(RwLock::new([p; LED_SIZE]));
|
||||||
|
let read = Arc::clone(&lock);
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let mut controller: Controller = ControllerBuilder::new()
|
let mut controller: Controller = ControllerBuilder::new()
|
||||||
.channel(0, ChannelBuilder::new()
|
.channel(0, ChannelBuilder::new()
|
||||||
|
@ -24,7 +25,7 @@ fn main() {
|
||||||
.build()
|
.build()
|
||||||
.expect("Could not construct LED Controller.");
|
.expect("Could not construct LED Controller.");
|
||||||
loop {
|
loop {
|
||||||
let lights = lock.read().expect("Could not read array lock.");
|
let lights = read.read().expect("Could not read array lock.");
|
||||||
run_lights(&mut controller, &lights).expect("Error running lights controller.");
|
run_lights(&mut controller, &lights).expect("Error running lights controller.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue