From 9215283c9980ab2511c45bdb41c92c4e0496fb1b Mon Sep 17 00:00:00 2001 From: Zachary Sunforge Date: Fri, 4 Oct 2024 07:04:30 -0700 Subject: [PATCH] Added UsbIO struct to bundle input and output --- Cargo.toml | 2 +- node/src/stm32/usb.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 8645f17..4274e6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ members = [ ] [workspace.package] -version = "0.3.6" +version = "0.3.7" edition = "2021" repository = "https://git.bfpower.io/BFPOWER/physical" readme = "README.md" diff --git a/node/src/stm32/usb.rs b/node/src/stm32/usb.rs index d2f767f..8b3ecef 100644 --- a/node/src/stm32/usb.rs +++ b/node/src/stm32/usb.rs @@ -11,6 +11,11 @@ pub type TypedUSB = UsbDevice<'static, Driver<'static, USB_OTG_FS>>; pub type TypedInterIn = Endpoint<'static, USB_OTG_FS, In>; pub type TypedInterOut = Endpoint<'static, USB_OTG_FS, Out>; +pub struct UsbIO { + sender: TypedInterIn, + receiver: TypedInterOut, +} + impl comms::Sender for TypedInterIn { async fn send(&mut self, msg: &[u8]) -> Result<(), comms::Reset> { self.write(msg).await.map_err(|_| comms::Reset)