LVGL8.2 ,单独的文件系统读写都没有问题(测试函数:函数内部,测试之前,挂载,测试之后,卸载),但是从外部SD卡读取png图片就会进入hardfault。用的是lv_fs_fatfs.c的库函数。
读取SD卡的挂载是在:fs_init()函数中挂载了一次。
请教下:文件系统的挂载,使用之后,是必须卸载吗?如果不卸载会有什么问题呢?
void lv_fs_fatfs_init(void)
{
/----------------------------------------------------
* Initialize your storage device and File System
* -------------------------------------------------/
fs_init();
/*---------------------------------------------------
* Register the file system interface in LVGL
*--------------------------------------------------*/
/*Add a simple drive to open images*/
static lv_fs_drv_t fs_drv; /*A driver descriptor*/
lv_fs_drv_init(&fs_drv);
/*Set up fields...*/
fs_drv.letter = LV_FS_FATFS_LETTER;
fs_drv.cache_size = LV_FS_FATFS_CACHE_SIZE;
fs_drv.open_cb = fs_open;
fs_drv.close_cb = fs_close;
fs_drv.read_cb = fs_read;
fs_drv.write_cb = fs_write;
fs_drv.seek_cb = fs_seek;
fs_drv.tell_cb = fs_tell;
fs_drv.dir_close_cb = fs_dir_close;
fs_drv.dir_open_cb = fs_dir_open;
fs_drv.dir_read_cb = fs_dir_read;
lv_fs_drv_register(&fs_drv);
}
static void fs_init(void)
{
FRESULT result;
result = f_mount(&fatfs_sd, (const TCHAR*)LV_FS_FATFS_LETTER ,0);
if (result != FR_OK)
{
printf("SD Card mounted error. (%d)\n", result );
while(1);
}
else
{
printf("SD Card mounted successfully.\n\n");
}
}