adafruit / Adafruit_nRF52_Arduino

Adafruit code for the Nordic nRF52 BLE SoC on Arduino
Other
610 stars 494 forks source link

Rework tinyusb lib #640

Closed hathach closed 3 years ago

hathach commented 3 years ago

Follow https://github.com/adafruit/Adafruit_TinyUSB_Arduino/pull/80. This make major changes to TinyUSB library and moving all tinyusb sources to external lib. All sketches using this core must have #include <Adafruit_TinyUSB.h> For library to be able to link and have Serial available (although you don't use any other USB classes).

Similar to https://github.com/earlephilhower/arduino-pico/pull/127 and https://github.com/adafruit/ArduinoCore-samd/pull/298

This PR rework how TinyUSB arduino lib is organized, making it more portable and less effort to maintain the library across arduino cores and as intented to be release as initial v1. Major changes includes:

  • All the sources file are kept within this repository (include tinyusb stack and user class) instead of splitting sources with https://github.com/adafruit/Adafruit_TinyUSB_ArduinoCore, which will be obsoleted and archived once this is merge.
  • Reduce footprint on core bsp with new Adafruit_TinyUSB_API with core, and port API. Both APIs (along with tusb_config.h) can be implemented at sketch level should the core doesn't support TinyUSB lib. (though you still need to forward IRQ to tinyusb).
  • Minor API renaming, though most user API still works as it is
  • Since TinyUSB is not part of the core anymore, all the sketches want to use TinyUSB lib must explicitly have #include <Adafruit_TinyUSB.h> same way as you would like to use SPI. Even if the sketch only Serial otherwise the linker will failed to find tinyusb lib sources.

Note: CI is failed since both samd and arduino core need to be updated