diff --git a/Cargo.lock b/Cargo.lock index 30212b3..2bb6b1f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "aligned" version = "0.3.4" @@ -11,9 +13,9 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.5.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "as-slice" @@ -224,8 +226,8 @@ dependencies = [ [[package]] name = "panel-protocol" -version = "0.4.0" -source = "git+https://github.com/tonarino/panel-protocol.git?rev=0.4#47f7a1ed57a8ccee9fe69fe56ce22828e7ae6fa8" +version = "0.6.0" +source = "git+https://github.com/tonarino/panel-protocol.git?rev=0.6#7f8c353640619100a9a1d0fe577196c630657d94" dependencies = [ "arrayvec", ] diff --git a/Cargo.toml b/Cargo.toml index a023675..3e2feaf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ cortex-m = "0.7" cortex-m-rt = "0.6" panic-reset = "0.1" nb = "1" -panel-protocol = { git = "https://github.com/tonarino/panel-protocol.git", rev = "0.4" } +panel-protocol = { git = "https://github.com/tonarino/panel-protocol.git", rev = "0.6" } usb-device = "0.2" usbd-serial = "0.1" libm = "0.2" diff --git a/src/serial.rs b/src/serial.rs index 748afb5..d7eb5bb 100644 --- a/src/serial.rs +++ b/src/serial.rs @@ -4,11 +4,13 @@ use hal::{ otg_fs::{UsbBus, USB}, serial::{self}, }; -use panel_protocol::{ArrayString, ArrayVec, MAX_COMMAND_LEN, MAX_COMMAND_QUEUE_LEN}; +use panel_protocol::{ArrayString, ArrayVec, MAX_COMMAND_LEN}; pub use panel_protocol::{Command, CommandReader, Report}; use usb_device::{device::UsbDevice, UsbError}; use usbd_serial::SerialPort; +const MAX_COMMAND_QUEUE_LEN: usize = 8; + type Stm32F4UsbDevice = stm32f4xx_hal::otg_fs::UsbBus; #[derive(Debug)] @@ -65,7 +67,7 @@ impl<'a> SerialProtocol<'a> { } /// Check to see if a new command from host is available - pub fn poll(&mut self) -> Result, Error> { + pub fn poll(&mut self) -> Result, Error> { self.usb_device.poll(&mut [&mut self.usb_serial_device]); match self.usb_serial_device.read(&mut self.read_buf[..]) {