diff --git a/boards/metro_m0/CHANGELOG.md b/boards/metro_m0/CHANGELOG.md index 261fe161e76..6a0009267fb 100644 --- a/boards/metro_m0/CHANGELOG.md +++ b/boards/metro_m0/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +- Add `usb_low_speed` usb cfg feature to set USB speed to low speed (1.5Mbps). + # v0.12.1 - Update to `atsamd-hal` version `0.15.1` diff --git a/boards/metro_m0/Cargo.toml b/boards/metro_m0/Cargo.toml index 80606158e8a..45fa7d59c05 100644 --- a/boards/metro_m0/Cargo.toml +++ b/boards/metro_m0/Cargo.toml @@ -42,6 +42,7 @@ rtic = ["atsamd-hal/rtic"] unproven = ["atsamd-hal/unproven"] use_rtt = ["atsamd-hal/use_rtt"] usb = ["atsamd-hal/usb", "usb-device"] +usb_low_speed = ["atsamd-hal/usb_low_speed"] use_semihosting = [] [profile.dev] diff --git a/hal/CHANGELOG.md b/hal/CHANGELOG.md index 506e88fc6d3..bb80828d1f3 100644 --- a/hal/CHANGELOG.md +++ b/hal/CHANGELOG.md @@ -9,6 +9,7 @@ - Fix failing `bsp_pins!` invocation with no aliases (#605 fixes #599) - Add Advanced Encryption Standard (AES) peripheral support including RustCrypto compatible backend - Add embedded-hal `InputPin` trait to EIC pins +- Add `usb_low_speed` usb cfg feature to set USB speed to low speed (1.5Mbps). # v0.15.1 diff --git a/hal/Cargo.toml b/hal/Cargo.toml index 19d8df364fe..2842d91dd3e 100644 --- a/hal/Cargo.toml +++ b/hal/Cargo.toml @@ -181,6 +181,7 @@ rtic = ["rtic-monotonic", "fugit"] sdmmc = ["embedded-sdmmc"] unproven = ["embedded-hal/unproven"] usb = ["usb-device"] +usb_low_speed = [] use_rtt = ["jlink_rtt"] #=============================================================================== diff --git a/hal/src/thumbv6m/usb/bus.rs b/hal/src/thumbv6m/usb/bus.rs index f4c31d77437..d817714b915 100644 --- a/hal/src/thumbv6m/usb/bus.rs +++ b/hal/src/thumbv6m/usb/bus.rs @@ -645,6 +645,10 @@ impl Inner { }); // full speed usb.ctrlb.modify(|_, w| w.spdconf().fs()); + #[cfg(feature = "usb_low_speed")] + { + usb.ctrlb.modify(|_, w| w.spdconf().ls()); + } usb.ctrla.modify(|_, w| w.enable().set_bit()); while usb.syncbusy.read().enable().bit_is_set() {} diff --git a/hal/src/thumbv7em/usb/bus.rs b/hal/src/thumbv7em/usb/bus.rs index e8e544001bd..1edf1788703 100644 --- a/hal/src/thumbv7em/usb/bus.rs +++ b/hal/src/thumbv7em/usb/bus.rs @@ -589,6 +589,10 @@ impl Inner { }); // full speed usb.ctrlb.modify(|_, w| w.spdconf().fs()); + #[cfg(feature = "usb_low_speed")] + { + usb.ctrlb.modify(|_, w| w.spdconf().ls()); + } usb.ctrla.modify(|_, w| w.enable().set_bit()); while usb.syncbusy.read().enable().bit_is_set() {}