stm32-rs / stm32f7xx-hal

A Rust embedded-hal HAL for all MCUs in the STM32 F7 family
Apache License 2.0
117 stars 68 forks source link

Compatibility with usbd-serial 0.2.0 and above / usb-device 0.3.0 and above #213

Closed Hecatron closed 3 months ago

Hecatron commented 3 months ago

I'm noticing when using usbd-serial with a version of 0.2.0 or above this seems to cause issues when creating the serial port

    let usb_bus = UsbBus::new(usb, unsafe { &mut EP_MEMORY });
    let mut serial = usbd_serial::SerialPort::new(&usb_bus);
mismatched types
`UsbBusAllocator<UsbBus<USB>>` and `UsbBusAllocator<_>` have similar names, but are actually distinct types
perhaps two different versions of crate `usb_device` are being used?rustc[Click for full compiler diagnostic](rust-analyzer-diagnostics-view:/diagnostic%20message%20%5B0%5D?0)
usb_cdc.rs(30, 22): arguments to this function are incorrect
bus.rs(149, 1): `UsbBusAllocator<UsbBus<USB>>` is defined in crate `usb_device`
bus.rs(152, 1): `UsbBusAllocator<_>` is defined in crate `usb_device`
serial_port.rs(49, 12): associated function defined here

Also when using usb-device 0.3.0 and above

    let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd))
        .manufacturer("Fake company")
        .product("Serial port")
        .serial_number("TEST")
        .device_class(usbd_serial::USB_CLASS_CDC)
        .max_packet_size_0(64) // Size required for HS, and ok for FS
        .build();
mismatched types
`UsbBusAllocator<UsbBus<USB>>` and `UsbBusAllocator<_>` have similar names, but are actually distinct types
perhaps two different versions of crate `usb_device` are being used?rustcClick for full compiler diagnostic
usb_cdc.rs(32, 23): arguments to this function are incorrect
bus.rs(149, 1): `UsbBusAllocator<UsbBus<USB>>` is defined in crate `usb_device`
bus.rs(152, 1): `UsbBusAllocator<_>` is defined in crate `usb_device`
device_builder.rs(85, 12): associated function defined here
eldruin commented 3 months ago

Fixed in #214. Thank you!