#include <stdint.h>
#include "littlefs/flash_driver.h"
#include "littlefs/lfs.h"
Go to the source code of this file.
|
#define | LFS_MAX_PATH_LENGTH 250 |
| The maximum path length supported by CTS-SAT-1, including the null terminator.
|
|
|
int8_t | LFS_format () |
| Formats Memory Module so it can successfully mount LittleFS.
|
|
int8_t | LFS_mount () |
| Mounts LittleFS to the Memory Module.
|
|
int8_t | LFS_unmount () |
| Unmounts LittleFS to the Memory Module.
|
|
int8_t | LFS_ensure_mounted () |
| Mounts LFS filesystem if not already mounted. Does nothing if LFS is already mounted.
|
|
int8_t | LFS_ensure_unmounted () |
| Mounts LFS filesystem if not already mounted. Does nothing if LFS is already mounted.
|
|
int8_t | LFS_list_directory (const char root_directory[], uint16_t offset, int16_t count) |
| Lists contents of LittleFS Directory, where each entry is sent as a log message.
|
|
int8_t | LFS_make_directory (const char dir_name[]) |
| Creates directory.
|
|
int8_t | LFS_delete_file (const char file_name[]) |
| Removes / deletes the file specified.
|
|
int8_t | LFS_write_file (const char file_name[], uint8_t *write_buffer, uint32_t write_buffer_len) |
| Creates/Opens LittleFS File to write to the Memory Module.
|
|
int8_t | LFS_write_file_with_offset (const char file_name[], lfs_soff_t offset, uint8_t *write_buffer, uint32_t write_buffer_len) |
| Creates / Opens LittleFS File and writes data at a specific offset.
|
|
int8_t | LFS_append_file (const char file_name[], uint8_t *write_buffer, uint32_t write_buffer_len) |
| Creates/Opens LittleFS File to append contents.
|
|
lfs_ssize_t | LFS_read_file (const char file_name[], lfs_soff_t offset, uint8_t *read_buffer, uint32_t read_buffer_size) |
| Opens LittleFS File to read from the Memory Module.
|
|
lfs_ssize_t | LFS_file_size (const char file_name[]) |
| Returns the file size.
|
|
◆ LFS_MAX_PATH_LENGTH
#define LFS_MAX_PATH_LENGTH 250 |
The maximum path length supported by CTS-SAT-1, including the null terminator.
- Note
- LittleFS supports up to 255 bytes by default, but we'll restrict a bit under.
◆ LFS_append_file()
int8_t LFS_append_file |
( |
const char | file_name[], |
|
|
uint8_t * | write_buffer, |
|
|
uint32_t | write_buffer_len ) |
Creates/Opens LittleFS File to append contents.
- Parameters
-
file_name | - Pointer to cstring holding the file name to create or open |
write_buffer | - Pointer to buffer holding the data to write |
write_buffer_len | - Size of the data to write |
- Returns
- 0 on success, 1 if LFS is unmounted, negative LFS error codes on failure
◆ LFS_delete_file()
int8_t LFS_delete_file |
( |
const char | file_name[] | ) |
|
Removes / deletes the file specified.
- Parameters
-
file_name | Pointer to cstring holding the file name to remove |
- Returns
- 0 on success, 1 if LFS is unmounted, negative LFS error codes on failure
◆ LFS_ensure_mounted()
int8_t LFS_ensure_mounted |
( |
| ) |
|
Mounts LFS filesystem if not already mounted. Does nothing if LFS is already mounted.
◆ LFS_ensure_unmounted()
int8_t LFS_ensure_unmounted |
( |
| ) |
|
Mounts LFS filesystem if not already mounted. Does nothing if LFS is already mounted.
◆ LFS_file_size()
Returns the file size.
- Parameters
-
file_name | - Pointer to buffer holding the file name to open |
- Returns
- Returns negative values if read or file open failed, else the number of bytes in the file
◆ LFS_format()
Formats Memory Module so it can successfully mount LittleFS.
- Parameters
-
- Returns
- 0 on success, 1 if LFS is already mounted, negative LFS error codes on failure
◆ LFS_list_directory()
int8_t LFS_list_directory |
( |
const char | root_directory[], |
|
|
uint16_t | offset, |
|
|
int16_t | count ) |
Lists contents of LittleFS Directory, where each entry is sent as a log message.
- Parameters
-
root_directory | cstring holding the root directory to open and read |
offset | Number of entries to skip before listing directory |
count | Number of entries to list in total (if 0, prints all entries) |
- Returns
- 0 on success, 1 if LFS is unmounted, negative LFS error codes on failure
◆ LFS_make_directory()
int8_t LFS_make_directory |
( |
const char | dir_name[] | ) |
|
Creates directory.
- Parameters
-
dir_name | Pointer to cstring holding the name of the directory |
- Returns
- 0 on success, 1 if LFS is unmounted, negative LFS error codes on failure
◆ LFS_mount()
Mounts LittleFS to the Memory Module.
- Parameters
-
- Returns
- 0 on success, 1 if LFS is already mounted, negative LFS error codes on failure
◆ LFS_read_file()
lfs_ssize_t LFS_read_file |
( |
const char | file_name[], |
|
|
lfs_soff_t | offset, |
|
|
uint8_t * | read_buffer, |
|
|
uint32_t | read_buffer_size ) |
Opens LittleFS File to read from the Memory Module.
- Parameters
-
file_name | - Pointer to buffer holding the file name to open |
offset | - position within the file to read from |
read_buffer | - Pointer to buffer where the read data will be stored |
read_buffer_size | - Size of the data to read |
- Returns
- Returns negative values if read or file open failed, else the number of bytes read.
◆ LFS_unmount()
Unmounts LittleFS to the Memory Module.
- Parameters
-
- Returns
- 0 on success, 1 if LFS is already unmounted, negative LFS error codes on failure
◆ LFS_write_file()
int8_t LFS_write_file |
( |
const char | file_name[], |
|
|
uint8_t * | write_buffer, |
|
|
uint32_t | write_buffer_len ) |
Creates/Opens LittleFS File to write to the Memory Module.
- Parameters
-
file_name | - Pointer to cstring holding the file name to create or open |
write_buffer | - Pointer to buffer holding the data to write |
write_buffer_len | - Size of the data to write |
- Returns
- 0 on success, 1 if LFS is unmounted, negative LFS error codes on failure
◆ LFS_write_file_with_offset()
int8_t LFS_write_file_with_offset |
( |
const char | file_name[], |
|
|
lfs_soff_t | offset, |
|
|
uint8_t * | write_buffer, |
|
|
uint32_t | write_buffer_len ) |
Creates / Opens LittleFS File and writes data at a specific offset.
- Parameters
-
file_name | - Pointer to cstring holding the file name to create or open |
offset | - Position within the file to write the data |
write_buffer | - Pointer to buffer holding the data to write |
write_buffer_len | - Size of the data to write |
- Return values
-
0 | on success, 1 if LFS is unmounted, negative LFS error codes on failure |
◆ LFS_cfg
◆ LFS_file_cfg
◆ LFS_filesystem
◆ LFS_is_lfs_mounted
uint8_t LFS_is_lfs_mounted |
|
extern |