mirror of
https://github.com/esphome/esphome.git
synced 2026-03-23 17:54:12 +08:00
@@ -2,6 +2,7 @@
|
||||
#include "tinyusb_component.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "tinyusb_default_config.h"
|
||||
|
||||
namespace esphome::tinyusb {
|
||||
|
||||
@@ -15,19 +16,19 @@ void TinyUSB::setup() {
|
||||
this->string_descriptor_[SERIAL_NUMBER] = mac_addr_buf;
|
||||
}
|
||||
|
||||
this->tusb_cfg_ = {
|
||||
.port = TINYUSB_PORT_FULL_SPEED_0,
|
||||
.phy = {.skip_setup = false},
|
||||
.descriptor =
|
||||
{
|
||||
.device = &this->usb_descriptor_,
|
||||
.string = this->string_descriptor_,
|
||||
.string_count = SIZE,
|
||||
},
|
||||
// Start from esp_tinyusb defaults to keep required task settings valid across esp_tinyusb updates.
|
||||
this->tusb_cfg_ = TINYUSB_DEFAULT_CONFIG();
|
||||
this->tusb_cfg_.port = TINYUSB_PORT_FULL_SPEED_0;
|
||||
this->tusb_cfg_.phy.skip_setup = false;
|
||||
this->tusb_cfg_.descriptor = {
|
||||
.device = &this->usb_descriptor_,
|
||||
.string = this->string_descriptor_,
|
||||
.string_count = SIZE,
|
||||
};
|
||||
|
||||
esp_err_t result = tinyusb_driver_install(&this->tusb_cfg_);
|
||||
if (result != ESP_OK) {
|
||||
ESP_LOGE(TAG, "tinyusb_driver_install failed: %s", esp_err_to_name(result));
|
||||
this->mark_failed();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user