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

Enable library for Arduino SAMD based on USBCON #163

Closed
wants to merge 1 commit into from

Conversation

Spegs21
Copy link

@Spegs21 Spegs21 commented Mar 28, 2022

TinyUSB can be used without explicitly defining USE_TINYUSB. This is useful for cores without built-in support for the define.

Related PR: arduino/ArduinoCore-samd#668

Copy link
Member

@hathach hathach left a comment

Choose a reason for hiding this comment

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

thank you for your PR, I have a few requests as follows:

  1. revert change to nrf since it is out of scope of this PR
  2. please explain again why changes with samd would help
  3. your testing matrix: examples + boards + core (adafruit/arduino)

Note: since this PR need arduino/ArduinoCore-samd#668, we could approve this but it won't get merged until the other is also approved/merged

@@ -34,7 +34,7 @@ extern "C" {
//--------------------------------------------------------------------
#define CFG_TUSB_MCU OPT_MCU_NRF5X

#ifdef USE_TINYUSB
#ifdef USE_TINYUSB || !defined(USBCON)
Copy link
Member

Choose a reason for hiding this comment

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

please revert, since this PR is about samd

Copy link
Author

Choose a reason for hiding this comment

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

No problem, I'll fix it.

@@ -38,7 +38,7 @@ extern "C" {
#define CFG_TUSB_MCU OPT_MCU_SAMD21
#endif

#ifdef USE_TINYUSB
#if defined(USE_TINYUSB) || !defined(USBCON)
Copy link
Member

Choose a reason for hiding this comment

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

can you explain again, why putting || !defined(USBCON) would help. I can imagine you drop the USBCON in your board.txt, why not also add USE_TINYUSB as well. I would prefer USE_TINYUSB is explicitly specify when using with the stack.

Copy link
Author

Choose a reason for hiding this comment

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

In my proposed changes to the Arduino SAMD core USBCON would not longer be defined as you have said. I don't add USE_TINYUSB because it would be a library specific change to the Arduino core and I think the team would be less likely to accept it.

Also, if USE_TINYUSB was added, the logic for defining Serial would need updated as it would conflict with the Arduino SAMD core's definition. This is another reason why I chose this route.

I agree that not explicitly specifying USE_TINYUSB is not ideal but you've said yourself that Arduino team probably would not want to do it.

Copy link
Member

@hathach hathach Mar 29, 2022

Choose a reason for hiding this comment

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

from Arduino core pov, USBCON is defined when using CDC as Serial, and there is other board which use FTDI/CP210x as Serial, which lack of USBCON actually means. It may not be popular with samd core, but it is with avr one. And USBCON is consistently used in that manner.

Therefore I don't think you could persuade Arduino team to use lack of it as mean for TinyUSB, especially Arduino goal is having consistent API across other cores and libraries. Asking them to add menu for other usb stack has a better standing ground IMHO. But let wait to see if I am wrong.

Copy link
Author

Choose a reason for hiding this comment

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

That makes sense. I haven't looked much at the AVR core so I didn't have that experience for reference. I figured USBCON had a more important use but like you said it wasn't obvious within the SAMD core.

If they aren't comfortable with it, a different defiine can be created to disable the built-in USB core.

Ideally a menu option could be added for TinyUSB but we'll see.

@hathach hathach marked this pull request as draft May 6, 2022 06:56
@hathach
Copy link
Member

hathach commented May 6, 2022

convert to draft to prevent accidentally merged. Should be marked as ready when other Arduino Core PR is merged, we could then continue with the review.

@hathach
Copy link
Member

hathach commented Mar 22, 2023

closed due to lack of activities

@hathach hathach closed this Mar 22, 2023
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