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

Each core provides a different USBAPI #141

Open
Legion2 opened this issue Feb 18, 2021 · 2 comments
Open

Each core provides a different USBAPI #141

Legion2 opened this issue Feb 18, 2021 · 2 comments

Comments

@Legion2
Copy link

Legion2 commented Feb 18, 2021

The Arduino Core API defines a very low level USB api in api/USBAPI.h. This API is implemented by the avr core in cores/arduino/USBCore.cpp. But it is not implemented by samd core, which implements the same functionality but in its own USBDeviceClass class. The USB implementation in megaavr core (USBCore.cpp) is a copy of the avr usb implementation with some deviations. The mbed core implements its own version of the PluggableUSBModule.

As a result, each core implements its own USB API which is incompatible with the others, there exist many code duplicates and users of the USB API have to understand and adapt their code to each individual core implementation.

Are there any plans to improve this situation?

@dogtopus
Copy link

dogtopus commented Apr 7, 2022

This is one of the biggest reason if not the only reason I don't like Arduino/Arduino-compatibles despite its quite mature ecosystem.

PluggableUSB was pretty ambitious when it came out but in the end it's practically nothing but an internal implementation detail.

@vChavezB
Copy link

vChavezB commented Dec 12, 2022

Yes unfortunately the api for drivers such as usb are not compatible. What I have learned is that the Arduino ecosystem is only useful for one time prototypes but does not scale well enough as you need to modify the software to integrate it into different hardware. Example of this are the libraries that support multiple boards. They typically use #if #ifdef to mitigate the differences in API.

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

No branches or pull requests

3 participants