mirror of
https://github.com/esphome/esphome.git
synced 2025-09-01 10:52:19 +01:00
36 lines
954 B
C++
36 lines
954 B
C++
// Should not be needed, but it's required to pass CI clang-tidy checks
|
|
#if defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3)
|
|
#include "usb_host.h"
|
|
#include <cinttypes>
|
|
#include "esphome/core/log.h"
|
|
|
|
namespace esphome {
|
|
namespace usb_host {
|
|
|
|
void USBHost::setup() {
|
|
ESP_LOGCONFIG(TAG, "Setup starts");
|
|
usb_host_config_t config{};
|
|
|
|
if (usb_host_install(&config) != ESP_OK) {
|
|
this->status_set_error("usb_host_install failed");
|
|
this->mark_failed();
|
|
return;
|
|
}
|
|
}
|
|
void USBHost::loop() {
|
|
int err;
|
|
uint32_t event_flags;
|
|
err = usb_host_lib_handle_events(0, &event_flags);
|
|
if (err != ESP_OK && err != ESP_ERR_TIMEOUT) {
|
|
ESP_LOGD(TAG, "lib_handle_events failed failed: %s", esp_err_to_name(err));
|
|
}
|
|
if (event_flags != 0) {
|
|
ESP_LOGD(TAG, "Event flags %" PRIu32 "X", event_flags);
|
|
}
|
|
}
|
|
|
|
} // namespace usb_host
|
|
} // namespace esphome
|
|
|
|
#endif // USE_ESP32_VARIANT_ESP32S2 || USE_ESP32_VARIANT_ESP32S3
|