modified some stuff

This commit is contained in:
Wyatt J. Miller 2020-11-22 23:45:50 -05:00
parent 971fc89254
commit 8ff9c943c6
4 changed files with 24 additions and 9 deletions

3
.cargo/config Normal file
View File

@ -0,0 +1,3 @@
[build]
target = "armv7-unknown-linux-gnueabihf"
linker = "arm-linux-gnueabihf-gcc"

View File

@ -20,4 +20,8 @@ features = ["hal"]
version = "0.11.3" version = "0.11.3"
[dependencies.reqwest] [dependencies.reqwest]
version = "0.9.24" version = "0.9.24"
[dependencies.openssl]
features = ["vendored"]
version = "0.10.30"

View File

@ -16,8 +16,8 @@ mod queue;
const NUM_LEDS: usize = 150; const NUM_LEDS: usize = 150;
fn main() { fn main() {
let spi = Spi::new(Bus::Spi0, SlaveSelect::Ss0, 3_000_000, Mode::Mode0) let queue: queue::Queue<RGB8> = queue::Queue::new();
.unwrap(); let spi = Spi::new(Bus::Spi0, SlaveSelect::Ss0, 3_000_000, Mode::Mode0).unwrap();
let mut ws = Ws2812::new(spi); let mut ws = Ws2812::new(spi);
let mut configuration = config::init_config(); let mut configuration = config::init_config();
let mut is_headless: bool = false; 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] { 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 color = RGB8::new(*num_one, *num_two, *num_three);
let mut data = [RGB8::default(); NUM_LEDS]; let mut data = [RGB8::default(); NUM_LEDS];
for i in 0..NUM_LEDS { // for i in 0..NUM_LEDS {
data[i] = color; // data[i] = color;
} // }
data data
} }

View File

@ -1,4 +1,4 @@
struct Queue<T> { pub struct Queue<T> {
pub queue: Vec<T> pub queue: Vec<T>
} }
@ -25,11 +25,15 @@ impl<T> Queue<T> {
self.queue.is_empty() self.queue.is_empty()
} }
pub fn peek(&self) -> Option<&T> { pub fn peek_first(&self) -> Option<&T> {
self.queue.first() 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) self.queue.get(item)
} }
} }