Added UsbIO struct to bundle input and output
This commit is contained in:
@ -11,7 +11,7 @@ members = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.3.6"
|
version = "0.3.7"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://git.bfpower.io/BFPOWER/physical"
|
repository = "https://git.bfpower.io/BFPOWER/physical"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -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 TypedInterIn = Endpoint<'static, USB_OTG_FS, In>;
|
||||||
pub type TypedInterOut = Endpoint<'static, USB_OTG_FS, Out>;
|
pub type TypedInterOut = Endpoint<'static, USB_OTG_FS, Out>;
|
||||||
|
|
||||||
|
pub struct UsbIO {
|
||||||
|
sender: TypedInterIn,
|
||||||
|
receiver: TypedInterOut,
|
||||||
|
}
|
||||||
|
|
||||||
impl comms::Sender for TypedInterIn {
|
impl comms::Sender for TypedInterIn {
|
||||||
async fn send(&mut self, msg: &[u8]) -> Result<(), comms::Reset> {
|
async fn send(&mut self, msg: &[u8]) -> Result<(), comms::Reset> {
|
||||||
self.write(msg).await.map_err(|_| comms::Reset)
|
self.write(msg).await.map_err(|_| comms::Reset)
|
||||||
|
Reference in New Issue
Block a user