|
2 | 2 |
|
3 | 3 | [](https://github.com/adafruit/Adafruit_TinyUSB_Arduino/actions) [](https://opensource.org/licenses/MIT)
|
4 | 4 |
|
5 |
| -This library is a Arduino-friendly version of [TinyUSB](https://github.com/hathach/tinyusb) stack. It is designed with structure and APIs that are easily integrated to existing or new Arduino Core. Supported platform including: |
| 5 | +This library is a Arduino-friendly version of [TinyUSB](https://github.com/hathach/tinyusb) stack. |
| 6 | +It is designed with structure and APIs that are easily integrated to an Arduino Core. |
6 | 7 |
|
7 |
| -- [Adafruit_nRF52_Arduino](https://github.com/adafruit/Adafruit_nRF52_Arduino) |
8 |
| -- [Adafruit/ArduinoCore-samd](https://github.com/adafruit/ArduinoCore-samd) selectable via menu`Tools->USB Stack->TinyUSB` |
9 |
| -- [earlephilhower/arduino-pico](https://github.com/earlephilhower/arduino-pico) selectable via menu `Tools->USB Stack->Adafruit TinyUSB` |
| 8 | +## Features |
10 | 9 |
|
11 |
| -Current class drivers supported are |
| 10 | +Currently only support device mode only, supported class drivers are: |
12 | 11 |
|
13 | 12 | - Communication (CDC): which is used to implement `Serial` monitor
|
14 | 13 | - Human Interface Device (HID): Generic (In & Out), Keyboard, Mouse, Gamepad etc ...
|
15 | 14 | - Mass Storage Class (MSC): with multiple LUNs
|
16 | 15 | - Musical Instrument Digital Interface (MIDI)
|
17 | 16 | - WebUSB with vendor specific class
|
18 | 17 |
|
19 |
| -For supported ArduinoCore, to use this library, you only need to have `<Adafruit_TinyUSB.h>` in your sketch. If your ArduinoCore does not support TinyUSB library yet, it is rather simple to port. |
| 18 | +## Supported Cores |
| 19 | + |
| 20 | +There are 2 type of supported cores: with and without built-in support for TinyUSB. Built-in support provide seamless integration but requires extra code added to core's source code. Unfortunately it is not always easy or possible to make those modification. |
| 21 | + |
| 22 | +### Cores with built-in support |
| 23 | + |
| 24 | +Following core has Tinyusb as either the primary usb stack or selectable via menu `Tools->USB Stack`. You only need to include `<Adafruit_TinyUSB.h>` in your sketch to use. |
| 25 | + |
| 26 | +- [Adafruit_nRF52_Arduino](https://github.com/adafruit/Adafruit_nRF52_Arduino) |
| 27 | +- [adafruit/ArduinoCore-samd](https://github.com/adafruit/ArduinoCore-samd) |
| 28 | +- [earlephilhower/arduino-pico](https://github.com/earlephilhower/arduino-pico) |
| 29 | + |
| 30 | +### Cores without built-in support |
| 31 | + |
| 32 | +Following is cores without built-in support |
| 33 | + |
| 34 | +- **mbed_rp2040** |
| 35 | + |
| 36 | +It is still possible to use TinyUSB but with some limits such as: |
| 37 | + |
| 38 | +- `TinyUSB_Device_Init()` need to be manually called in setup() |
| 39 | +- `TinyUSB_Device_Task()` and/or `TinyUSB_Device_FlushCDC()` may (or not) need to be manually called in loop() |
| 40 | +- Use `SerialTinyUSB` name instead of Serial for serial monitor |
| 41 | +- And there could be more other issues, using on these cores should be considered as experimental |
20 | 42 |
|
21 | 43 | ## Class Driver API
|
22 | 44 |
|
23 | 45 | More document to write ...
|
24 | 46 |
|
25 | 47 | ## Porting Guide
|
26 | 48 |
|
27 |
| -It is rather easy if you want to integrate TinyUSB lib to your ArduinoCore. |
| 49 | +To integrate TinyUSB library to a Arduino core, you will need to make changes to the core for built-in support and library for porting the mcu/platform. |
| 50 | + |
| 51 | +### Arduino Core Changes |
28 | 52 |
|
29 |
| -### ArduinoCore Changes |
| 53 | +If possible, making changes to core will allow it to have built-in which make it almost transparent to user sketch |
30 | 54 |
|
31 | 55 | 1. Add this repo as submodule (or have local copy) at your ArduioCore/libraries/Adafruit_TinyUSB_Arduino (much like SPI).
|
32 | 56 | 2. Since Serial as CDC is considered as part of the core, we need to have `#include "Adafruit_USBD_CDC.h"` within your `Arduino.h`. For this to work, your `platform.txt` include path need to have `"-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"`.
|
|
0 commit comments