diff --git a/Cargo.toml b/Cargo.toml index 539eb74..f2d2a45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ members = [ ] [workspace.package] -version = "0.3.2" +version = "0.3.3" edition = "2021" repository = "https://git.bfpower.io/BFPOWER/physical" readme = "README.md" diff --git a/node/Cargo.toml b/node/Cargo.toml index 1e67d5a..520b5d8 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -9,6 +9,7 @@ license.workspace = true [features] comms = [] +single-packet-msgs = [] usb = ["embassy-usb"] stm32 = ["embassy-stm32", "physical/stm32"] diff --git a/node/src/stm32/usb.rs b/node/src/stm32/usb.rs index 1099716..d2f767f 100644 --- a/node/src/stm32/usb.rs +++ b/node/src/stm32/usb.rs @@ -18,11 +18,17 @@ impl comms::Sender for TypedInterIn { } impl comms::Receiver for TypedInterOut { + #[cfg(feature = "single-packet-msgs")] async fn receive(&mut self, buffer: &mut [u8]) -> Result<(), comms::Reset> { - // This should be OK because all our messages are smaller than a single packet. + // This is OK when all our messages are smaller than a single packet. self.read(buffer) .await .map(|_| ()) .map_err(|_| comms::Reset) } + + #[cfg(not(feature = "single-packet-msgs"))] + async fn receive(&mut self, buffer: &mut [u8]) -> Result<(), comms::Reset> { + todo!("Decide if we want a general purpose multi-packet message receive") + } }