Chapter 2. API Reference
API Reference
Header File
• components/tinyusb/additions/include/tinyusb.h
Functions
esp_err_t tinyusb_driver_install(const tinyusb_config_t *config)
This is an all-in-one helper function, including:
1. USB device driver initialization
2. Descriptors preparation
3. TinyUSB stack initialization
4. Creates and start a task to handle usb events
Note Don’t change Custom descriptor, but if it has to be done, Suggest to define as follows in order to match
the Interface Association Descriptor (IAD): bDeviceClass = TUSB_CLASS_MISC, bDeviceSubClass =
MISC_SUBCLASS_COMMON,
Parameters
• config: tinyusb stack specific configuration
Return Value
• ESP_ERR_INVALID_ARG: Install driver and tinyusb stack failed because of invalid argument
• ESP_FAIL: Install driver and tinyusb stack failed because of internal error
• ESP_OK: Install driver and tinyusb stack successfully
Structures
struct tinyusb_config_t
Configuration structure of the tinyUSB core.
Public Members
tusb_desc_device_t *descriptor
Pointer to a device descriptor
const char **string_descriptor
Pointer to an array of string descriptors
bool external_phy
Should USB use an external PHY
Header File
• components/tinyusb/additions/include/tinyusb_types.h
Macros
USB_ESPRESSIF_VID
USB_STRING_DESCRIPTOR_ARRAY_SIZE
Type Definitions
typedef const char *tusb_desc_strarray_device_t[USB_STRING_DESCRIPTOR_ARRAY_SIZE]
Enumerations
enum tinyusb_usbdev_t
Values:
TINYUSB_USBDEV_0
Espressif Systems 483
Submit Document Feedback
Release v4.4