34 const tusb_desc_device_t *dev_descriptor;
35 const char **string_descriptor;
36 const uint8_t *cfg_descriptor;
37 ESP_RETURN_ON_FALSE(config, ESP_ERR_INVALID_ARG,
TAG,
"invalid argument");
40 usb_phy_config_t phy_conf = {
41 .controller = USB_PHY_CTRL_OTG,
42 .otg_mode = USB_OTG_MODE_DEVICE,
46 usb_phy_ext_io_conf_t ext_io_conf = {
55 phy_conf.target = USB_PHY_TARGET_EXT;
56 phy_conf.ext_io_conf = &ext_io_conf;
58 phy_conf.target = USB_PHY_TARGET_INT;
62 const usb_phy_otg_io_conf_t otg_io_conf = USB_PHY_SELF_POWERED_DEVICE(config->
vbus_monitor_io);
64 phy_conf.otg_io_conf = &otg_io_conf;
71#if (CONFIG_TINYUSB_HID_COUNT > 0 || CONFIG_TINYUSB_MIDI_COUNT > 0)
73 ESP_RETURN_ON_FALSE(config->
configuration_descriptor, ESP_ERR_INVALID_ARG,
TAG,
"Configuration descriptor must be provided for this device");
76 ESP_LOGW(
TAG,
"The device's configuration descriptor is not provided by user, using default.");
84 ESP_LOGW(
TAG,
"The device's string descriptor is not provided by user, using default.");
91 ESP_LOGW(
TAG,
"The device's device descriptor is not provided by user, using default.");
96 ESP_RETURN_ON_FALSE(tusb_init(), ESP_FAIL,
TAG,
"Init TinyUSB stack failed");
97#if !CONFIG_TINYUSB_NO_DEFAULT_TASK
100 ESP_LOGI(
TAG,
"TinyUSB Driver installed");
#define ESP_RETURN_ON_ERROR(x, log_tag, format,...)