Chapter 2. API Reference
WIFI_PROV_STA_CONNECTING
WIFI_PROV_STA_CONNECTED
WIFI_PROV_STA_DISCONNECTED
enum wifi_prov_sta_fail_reason_t
WiFi STA connection fail reason.
Values:
WIFI_PROV_STA_AUTH_ERROR
WIFI_PROV_STA_AP_NOT_FOUND
Code examples for above API are provided in the
Code example for above API is provided in
Code example for above API is provided in
2.5 Storage API
2.5.1 FAT Filesystem Support
ESP-IDF uses the
FatFs
library to work with FAT filesystems. FatFs resides in the fatfs component. Although the
library can be used directly, many of its features can be accessed via VFS, using the C standard library and POSIX
API functions.
Additionally, FatFs has been modified to support the runtime pluggable disk I/O layer. This allows mapping of FatFs
drives to physical disks at runtime.
Using FatFs with VFS
The header file
fatfs/vfs/esp_vfs_fat.h
The function
esp_vfs_fat_register()
in VFS. Subsequent operations on files starting with this prefix are forwarded to FatFs APIs. The function
esp_vfs_fat_unregister_path()
Most applications use the following workflow when working with esp_vfs_fat_ functions:
1. Call
esp_vfs_fat_register()
• Path prefix where to mount the filesystem (e.g. "/sdcard", "/spiflash")
• FatFs drive number
• A variable which will receive the pointer to the FATFS structure
2. Call
ff_diskio_register()
3. Call the FatFs function f_mount, and optionally f_fdisk, f_mkfs, to mount the filesystem using the
same drive number which was passed to esp_vfs_fat_register(). For more information, see
documentation.
4. Call the C standard library and POSIX API functions to perform such actions on files as open, read, write,
erase, copy, etc. Use paths starting with the path prefix passed to
"/sdcard/hello.txt"). The filesystem uses
long filenames (LFN), enable the
filenames are available here.
5. Optionally, by enabling the option CONFIG_FATFS_USE_FASTSEEK, use the POSIX lseek function to perform
it faster, the fast seek will not work for files in write mode, so to take advantage of fast seek, you should open
(or close and then reopen) the file in read-only mode.
6. Optionally, call the FatFs library functions directly. In this case, use paths without a VFS prefix (for example,
"/hello.txt").
7. Close all open files.
Espressif Systems
provisioning
directory of ESP-IDF examples.
wifi/smart_config
wifi/wifi_easy_connect/dpp-enrollee
defines the functions for connecting FatFs and VFS.
allocates a FATFS structure and registers a given path prefix
deletes the registration with VFS, and frees the FATFS structure.
to specify:
to register the disk I/O driver for the drive number used in Step 1.
8.3 filenames
CONFIG_FATFS_LONG_FILENAMES
695
Submit Document Feedback
esp_vfs_register()
format (SFN) by default. If you need to use
option. More details on the FatFs
FatFs
(for example,
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers