1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-14 01:02:19 +01:00
Files
esphome/esphome/components/usb_host/usb_host_component.cpp
J. Nick Koston 3843e4011f preen
2025-07-24 20:58:29 -10:00

35 lines
916 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() {
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