-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
usb: Refactor some TinyUSB code from rp2 port to shared/tinyusb. #9816
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
Conversation
0ee4ccb
to
04f64f8
Compare
shared/tinyusb/tusb_config.h
Outdated
#if MICROPY_HW_ENABLE_USBDEV | ||
|
||
#ifndef MICROPY_HW_USB_STR_MANUF | ||
#define MICROPY_HW_USB_STR_MANUF "MicroPython" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is MICROPY_HW_USB_MANUFACTURER_STRING
in the stm32 port... we should make them the same. I do prefer having STR
before the string name, rather than _STRING
at the very end. And then I would prefer the full word "MANUFACTURER" because "MANUF" could be confusing to a newcomer.
Well, whatever we go with, it should be consistent across ports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shared/tinyusb/tusb_config.h
Outdated
@@ -2,6 +2,7 @@ | |||
* The MIT License (MIT) | |||
* | |||
* Copyright (c) 2020-2021 Damien P. George | |||
* Copyright (c) 2022 Blake W. Felt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Molorius For this file I'm not sure it's correct to add your copyright. This file was simply moved from one location to another, so there's not much added IP.
Do you agree to the removal of this copyright line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. If I remember correctly I initially had more functions in here which is why I added my name.
04f64f8
to
69ceb12
Compare
@dpgeorge Rebased and made some updates including renaming some of the source files, let me know what you think. |
App the mp_ prefix to usbd_ symbols and files which are defined here and not in TinyUSB. rp2 only for now. This includes some groundwork for dynamic USB devices (defined in Python). This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Requires changing the USB-CDC stdin/stdout guards from MICROPY_HW_ENABLE_USBDEV to the new (in this port) MICROPY_HW_USB_CDC.
69ceb12
to
4578b04
Compare
@dpgeorge I can easily put this commit into a separate PR if it's too much to review in one hit, as well. |
Should I change |
Yes, that would make it consistent with this PR and stm32. |
Ok. Done. |
Merged in eed4eb2 through c8913fd with the following changes:
Thanks @projectgus ! |
Oops, yes indeed! Thanks for cleaning those parts up, @dpgeorge. |
shared/tinyusb
holds the MicroPython-specific TinyUSB code that isn't port-specific.Testing
Have tested these permutations:
MICROPY_HW_USB_MSC 1
).MICROPY_HW_USB_MSC 1
,MICROPY_HW_USB_CDC 0
).MICROPY_HW_USB_MSC 0
,MICROPY_HW_USB_CDC 0
). This creates a device that reports a single configuration with no interfaces, currently not very useful!MICROPY_HW_ENABLE_USBDEV 0
andMICROPY_HW_ENABLE_UART_REPL 1
).All seems to work as expected.