My Project
 All Classes Functions Variables Pages
Public Member Functions | List of all members
FATFS_VFS Class Reference

Provide access to the FAT file system on SPI flash. The FATFS_VFS file system needs a partition definition. This is a map of flash memory that specified an array into which the files should be saved and loaded. A partition is a named entity and the name we choose in the partition definition should be named in the constructor. More...

#include <FATFS_VFS.h>

Public Member Functions

 FATFS_VFS (std::string mountPath, std::string partitionName)
 Constructor. More...
 
void mount ()
 Mount the FAT file system into VFS. The FAT file system found in the partition is mounted into the VFS. More...
 
void setMaxFiles (int maxFiles)
 Set the allowable number of concurrently open files. More...
 
void unmount ()
 Unmount a previously mounted file system. More...
 

Detailed Description

Provide access to the FAT file system on SPI flash. The FATFS_VFS file system needs a partition definition. This is a map of flash memory that specified an array into which the files should be saved and loaded. A partition is a named entity and the name we choose in the partition definition should be named in the constructor.

A partition configuration file can be described in the make menuconfig settings. For example:

nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 1M,
storage, data, fat, , 1M,

The recommended file name for the partition description is partitions.csv

A typical example would be:

FATFS_VFS *fs = new FATFS_VFS("/spiflash", "storage");
fs->mount();
// Perform file I/O
fs->unmount();
delete fs;

Constructor & Destructor Documentation

FATFS_VFS::FATFS_VFS ( std::string  mountPath,
std::string  partitionName 
)

Constructor.

In ESP32, every file system has a mount point. If a file access is attempted south of that mount point, then the corresponding file system will be used. The mountPath parameter defines the mount point for this instance of the FATFS file system. In order to save the files for subsequent retrieval, the file data has to be written to flash memory. A partition table provides a map or layout of the flash memory by defining named partitions. The partitionName parameter defines the name of the partition used to provide the underlying storage for this instance of the FATFS file system.

Parameters
[in]mountPathThe path in the VFS where the FAT file system should be mounted.
[in]partitionNameThe name of the partition used to store the FAT file system.

Member Function Documentation

void FATFS_VFS::mount ( )

Mount the FAT file system into VFS. The FAT file system found in the partition is mounted into the VFS.

Returns
N/A.
void FATFS_VFS::setMaxFiles ( int  maxFiles)

Set the allowable number of concurrently open files.

Parameters
[in]maxFilesNumber of concurrently open files.
Returns
N/A.
void FATFS_VFS::unmount ( )

Unmount a previously mounted file system.

Returns
N/A.

The documentation for this class was generated from the following files: