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

Allow USB to work with V2 clocking API #808

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

rnd-ash
Copy link
Contributor

@rnd-ash rnd-ash commented Jan 7, 2025

Summary

Continuing my work to allow more peripherals to work with the V2 clocking API, this PR adds a new method (Maybe name should be changed to something more permanent), that allows the UsbBus to be constructed with the new V2 clocking API.

I've left the original constructor untouched in order to maintain compatibility.

Now, in the BSPs, USB can be constructed like so:

pub fn usb(
    usb: pac::Usb,
    pclk_usb: Pclk<Usb, Gclk0Id>, // Can use any Gclk here
    mclk: &mut pac::Mclk,
    d_minus: impl Into<UsbDm>,
    d_plus: impl Into<UsbDp>,
) -> UsbBusAllocator<UsbBus> {
    UsbBusAllocator::new(UsbBus::new_with_v2_clock(pclk_usb, mclk, d_minus.into(), d_plus.into(), usb))
}

@rnd-ash
Copy link
Contributor Author

rnd-ash commented Jan 7, 2025

Additional note. I'm not sure why we even need the pclk here, since the original constructor never made use of the UsbClock that it was given. Maybe we can remove the clock entirely from the V1 constructor and then it would work with both clocking APIs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant