modified some stuff
This commit is contained in:
parent
971fc89254
commit
8ff9c943c6
3
.cargo/config
Normal file
3
.cargo/config
Normal file
@ -0,0 +1,3 @@
|
||||
[build]
|
||||
target = "armv7-unknown-linux-gnueabihf"
|
||||
linker = "arm-linux-gnueabihf-gcc"
|
@ -21,3 +21,7 @@ version = "0.11.3"
|
||||
|
||||
[dependencies.reqwest]
|
||||
version = "0.9.24"
|
||||
|
||||
[dependencies.openssl]
|
||||
features = ["vendored"]
|
||||
version = "0.10.30"
|
14
src/main.rs
14
src/main.rs
@ -16,8 +16,8 @@ mod queue;
|
||||
const NUM_LEDS: usize = 150;
|
||||
|
||||
fn main() {
|
||||
let spi = Spi::new(Bus::Spi0, SlaveSelect::Ss0, 3_000_000, Mode::Mode0)
|
||||
.unwrap();
|
||||
let queue: queue::Queue<RGB8> = queue::Queue::new();
|
||||
let spi = Spi::new(Bus::Spi0, SlaveSelect::Ss0, 3_000_000, Mode::Mode0).unwrap();
|
||||
let mut ws = Ws2812::new(spi);
|
||||
let mut configuration = config::init_config();
|
||||
let mut is_headless: bool = false;
|
||||
@ -114,13 +114,17 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
fn new() -> () {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn change_color(num_one: &u8, num_two: &u8, num_three: &u8) -> [RGB8; 150] {
|
||||
let color = RGB8::new(*num_one, *num_two, *num_three);
|
||||
let mut data = [RGB8::default(); NUM_LEDS];
|
||||
|
||||
for i in 0..NUM_LEDS {
|
||||
data[i] = color;
|
||||
}
|
||||
// for i in 0..NUM_LEDS {
|
||||
// data[i] = color;
|
||||
// }
|
||||
|
||||
data
|
||||
}
|
10
src/queue.rs
10
src/queue.rs
@ -1,4 +1,4 @@
|
||||
struct Queue<T> {
|
||||
pub struct Queue<T> {
|
||||
pub queue: Vec<T>
|
||||
}
|
||||
|
||||
@ -25,11 +25,15 @@ impl<T> Queue<T> {
|
||||
self.queue.is_empty()
|
||||
}
|
||||
|
||||
pub fn peek(&self) -> Option<&T> {
|
||||
pub fn peek_first(&self) -> Option<&T> {
|
||||
self.queue.first()
|
||||
}
|
||||
|
||||
pub fn peek_at(&self, item: T) -> Option<&T> {
|
||||
pub fn peek_last(&self) -> Option<&T> {
|
||||
self.queue.last()
|
||||
}
|
||||
|
||||
pub fn peek_at(&self, item: usize) -> Option<&T> {
|
||||
self.queue.get(item)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user