lv_fs.h
API reference for lv_fs.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)| Name | Type | Description |
|---|---|---|
letter | char | the 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)| Name | Type | Description |
|---|---|---|
path | lv_fs_path_ex_t * | pointer to an initialized lv_fs_path_ex data |
buffer | void ** | pointer to a void * variable to store the address |
size | uint32_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)| Name | Type | Description |
|---|---|---|
file_p | lv_fs_file_t * | pointer to a lv_fs_file_t variable |
size_res | uint32_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)| Name | Type | Description |
|---|---|---|
path | const char * | the path of the file |
size_res | uint32_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)| Name | Type | Description |
|---|---|---|
buf | char * | 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)| Name | Type | Description |
|---|---|---|
fn | const 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)| Name | Type | Description |
|---|---|---|
path | const 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.
| Name | Value |
|---|---|
LV_FS_RES_OK | 0 |
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.
| Name | Value |
|---|---|
LV_FS_MODE_WR | 0x01 |
LV_FS_MODE_RD | 0x02 |
Used by 1 function
lv_fs_open— parammode
lv_fs_whence_t
Seek modes.
| Name | Value | Description |
|---|---|---|
LV_FS_SEEK_SET | 0x00 | Set the position from absolutely (from the start of file) |
LV_FS_SEEK_CUR | 0x01 | Set the position from the current position |
LV_FS_SEEK_END | 0x02 | Set the position from the end of the file |
Used by 1 function
lv_fs_seek— paramwhence
Structs
_lv_fs_drv_t
| Member | Type | Description |
|---|---|---|
letter | char | |
cache_size | uint32_t | |
ready_cb | bool(*)(lv_fs_drv_t *drv) | |
remove_cb | void(*)(lv_fs_drv_t *drv) | |
open_cb | void *(*)(lv_fs_drv_t *drv, const char *path, lv_fs_mode_t mode) | |
close_cb | lv_fs_res_t(*)(lv_fs_drv_t *drv, void *file_p) | |
read_cb | lv_fs_res_t(*)(lv_fs_drv_t *drv, void *file_p, void *buf, uint32_t btr, uint32_t *br) | |
write_cb | lv_fs_res_t(*)(lv_fs_drv_t *drv, void *file_p, const void *buf, uint32_t btw, uint32_t *bw) | |
seek_cb | lv_fs_res_t(*)(lv_fs_drv_t *drv, void *file_p, uint32_t pos, lv_fs_whence_t whence) | |
tell_cb | lv_fs_res_t(*)(lv_fs_drv_t *drv, void *file_p, uint32_t *pos_p) | |
dir_open_cb | void *(*)(lv_fs_drv_t *drv, const char *path) | |
dir_read_cb | lv_fs_res_t(*)(lv_fs_drv_t *drv, void *rddir_p, char *fn, uint32_t fn_len) | |
dir_close_cb | lv_fs_res_t(*)(lv_fs_drv_t *drv, void *rddir_p) | |
user_data | void * | Custom file user data |
lv_fs_file_t
| Member | Type | Description |
|---|---|---|
file_d | void * | |
drv | lv_fs_drv_t * | |
cache | lv_fs_file_cache_t * |
Used by 7 functions
lv_fs_open— paramfile_plv_fs_close— paramfile_plv_fs_read— paramfile_plv_fs_write— paramfile_plv_fs_seek— paramfile_plv_fs_tell— paramfile_plv_fs_get_size— paramfile_p
lv_fs_dir_t
| Member | Type | Description |
|---|---|---|
dir_d | void * | |
drv | lv_fs_drv_t * |
Used by 3 functions
lv_fs_dir_open— paramrddir_plv_fs_dir_read— paramrddir_plv_fs_dir_close— paramrddir_p
lv_fs_path_ex_t
Extended path object to specify buffer for memory-mapped files
| Member | Type | Description |
|---|---|---|
path | char[64] | Store the driver letter address and size |
Used by 2 functions
lv_fs_make_path_from_buffer— parampathlv_fs_get_buffer_from_path— parampath
Typedefs
lv_fs_drv_t
typedef struct _lv_fs_drv_t lv_fs_drv_tUsed by 2 functions
lv_fs_drv_init— paramdrvlv_fs_drv_register— paramdrv
Macros
LV_FS_MAX_FN_LENGTH
#define LV_FS_MAX_FN_LENGTH 64LV_FS_MAX_PATH_LENGTH
#define LV_FS_MAX_PATH_LENGTH 256LV_FS_CACHE_FROM_BUFFER
#define LV_FS_CACHE_FROM_BUFFER UINT32_MAXDependencies
How is this guide?
Last updated on