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

Support USB on the stm32f303xd/xe devices #255

Merged
merged 6 commits into from
Jul 15, 2021

Conversation

russellmcc
Copy link
Contributor

The 303xd and 303xe series devices do not have AF14 for pins PA11 and
PA12, so the existing implementation will not work for those devices.

According to an ST document 1, stm32f303xd and xe do not require any
particular mode for the PA11 and PA12 pin, so I've parameterized the
usb::Peripheral type using traits so that any mode will be
supported. I've tried to follow a familiar pattern reminescent of the
gpio alternate function configurations.

This is of course a breaking change so I'm open to other approaches if
anyone has opinions. This seemed to me to be the most elegant and
accurate way to handle this.

@russellmcc russellmcc force-pushed the feature/xd-xe-usb branch 2 times, most recently from 124bae5 to ab61a1a Compare July 13, 2021 03:22
Copy link
Member

@Sh3Rm4n Sh3Rm4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Thank you!

Implementation wise, this looks pretty reasonable, so let's go for it.

CHANGELOG.md Outdated Show resolved Hide resolved
src/usb.rs Outdated Show resolved Hide resolved
src/usb.rs Outdated Show resolved Hide resolved
@russellmcc russellmcc requested a review from Sh3Rm4n July 14, 2021 02:55
Copy link
Member

@Sh3Rm4n Sh3Rm4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to bother you with the changelog. Otherwise, this looks good to go :)

CHANGELOG.md Show resolved Hide resolved
russellmcc and others added 5 commits July 14, 2021 22:04
The 303xd and 303xe series devices do not have AF14 for pins PA11 and
PA12, so the existing implementation will not work for those devices.

According to an ST document [1], stm32f303xd and xe do not require any
particular mode for the PA11 and PA12 pin, so I've parameterized the
`usb::Peripheral` type using traits so that any mode will be
supported.  I've tried to follow a familiar pattern reminescent of the
gpio alternate function configurations.

[1]: https://www.st.com/resource/en/application_note/dm00260340-migrating-between-stm32f303-and-stm32f302-line-products-stmicroelectronics.pdf
Co-authored-by: Fabian <[email protected]>
@russellmcc
Copy link
Contributor Author

Sorry to bother you with the changelog. Otherwise, this looks good to go :)

Woops! No problem, thanks for all of your awesome work on this repo!

@russellmcc russellmcc requested a review from Sh3Rm4n July 15, 2021 02:05
Copy link
Member

@Sh3Rm4n Sh3Rm4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! 👍

@Sh3Rm4n Sh3Rm4n merged commit 20cdc35 into stm32-rs:master Jul 15, 2021
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.

2 participants