lv_fs.h

API reference for lv_fs.h

Report on GitHub
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_fs_private.h

Functions

lv_fs_get_drv

Give a pointer to a driver from its letter

 
lv_fs_drv_t * lv_fs_get_drv(char letter)
Parameters
NameTypeDescription
lettercharthe driver-identifier letter

Returns: lv_fs_drv_t * — pointer to a driver or NULL if not found

lv_fs_get_buffer_from_path

Get the buffer address and size from a path object

 
lv_result_t lv_fs_get_buffer_from_path(lv_fs_path_ex_t *path, void **buffer, uint32_t *size)
Parameters
NameTypeDescription
pathlv_fs_path_ex_t *pointer to an initialized lv_fs_path_ex data
buffervoid **pointer to a void * variable to store the address
sizeuint32_t *pointer to an uint32_t data to store the size

Returns: lv_result_t — LV_RESULT_OK: buffer and size are set; LV_RESULT_INVALID: an error happened.

lv_fs_get_size

Get the size in bytes of an open file. The file read/write position will not be affected.

 
lv_fs_res_t lv_fs_get_size(lv_fs_file_t *file_p, uint32_t *size_res)
Parameters
NameTypeDescription
file_plv_fs_file_t *pointer to a lv_fs_file_t variable
size_resuint32_t *pointer to store the file size

Returns: lv_fs_res_t — LV_FS_RES_OK or any error from lv_fs_res_t

lv_fs_path_get_size

Get the size in bytes of a file at the given path.

 
lv_fs_res_t lv_fs_path_get_size(const char *path, uint32_t *size_res)
Parameters
NameTypeDescription
pathconst char *the path of the file
size_resuint32_t *pointer to store the file size

Returns: lv_fs_res_t — LV_FS_RES_OK or any error from lv_fs_res_t

lv_fs_get_letters

Fill a buffer with the letters of existing drivers

 
char * lv_fs_get_letters(char *buf)
Parameters
NameTypeDescription
bufchar *buffer to store the letters ('\0' added after the last letter)

Returns: char * — the buffer

lv_fs_get_ext

Return with the extension of the filename

 
const char * lv_fs_get_ext(const char *fn)
Parameters
NameTypeDescription
fnconst char *string with a filename

Returns: const char * — pointer to the beginning extension or empty string if no extension

lv_fs_get_last

Get the last element of a path (e.g. U:/folder/file -> file)

 
const char * lv_fs_get_last(const char *path)
Parameters
NameTypeDescription
pathconst char *pointer to a file name

Returns: const char * — pointer to the beginning of the last element in the path

Enums

lv_fs_res_t

Errors in the file system module.

NameValue
LV_FS_RES_OK0
LV_FS_RES_HW_ERR
LV_FS_RES_FS_ERR
LV_FS_RES_NOT_EX
LV_FS_RES_FULL
LV_FS_RES_LOCKED
LV_FS_RES_DENIED
LV_FS_RES_BUSY
LV_FS_RES_TOUT
LV_FS_RES_NOT_IMP
LV_FS_RES_OUT_OF_MEM
LV_FS_RES_INV_PARAM
LV_FS_RES_DRIVE_LETTER_ALREADY_USED
LV_FS_RES_UNKNOWN

lv_fs_mode_t

File open mode.

NameValue
LV_FS_MODE_WR0x01
LV_FS_MODE_RD0x02
Used by 1 function
  • lv_fs_open — param mode

lv_fs_whence_t

Seek modes.

NameValueDescription
LV_FS_SEEK_SET0x00Set the position from absolutely (from the start of file)
LV_FS_SEEK_CUR0x01Set the position from the current position
LV_FS_SEEK_END0x02Set the position from the end of the file
Used by 1 function
  • lv_fs_seek — param whence

Structs

struct

_lv_fs_drv_t

MemberTypeDescription
letterchar
cache_sizeuint32_t
ready_cbbool(*)(lv_fs_drv_t *drv)
remove_cbvoid(*)(lv_fs_drv_t *drv)
open_cbvoid *(*)(lv_fs_drv_t *drv, const char *path, lv_fs_mode_t mode)
close_cblv_fs_res_t(*)(lv_fs_drv_t *drv, void *file_p)
read_cblv_fs_res_t(*)(lv_fs_drv_t *drv, void *file_p, void *buf, uint32_t btr, uint32_t *br)
write_cblv_fs_res_t(*)(lv_fs_drv_t *drv, void *file_p, const void *buf, uint32_t btw, uint32_t *bw)
seek_cblv_fs_res_t(*)(lv_fs_drv_t *drv, void *file_p, uint32_t pos, lv_fs_whence_t whence)
tell_cblv_fs_res_t(*)(lv_fs_drv_t *drv, void *file_p, uint32_t *pos_p)
dir_open_cbvoid *(*)(lv_fs_drv_t *drv, const char *path)
dir_read_cblv_fs_res_t(*)(lv_fs_drv_t *drv, void *rddir_p, char *fn, uint32_t fn_len)
dir_close_cblv_fs_res_t(*)(lv_fs_drv_t *drv, void *rddir_p)
user_datavoid *Custom file user data
struct

lv_fs_file_t

MemberTypeDescription
file_dvoid *
drvlv_fs_drv_t *
cachelv_fs_file_cache_t *
Used by 7 functions
  • lv_fs_open — param file_p
  • lv_fs_close — param file_p
  • lv_fs_read — param file_p
  • lv_fs_write — param file_p
  • lv_fs_seek — param file_p
  • lv_fs_tell — param file_p
  • lv_fs_get_size — param file_p
struct

lv_fs_dir_t

MemberTypeDescription
dir_dvoid *
drvlv_fs_drv_t *
Used by 3 functions
  • lv_fs_dir_open — param rddir_p
  • lv_fs_dir_read — param rddir_p
  • lv_fs_dir_close — param rddir_p
struct

lv_fs_path_ex_t

Extended path object to specify buffer for memory-mapped files

MemberTypeDescription
pathchar[64]Store the driver letter address and size
Used by 2 functions
  • lv_fs_make_path_from_buffer — param path
  • lv_fs_get_buffer_from_path — param path

Typedefs

lv_fs_drv_t

 
typedef struct _lv_fs_drv_t lv_fs_drv_t
Used by 2 functions
  • lv_fs_drv_init — param drv
  • lv_fs_drv_register — param drv

Macros

LV_FS_MAX_FN_LENGTH

 
#define LV_FS_MAX_FN_LENGTH 64

LV_FS_MAX_PATH_LENGTH

 
#define LV_FS_MAX_PATH_LENGTH 256

LV_FS_CACHE_FROM_BUFFER

 
#define LV_FS_CACHE_FROM_BUFFER UINT32_MAX

Dependencies

Indirect dependencies

How is this guide?

Last updated on

On this page