Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
USBDevice: Avoid forcing end device to be derived from USBDevice class #11136
By replacing the existing callbacks with proper
The patch could bring a (tiny, big ?) performance hit due to the indirection, but would make the USBDevice class usable as a singleton.
A usage example can be found here https://github.com/arduino/ArduinoCore-nRF528x-mbedos/tree/master/cores/arduino/USB and https://github.com/bcmi-labs/ArduinoCore-nRF528x-mbedos/tree/master/libraries/USBHID
PluggableUSBDevice implements USBDevice and calls phy init() just once; all device drivers (derived from mbed ones) plug on it to create a composite device but they don't derive from USBDevice.
Pull request type
c1728p9 left a comment
This PR seems reasonable to me. Does the use of callback increase or decrease RAM used? Also, you'll need a few more changes if you want to make USBDevice usable without inheriting from it:
Those changes could be made in a separate PR though as this change look good on its own merits.
@0xc0170 the only breaking change is the removal of