23 lines
617 B
C
23 lines
617 B
C
#include <zephyr/fs/littlefs.h>
|
|
#include <fs.h>
|
|
LOG_MODULE_REGISTER(buzz_fs, LOG_LEVEL_INF);
|
|
|
|
#define STORAGE_PARTITION_ID FIXED_PARTITION_ID(littlefs_storage)
|
|
FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(fs_storage_data);
|
|
|
|
static struct fs_mount_t fs_storage_mnt = {
|
|
.type = FS_LITTLEFS,
|
|
.fs_data = &fs_storage_data,
|
|
.storage_dev = (void *)STORAGE_PARTITION_ID,
|
|
.mnt_point = "/lfs",
|
|
};
|
|
|
|
int fs_init(void) {
|
|
int rc = fs_mount(&fs_storage_mnt);
|
|
if (rc < 0) {
|
|
LOG_ERR("Error mounting filesystem: %d", rc);
|
|
return rc;
|
|
}
|
|
LOG_DBG("Filesystem mounted successfully");
|
|
return 0;
|
|
}
|