Skip to content

Commit

Permalink
Update usb-device (#718)
Browse files Browse the repository at this point in the history
* Update usb-device to 0.3.1

The usb-device upgrade is a breaking change for both usb-device and our
HAL.  This commit updates our tier 1 BSPs only.

* Roll back HAL version bump
  • Loading branch information
ianrrees authored Feb 1, 2024
1 parent 49e0bcc commit d46b635
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 34 deletions.
2 changes: 1 addition & 1 deletion boards/atsame54_xpro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ version = "0.16.0"
default-features = false

[dependencies.usb-device]
version = "0.2"
version = "0.3.1"
optional = true

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions boards/feather_m0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ version = "0.7"
features = ["critical-section-single-core"]

[dependencies.usb-device]
version = "0.2"
version = "0.3.1"
optional = true

[dependencies.embedded-sdmmc]
Expand All @@ -39,7 +39,7 @@ optional = true
[dev-dependencies]
cortex-m-rtic = "1.0"
cortex-m = "0.7"
usbd-serial = "0.1"
usbd-serial = "0.2"
cortex-m-semihosting = "0.3"
ssd1306 = "0.7"
embedded-graphics = "0.7.1"
Expand Down
8 changes: 5 additions & 3 deletions boards/feather_m0/examples/usb_echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ fn main() -> ! {
USB_SERIAL = Some(SerialPort::new(bus_allocator));
USB_BUS = Some(
UsbDeviceBuilder::new(bus_allocator, UsbVidPid(0x16c0, 0x27dd))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
.strings(&[StringDescriptors::new(LangID::EN)
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")])
.expect("Failed to set strings")
.device_class(USB_CLASS_CDC)
.build(),
);
Expand Down
4 changes: 2 additions & 2 deletions boards/feather_m4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ version = "0.16.0"
default-features = false

[dependencies.usb-device]
version = "0.2"
version = "0.3.1"
optional = true

[dev-dependencies]
usbd-serial = "0.1"
usbd-serial = "0.2"
cortex-m-rtic = "0.6.0-rc.2"
panic-halt = "0.2"
panic-semihosting = "0.5"
Expand Down
8 changes: 5 additions & 3 deletions boards/feather_m4/examples/nvm_dsu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ fn main() -> ! {
USB_SERIAL = Some(SerialPort::new(bus_allocator));
USB_BUS = Some(
UsbDeviceBuilder::new(bus_allocator, UsbVidPid(0x16c0, 0x27dd))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
.strings(&[StringDescriptors::new(LangID::EN)
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")])
.expect("Failed to set strings")
.device_class(USB_CLASS_CDC)
.build(),
);
Expand Down
8 changes: 5 additions & 3 deletions boards/feather_m4/examples/pukcc_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ fn main() -> ! {
USB_SERIAL = Some(SerialPort::new(bus_allocator));
USB_BUS = Some(
UsbDeviceBuilder::new(bus_allocator, UsbVidPid(0x16c0, 0x27dd))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
.strings(&[StringDescriptors::new(LangID::EN)
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")])
.expect("Failed to set strings")
.device_class(USB_CLASS_CDC)
.build(),
);
Expand Down
8 changes: 5 additions & 3 deletions boards/feather_m4/examples/smart_eeprom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ fn main() -> ! {
USB_SERIAL = Some(SerialPort::new(bus_allocator));
USB_BUS = Some(
UsbDeviceBuilder::new(bus_allocator, UsbVidPid(0x16c0, 0x27dd))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
.strings(&[StringDescriptors::new(LangID::EN)
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")])
.expect("Failed to set strings")
.device_class(USB_CLASS_CDC)
.build(),
);
Expand Down
12 changes: 8 additions & 4 deletions boards/feather_m4/examples/usb_echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ fn main() -> ! {
USB_SERIAL = Some(SerialPort::new(bus_allocator));
USB_BUS = Some(
UsbDeviceBuilder::new(bus_allocator, UsbVidPid(0x16c0, 0x27dd))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
.strings(&[StringDescriptors::new(LangID::EN)
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")])
.expect("Failed to set strings")
.device_class(USB_CLASS_CDC)
.build(),
);
Expand All @@ -70,7 +72,9 @@ fn main() -> ! {

loop {
cycle_delay(5 * 1024 * 1024);
red_led.toggle().unwrap();
red_led.set_high().unwrap();
cycle_delay(5 * 1024 * 1024);
red_led.set_low().unwrap();
}
}

Expand Down
4 changes: 2 additions & 2 deletions boards/metro_m0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ version = "0.16.0"
default-features = false

[dependencies.usb-device]
version = "0.2"
version = "0.3.1"
optional = true

[dev-dependencies]
cortex-m = "0.7"
usbd-serial = "0.1"
usbd-serial = "0.2"
panic-halt = "0.2"
panic-semihosting = "0.5"
cortex-m-rtic = "1.0"
Expand Down
8 changes: 5 additions & 3 deletions boards/metro_m0/examples/usb_echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ fn main() -> ! {
USB_SERIAL = Some(SerialPort::new(bus_allocator));
USB_BUS = Some(
UsbDeviceBuilder::new(bus_allocator, UsbVidPid(0x16c0, 0x27dd))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
.strings(&[StringDescriptors::new(LangID::EN)
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")])
.expect("Failed to set strings")
.device_class(USB_CLASS_CDC)
.build(),
);
Expand Down
4 changes: 2 additions & 2 deletions boards/metro_m4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ version = "0.16.0"
default-features = false

[dependencies.usb-device]
version = "0.2"
version = "0.3.1"
optional = true

[dependencies.cortex-m]
Expand All @@ -33,7 +33,7 @@ features = ["critical-section-single-core"]

[dev-dependencies]
cortex-m = "0.7"
usbd-serial = "0.1"
usbd-serial = "0.2"
panic-probe = "0.3"
panic-halt = "0.2"
panic-semihosting = "0.5"
Expand Down
8 changes: 5 additions & 3 deletions boards/metro_m4/examples/usb_logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ fn main() -> ! {
USB_SERIAL = Some(SerialPort::new(bus_allocator));
USB_BUS = Some(
UsbDeviceBuilder::new(bus_allocator, UsbVidPid(0x2222, 0x3333))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
.strings(&[StringDescriptors::new(LangID::EN)
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")])
.expect("Failed to set strings")
.device_class(USB_CLASS_CDC)
.build(),
);
Expand Down
1 change: 1 addition & 0 deletions hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Update README.md - moves some content to wiki
- Remove pin `pa28` from the `d21el` target (#717)
- Fix a pwm configuration for the `tc4` on `D5x` targets (#720)
- Update to usb-device 0.3.1

# v0.16.0

Expand Down
2 changes: 1 addition & 1 deletion hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ embedded-sdmmc = {version = "0.3", optional = true}
jlink_rtt = {version = "0.2", optional = true}
mcan-core = {version = "0.2", optional = true}
rtic-monotonic = {version = "1.0", optional = true}
usb-device = {version = "0.2", optional = true}
usb-device = {version = "0.3.1", optional = true}
defmt = {version = "0.3.4", optional = true}

#===============================================================================
Expand Down
2 changes: 1 addition & 1 deletion hal/src/thumbv6m/usb/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl From<EndpointType> for EndpointTypeBits {
fn from(ep_type: EndpointType) -> EndpointTypeBits {
match ep_type {
EndpointType::Control => EndpointTypeBits::Control,
EndpointType::Isochronous => EndpointTypeBits::Isochronous,
EndpointType::Isochronous { .. } => EndpointTypeBits::Isochronous,
EndpointType::Bulk => EndpointTypeBits::Bulk,
EndpointType::Interrupt => EndpointTypeBits::Interrupt,
}
Expand Down
2 changes: 1 addition & 1 deletion hal/src/thumbv7em/usb/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl From<EndpointType> for EndpointTypeBits {
fn from(ep_type: EndpointType) -> EndpointTypeBits {
match ep_type {
EndpointType::Control => EndpointTypeBits::Control,
EndpointType::Isochronous => EndpointTypeBits::Isochronous,
EndpointType::Isochronous { .. } => EndpointTypeBits::Isochronous,
EndpointType::Bulk => EndpointTypeBits::Bulk,
EndpointType::Interrupt => EndpointTypeBits::Interrupt,
}
Expand Down

0 comments on commit d46b635

Please sign in to comment.