EasyManua.ls Logo

Espressif ESP32-S2 - Page 709

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
slot_config: Pointer to structure with slot configuration. For SPI peripheral, pass a pointer to
sdspi_device_config_t structure initialized using SDSPI_DEVICE_CONFIG_DEFAULT().
mount_config: pointer to structure with extra parameters for mounting FATFS
[out] out_card: If not NULL, pointer to the card information structure will be returned via
this argument. It is suggested to hold this handle and use it to unmount the card later if needed.
Otherwise its not suggested to use more than one card at the same time and unmount one of them
in your application.
struct esp_vfs_fat_mount_config_t
Configuration arguments for esp_vfs_fat_sdmmc_mount and esp_vfs_fat_spiflash_mount functions.
Public Members
bool format_if_mount_failed
If FAT partition can not be mounted, and this parameter is true, create partition table and format the
filesystem.
int max_files
Max number of open files.
size_t allocation_unit_size
If format_if_mount_failed is set, and mount fails, format the card with given allocation unit size. Must
be a power of 2, between sector size and 128 * sector size. For SD cards, sector size is always 512 bytes.
For wear_levelling, sector size is determined by CONFIG_WL_SECTOR_SIZE option.
Using larger allocation unit size will result in higher read/write performance and higher overhead when
storing small files.
Setting this field to 0 will result in allocation unit set to the sector size.
esp_err_t esp_vfs_fat_sdcard_unmount(const char *base_path, sdmmc_card_t *card)
Unmount an SD card from the FAT filesystem and release resources acquired using
esp_vfs_fat_sdmmc_mount() or esp_vfs_fat_sdspi_mount()
Return
ESP_OK on success
ESP_ERR_INVALID_ARG if the card argument is unregistered
ESP_ERR_INVALID_STATE if esp_vfs_fat_sdmmc_mount hasnt been called
Using FatFs with VFS in read-only mode
The header file fatfs/vfs/esp_vfs_fat.h also defines the convenience functions
esp_vfs_fat_rawflash_mount() and esp_vfs_fat_rawflash_unmount(). These func-
tions perform Steps 1-3 and 7-9 respectively for read-only FAT partitions. These are particularly helpful for
data partitions written only once during factory provisioning which will not be changed by production application
throughout the lifetime of the hardware.
esp_err_t esp_vfs_fat_rawflash_mount(const char *base_path, const char *partition_label,
const esp_vfs_fat_mount_config_t *mount_config)
Convenience function to initialize read-only FAT filesystem and register it in VFS.
This is an all-in-one function which does the following:
finds the partition with defined partition_label. Partition label should be configured in the partition table.
mounts FAT partition using FATFS library
registers FATFS library with VFS, with prefix given by base_prefix variable
Note Wear levelling is not used when FAT is mounted in read-only mode using this function.
Return
ESP_OK on success
ESP_ERR_NOT_FOUND if the partition table does not contain FATFS partition with given label
Espressif Systems 698
Submit Document Feedback
Release v4.4

Table of Contents