Spiffs Peripheral

Use this API to initialize, mount and unmount spiffs partition, see functions periph_spiffs_init(), periph_spiffs_mount() and periph_spiffs_unmount(). The data reading / writing is implemented in a separate API described in SPIFFS Stream.

Application Example

Implementation of this API is demonstrated in audio_processing/pipeline_spiffs_amr_resample example.

API Reference

Header File

Functions

esp_periph_handle_t periph_spiffs_init(periph_spiffs_cfg_t *spiffs_config)

Create the spiffs peripheral handle for esp_peripherals.

Note

The handle created by this function will be automatically destroyed when esp_periph_destroy is called

Return

The esp peripheral handle

Parameters
  • spiffs_config: The spiffs configuration

bool periph_spiffs_is_mounted(esp_periph_handle_t periph)

Check if the SPIFFS is mounted or not.

Return

SPIFFS mounted state

Parameters
  • [in] periph: The periph

Structures

struct periph_spiffs_cfg_t

The SPIFFS Peripheral configuration.

Public Members

const char *root

Base path for vfs

const char *partition_label

Optional, label of SPIFFS partition to use. If set to NULL, first partition with subtype=spiffs will be used.

size_t max_files

Maximum number of files that could be open at the same time.

bool format_if_mount_failed

If true, it will format the file system if it fails to mount.

Enumerations

enum periph_spiffs_event_id_t

Peripheral spiffs event id.

Values:

SPIFFS_STATUS_UNKNOWN

No event

SPIFFS_STATUS_MOUNTED

SPIFFS mounted successfully

SPIFFS_STATUS_UNMOUNTED

SPIFFS unmounted successfully

SPIFFS_STATUS_MOUNT_ERROR

SPIFFS mount error

SPIFFS_STATUS_UNMOUNT_ERROR

SPIFFS unmount error