From 6e92fc04164bff9d5bb6fc61936c896efba503d9 Mon Sep 17 00:00:00 2001 From: Tomas Rezucha Date: Wed, 4 Oct 2023 20:42:39 +0200 Subject: [PATCH] feature(examples/usb): Define maximum opend files in MSC device example --- .../peripherals/usb/device/tusb_msc/main/idf_component.yml | 2 +- .../peripherals/usb/device/tusb_msc/main/tusb_msc_main.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/peripherals/usb/device/tusb_msc/main/idf_component.yml b/examples/peripherals/usb/device/tusb_msc/main/idf_component.yml index 06b047d6a2..1659a1ebe3 100644 --- a/examples/peripherals/usb/device/tusb_msc/main/idf_component.yml +++ b/examples/peripherals/usb/device/tusb_msc/main/idf_component.yml @@ -1,4 +1,4 @@ ## IDF Component Manager Manifest File dependencies: - espressif/esp_tinyusb: "^1.2" + espressif/esp_tinyusb: "^1.4.2" idf: "^5.0" diff --git a/examples/peripherals/usb/device/tusb_msc/main/tusb_msc_main.c b/examples/peripherals/usb/device/tusb_msc/main/tusb_msc_main.c index 7c157bf037..89f3dd9ef9 100644 --- a/examples/peripherals/usb/device/tusb_msc/main/tusb_msc_main.c +++ b/examples/peripherals/usb/device/tusb_msc/main/tusb_msc_main.c @@ -347,7 +347,8 @@ void app_main(void) const tinyusb_msc_spiflash_config_t config_spi = { .wl_handle = wl_handle, - .callback_mount_changed = storage_mount_changed_cb /* First way to register the callback. This is while initializing the storage. */ + .callback_mount_changed = storage_mount_changed_cb, /* First way to register the callback. This is while initializing the storage. */ + .mount_config.max_files = 5, }; ESP_ERROR_CHECK(tinyusb_msc_storage_init_spiflash(&config_spi)); ESP_ERROR_CHECK(tinyusb_msc_register_callback(TINYUSB_MSC_EVENT_MOUNT_CHANGED, storage_mount_changed_cb)); /* Other way to register the callback i.e. registering using separate API. If the callback had been already registered, it will be overwritten. */ @@ -357,7 +358,8 @@ void app_main(void) const tinyusb_msc_sdmmc_config_t config_sdmmc = { .card = card, - .callback_mount_changed = storage_mount_changed_cb /* First way to register the callback. This is while initializing the storage. */ + .callback_mount_changed = storage_mount_changed_cb, /* First way to register the callback. This is while initializing the storage. */ + .mount_config.max_files = 5, }; ESP_ERROR_CHECK(tinyusb_msc_storage_init_sdmmc(&config_sdmmc)); ESP_ERROR_CHECK(tinyusb_msc_register_callback(TINYUSB_MSC_EVENT_MOUNT_CHANGED, storage_mount_changed_cb)); /* Other way to register the callback i.e. registering using separate API. If the callback had been already registered, it will be overwritten. */