refactor(usb/examples): Depend on new esp_driver_gpio

This will exclude unneeded drivers from the build.
pull/13090/head
Tomas Rezucha 2024-01-17 20:30:01 +01:00
rodzic 202bcadfd3
commit a5e647cf7f
7 zmienionych plików z 12 dodań i 13 usunięć

Wyświetl plik

@ -1,5 +1,5 @@
idf_component_register(
SRCS "tusb_hid_example_main.c"
INCLUDE_DIRS "."
PRIV_REQUIRES driver
PRIV_REQUIRES esp_driver_gpio
)

Wyświetl plik

@ -3,5 +3,3 @@ idf_component_register(
INCLUDE_DIRS "."
PRIV_REQUIRES usb
)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-missing-field-initializers")

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: CC0-1.0
*/
@ -109,10 +109,9 @@ extern "C" void app_main(void)
// Install USB Host driver. Should only be called once in entire application
ESP_LOGI(TAG, "Installing USB Host");
const usb_host_config_t host_config = {
.skip_phy_setup = false,
.intr_flags = ESP_INTR_FLAG_LEVEL1,
};
usb_host_config_t host_config = {};
host_config.skip_phy_setup = false;
host_config.intr_flags = ESP_INTR_FLAG_LEVEL1;
ESP_ERROR_CHECK(usb_host_install(&host_config));
// Create a task that will handle USB library events

Wyświetl plik

@ -1,4 +1,4 @@
idf_component_register(SRCS "hid_host_example.c"
INCLUDE_DIRS "."
PRIV_REQUIRES usb driver
PRIV_REQUIRES usb esp_driver_gpio
)

Wyświetl plik

@ -1,4 +1,4 @@
idf_component_register(SRCS "msc_example_main.c"
INCLUDE_DIRS ""
PRIV_REQUIRES usb fatfs driver esp_timer
PRIV_REQUIRES usb fatfs esp_driver_gpio esp_timer
)

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@ -217,17 +217,19 @@ static void usb_task(void *args)
};
ESP_ERROR_CHECK(msc_host_install(&msc_config));
bool has_clients = true;
while (true) {
uint32_t event_flags;
usb_host_lib_handle_events(portMAX_DELAY, &event_flags);
// Release devices once all clients has deregistered
if (event_flags & USB_HOST_LIB_EVENT_FLAGS_NO_CLIENTS) {
has_clients = false;
if (usb_host_device_free_all() == ESP_OK) {
break;
};
}
if (event_flags & USB_HOST_LIB_EVENT_FLAGS_ALL_FREE) {
if (event_flags & USB_HOST_LIB_EVENT_FLAGS_ALL_FREE && !has_clients) {
break;
}
}

Wyświetl plik

@ -1,4 +1,4 @@
idf_component_register(SRCS "usb_host_lib_main.c" "class_driver.c"
INCLUDE_DIRS "."
PRIV_REQUIRES usb driver
PRIV_REQUIRES usb esp_driver_gpio
)