feature(examples/usb): Define maximum opend files in MSC device example

This commit is contained in:
Tomas Rezucha
2023-10-04 20:42:39 +02:00
parent 9be8149568
commit 6e92fc0416
2 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
## IDF Component Manager Manifest File ## IDF Component Manager Manifest File
dependencies: dependencies:
espressif/esp_tinyusb: "^1.2" espressif/esp_tinyusb: "^1.4.2"
idf: "^5.0" idf: "^5.0"

View File

@ -347,7 +347,8 @@ void app_main(void)
const tinyusb_msc_spiflash_config_t config_spi = { const tinyusb_msc_spiflash_config_t config_spi = {
.wl_handle = wl_handle, .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_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. */ 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 = { const tinyusb_msc_sdmmc_config_t config_sdmmc = {
.card = card, .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_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. */ 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. */