add user data to lv_fs_drv_t

This commit is contained in:
Gabor Kiss-Vamosi
2019-06-16 09:48:41 +02:00
parent 760359fd5a
commit 51878e65dc
4 changed files with 21 additions and 2 deletions

View File

@@ -143,6 +143,10 @@ typedef void * lv_group_user_data_t;
/* 1: Enable file system (might be required for images */
#define LV_USE_FILESYSTEM 1
#if LV_USE_FILESYSTEM
/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_fs_drv_user_data_t;
#endif
/* 1: Enable indexed (palette) images */
#define LV_IMG_CF_INDEXED 1

View File

@@ -197,6 +197,9 @@
#ifndef LV_USE_FILESYSTEM
#define LV_USE_FILESYSTEM 1
#endif
#if LV_USE_FILESYSTEM
/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
#endif
/* 1: Enable indexed (palette) images */
#ifndef LV_IMG_CF_INDEXED

View File

@@ -469,7 +469,7 @@ lv_fs_res_t lv_fs_free_space(char letter, uint32_t * total_p, uint32_t * free_p)
* @param drv_p pointer to an lv_fs_drv_t structure which is inited with the
* corresponding function pointers. The data will be copied so the variable can be local.
*/
void lv_fs_add_drv(lv_fs_drv_t * drv_p)
void lv_fs_drv_register(lv_fs_drv_t * drv_p)
{
/*Save the new driver*/
lv_fs_drv_t * new_drv;

View File

@@ -78,6 +78,10 @@ typedef struct _lv_fs_drv_t
lv_fs_res_t (*dir_open)(struct _lv_fs_drv_t * drv, void * rddir_p, const char * path);
lv_fs_res_t (*dir_read)(struct _lv_fs_drv_t * drv, void * rddir_p, char * fn);
lv_fs_res_t (*dir_close)(struct _lv_fs_drv_t * drv, void * rddir_p);
#if LV_USE_USER_DATA
lv_fs_drv_user_data_t user_data;
#endif
} lv_fs_drv_t;
typedef struct
@@ -101,12 +105,20 @@ typedef struct
*/
void lv_fs_init(void);
/**
* Initialize a file system driver with default values.
* It is used to surly have known values in the fields ant not memory junk.
* After it you can set the fields.
* @param drv pointer to driver variable to initialize
*/
void lv_fs_drv_init(lv_fs_drv_t * drv);
/**
* Add a new drive
* @param drv_p pointer to an lv_fs_drv_t structure which is inited with the
* corresponding function pointers. The data will be copied so the variable can be local.
*/
void lv_fs_add_drv(lv_fs_drv_t * drv_p);
void lv_fs_drv_register(lv_fs_drv_t * drv_p);
/**
* Test if a drive is rady or not. If the `ready` function was not initialized `true` will be