ESPHome 2025.9.0-dev
Loading...
Searching...
No Matches
usb_host_component.cpp
Go to the documentation of this file.
1// Should not be needed, but it's required to pass CI clang-tidy checks
2#if defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3)
3#include "usb_host.h"
4#include <cinttypes>
5#include "esphome/core/log.h"
6
7namespace esphome {
8namespace usb_host {
9
11 usb_host_config_t config{};
12
13 if (usb_host_install(&config) != ESP_OK) {
14 this->status_set_error("usb_host_install failed");
15 this->mark_failed();
16 return;
17 }
18}
20 int err;
21 uint32_t event_flags;
22 err = usb_host_lib_handle_events(0, &event_flags);
23 if (err != ESP_OK && err != ESP_ERR_TIMEOUT) {
24 ESP_LOGD(TAG, "lib_handle_events failed failed: %s", esp_err_to_name(err));
25 }
26 if (event_flags != 0) {
27 ESP_LOGD(TAG, "Event flags %" PRIu32 "X", event_flags);
28 }
29}
30
31} // namespace usb_host
32} // namespace esphome
33
34#endif // USE_ESP32_VARIANT_ESP32S2 || USE_ESP32_VARIANT_ESP32S3
virtual void mark_failed()
Mark this component as failed.
void status_set_error(const char *message=nullptr)
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7