Update dependencies and do necessary migrations
This commit is contained in:
@@ -15,6 +15,8 @@ stm32 = ["embassy-stm32", "physical/stm32"]
|
||||
|
||||
[dependencies.physical]
|
||||
path = ".."
|
||||
[dependencies.cfg-if]
|
||||
workspace = true
|
||||
[dependencies.embedded-hal]
|
||||
workspace = true
|
||||
[dependencies.embedded-hal-async]
|
||||
|
||||
@@ -3,28 +3,30 @@
|
||||
|
||||
use crate::comms;
|
||||
use embassy_stm32::peripherals::USB_OTG_FS;
|
||||
use embassy_stm32::usb_otg::{Driver, Endpoint, In, Out};
|
||||
use embassy_usb::driver::{EndpointIn, EndpointOut};
|
||||
use embassy_stm32::usb::Driver as StmUsbDriver;
|
||||
use embassy_usb::driver::{Driver as UsbDriverTrait, EndpointIn, EndpointOut};
|
||||
use embassy_usb::UsbDevice;
|
||||
|
||||
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>;
|
||||
type UsbDriver = StmUsbDriver<'static, USB_OTG_FS>;
|
||||
type InterIn = <UsbDriver as UsbDriverTrait<'static>>::EndpointIn;
|
||||
type InterOut = <UsbDriver as UsbDriverTrait<'static>>::EndpointOut;
|
||||
|
||||
pub type TypedUSB = UsbDevice<'static, UsbDriver>;
|
||||
|
||||
pub struct UsbIO {
|
||||
/// Send to master
|
||||
pub interrupt_in: TypedInterIn,
|
||||
pub interrupt_in: InterIn,
|
||||
/// Recieve from master
|
||||
pub interrupt_out: TypedInterOut,
|
||||
pub interrupt_out: InterOut,
|
||||
}
|
||||
|
||||
impl comms::Sender for TypedInterIn {
|
||||
impl<T: EndpointIn> comms::Sender for T {
|
||||
async fn send(&mut self, msg: &[u8]) -> Result<(), comms::Reset> {
|
||||
self.write(msg).await.map_err(|_| comms::Reset)
|
||||
}
|
||||
}
|
||||
|
||||
impl comms::Receiver for TypedInterOut {
|
||||
impl<T: EndpointOut> comms::Receiver for T {
|
||||
#[cfg(feature = "single-packet-msgs")]
|
||||
async fn receive(&mut self, buffer: &mut [u8]) -> Result<(), comms::Reset> {
|
||||
// This is OK when all our messages are smaller than a single packet.
|
||||
|
||||
Reference in New Issue
Block a user