|
3 | 3 | * SPDX-License-Identifier: Apache-2.0
|
4 | 4 | */
|
5 | 5 |
|
| 6 | +#include <inttypes.h> |
| 7 | +#include "ff.h" |
6 | 8 | #include "diskio.h"
|
7 | 9 | #include "esp_vfs_fat.h"
|
8 | 10 | #include "driver/sdmmc_defs.h"
|
9 | 11 | #include "tinyusb.h"
|
10 | 12 | #include "sdmmc_cmd.h"
|
| 13 | +#include "esp_idf_version.h" |
11 | 14 |
|
12 | 15 | static const char *TAG = "usb_msc_wireless";
|
13 | 16 |
|
@@ -50,7 +53,11 @@ static esp_err_t init_fat(sdmmc_card_t **card_handle, const char *base_path)
|
50 | 53 | .max_files = 9,
|
51 | 54 | .allocation_unit_size = CONFIG_WL_SECTOR_SIZE
|
52 | 55 | };
|
| 56 | +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) |
53 | 57 | ret = esp_vfs_fat_spiflash_mount_rw_wl(base_path, "storage", &mount_config, &wl_handle_1);
|
| 58 | +#else |
| 59 | + ret = esp_vfs_fat_spiflash_mount(base_path, "storage", &mount_config, &wl_handle_1); |
| 60 | +#endif |
54 | 61 |
|
55 | 62 | if (ret != ESP_OK) {
|
56 | 63 | ESP_LOGE(TAG, "Failed to mount FATFS (%s)", esp_err_to_name(ret));
|
@@ -154,13 +161,8 @@ void app_main(void)
|
154 | 161 | #endif
|
155 | 162 |
|
156 | 163 | ESP_LOGI(TAG, "USB MSC initialization");
|
157 |
| - const tinyusb_config_t tusb_cfg = { |
158 |
| - .device_descriptor = NULL, |
159 |
| - .string_descriptor = NULL, |
160 |
| - .external_phy = false, |
161 |
| - .configuration_descriptor = NULL, |
162 |
| - .self_powered = false, |
163 |
| - }; |
| 164 | + |
| 165 | + const tinyusb_config_t tusb_cfg = {0}; |
164 | 166 |
|
165 | 167 | ESP_ERROR_CHECK(tinyusb_driver_install(&tusb_cfg));
|
166 | 168 | ESP_LOGI(TAG, "USB MSC initialization DONE");
|
|
0 commit comments