Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usb low speed #678

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions boards/metro_m0/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
1 change: 1 addition & 0 deletions boards/metro_m0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
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 @@
- 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

Expand Down
1 change: 1 addition & 0 deletions hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

#===============================================================================
Expand Down
4 changes: 4 additions & 0 deletions hal/src/thumbv6m/usb/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down
4 changes: 4 additions & 0 deletions hal/src/thumbv7em/usb/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down