fix conflicts
This commit is contained in:
@@ -51,9 +51,9 @@ extern lv_font_t font_3;
|
||||
void lv_test_font_loader(void)
|
||||
{
|
||||
#if LV_USE_FILESYSTEM
|
||||
lv_font_t * font_1_bin = lv_font_load("f:font_1.fnt");
|
||||
lv_font_t * font_2_bin = lv_font_load("f:font_2.fnt");
|
||||
lv_font_t * font_3_bin = lv_font_load("f:font_3.fnt");
|
||||
lv_font_t * font_1_bin = lv_font_load("F:font_1.fnt");
|
||||
lv_font_t * font_2_bin = lv_font_load("F:font_2.fnt");
|
||||
lv_font_t * font_3_bin = lv_font_load("F:font_3.fnt");
|
||||
|
||||
compare_fonts(&font_1, font_1_bin);
|
||||
compare_fonts(&font_2, font_2_bin);
|
||||
|
||||
@@ -28,23 +28,21 @@ int main(void)
|
||||
|
||||
|
||||
#if LV_USE_FILESYSTEM
|
||||
static lv_fs_res_t open_cb(struct _lv_fs_drv_t * drv, void * file_p, const char * path, lv_fs_mode_t mode)
|
||||
static void * open_cb(struct _lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode)
|
||||
{
|
||||
(void) drv;
|
||||
(void) mode;
|
||||
|
||||
FILE * fp = fopen(path, "rb"); // only reading is supported
|
||||
|
||||
*((FILE **)file_p) = fp;
|
||||
return NULL == fp ? LV_FS_RES_UNKNOWN : LV_FS_RES_OK;
|
||||
return fp;
|
||||
}
|
||||
|
||||
static lv_fs_res_t close_cb(struct _lv_fs_drv_t * drv, void * file_p)
|
||||
{
|
||||
(void) drv;
|
||||
|
||||
FILE * fp = *((FILE **) file_p);
|
||||
fclose(fp);
|
||||
fclose(file_p);
|
||||
return LV_FS_RES_OK;
|
||||
}
|
||||
|
||||
@@ -52,17 +50,30 @@ static lv_fs_res_t read_cb(struct _lv_fs_drv_t * drv, void * file_p, void * buf,
|
||||
{
|
||||
(void) drv;
|
||||
|
||||
FILE * fp = *((FILE **) file_p);
|
||||
*br = fread(buf, 1, btr, fp);
|
||||
*br = fread(buf, 1, btr, file_p);
|
||||
return (*br <= 0) ? LV_FS_RES_UNKNOWN : LV_FS_RES_OK;
|
||||
}
|
||||
|
||||
static lv_fs_res_t seek_cb(struct _lv_fs_drv_t * drv, void * file_p, uint32_t pos)
|
||||
static lv_fs_res_t seek_cb(struct _lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t w)
|
||||
{
|
||||
(void) drv;
|
||||
|
||||
FILE * fp = *((FILE **) file_p);
|
||||
fseek (fp, pos, SEEK_SET);
|
||||
uint32_t w2;
|
||||
switch(w) {
|
||||
case LV_FS_SEEK_SET:
|
||||
w2 = SEEK_SET;
|
||||
break;
|
||||
case LV_FS_SEEK_CUR:
|
||||
w2 = SEEK_CUR;
|
||||
break;
|
||||
case LV_FS_SEEK_END:
|
||||
w2 = SEEK_END;
|
||||
break;
|
||||
default:
|
||||
w2 = SEEK_SET;
|
||||
}
|
||||
|
||||
fseek (file_p, pos, w2);
|
||||
|
||||
return LV_FS_RES_OK;
|
||||
}
|
||||
@@ -71,17 +82,11 @@ static lv_fs_res_t tell_cb(struct _lv_fs_drv_t * drv, void * file_p, uint32_t *
|
||||
{
|
||||
(void) drv;
|
||||
|
||||
FILE * fp = *((FILE **) file_p);
|
||||
*pos_p = ftell(fp);
|
||||
*pos_p = ftell(file_p);
|
||||
|
||||
return LV_FS_RES_OK;
|
||||
}
|
||||
|
||||
static bool ready_cb(struct _lv_fs_drv_t * drv)
|
||||
{
|
||||
(void) drv;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void hal_init(void)
|
||||
@@ -101,9 +106,7 @@ static void hal_init(void)
|
||||
lv_fs_drv_t drv;
|
||||
lv_fs_drv_init(&drv); /*Basic initialization*/
|
||||
|
||||
drv.letter = 'f'; /*An uppercase letter to identify the drive */
|
||||
drv.file_size = sizeof(FILE *); /*Size required to store a file object*/
|
||||
drv.ready_cb = ready_cb; /*Callback to tell if the drive is ready to use */
|
||||
drv.letter = 'F'; /*An uppercase letter to identify the drive */
|
||||
drv.open_cb = open_cb; /*Callback to open a file */
|
||||
drv.close_cb = close_cb; /*Callback to close a file */
|
||||
drv.read_cb = read_cb; /*Callback to read a file */
|
||||
|
||||
Reference in New Issue
Block a user