From 8ff9c943c6c54cee287e59d8e3a9f94bd025a59d Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Sun, 22 Nov 2020 23:45:50 -0500 Subject: [PATCH] modified some stuff --- .cargo/config | 3 +++ Cargo.toml | 6 +++++- src/main.rs | 14 +++++++++----- src/queue.rs | 10 +++++++--- 4 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 .cargo/config diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 0000000..ac8171b --- /dev/null +++ b/.cargo/config @@ -0,0 +1,3 @@ +[build] +target = "armv7-unknown-linux-gnueabihf" +linker = "arm-linux-gnueabihf-gcc" \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index a82caef..c919dce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,4 +20,8 @@ features = ["hal"] version = "0.11.3" [dependencies.reqwest] -version = "0.9.24" \ No newline at end of file +version = "0.9.24" + +[dependencies.openssl] +features = ["vendored"] +version = "0.10.30" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index c7eb191..4f2d769 100644 --- a/src/main.rs +++ b/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 = 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 } \ No newline at end of file diff --git a/src/queue.rs b/src/queue.rs index 85c3327..06f5f87 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -1,4 +1,4 @@ -struct Queue { +pub struct Queue { pub queue: Vec } @@ -25,11 +25,15 @@ impl Queue { 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) } }