CommunityGD32Cores / ArduinoCore-GD32

Arduino core for GD32 devices, community developed, based on original GigaDevice's core
Other
89 stars 33 forks source link

PluggableUSB support #65

Closed bjc closed 2 years ago

bjc commented 2 years ago

Adds support for PluggableUSB API.

maxgerhardt commented 2 years ago

Given my original comment at https://github.com/bjc/ArduinoCore-GD32/pull/11#issue-1190483350 the PlatformIO build script still needs to be adapted for

 build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} "-DUSB_MANUFACTURER={build.usb_manufacturer}" "-DUSB_PRODUCT={build.usb_product}"

otherwise compilation will fail, akin to something like in stm32duino.

Another point of issue is guarding the compilation + usage of USB functions for only those boards / chip series that support it, otherwise compilation for other boards will break. I'm e.g. seeing a rather unconditional include of USB-stack headers in cores/arduino/USBCore.h and an unconditional init of the USB stick in cores/arduino/main.cpp which concerns me.

@bjc do you as the original author want to have a look at refactoring / guarding this or should I? Either works for me. I'm eager to getting this merged before I do any major core refactorings.

obra commented 2 years ago

@maxgerhardt I think that if you've got the cycles, it's worth you taking a look at doing that guarding. (You also have more experience with our other GD32 platforms)

maxgerhardt commented 2 years ago

Good to merge after some adaptions made in https://github.com/CommunityGD32Cores/ArduinoCore-GD32/tree/merge_usb.