当使用外部资源作为图像源的时候, pcfs_drv.letter = 'P';为什么这个要为字符P呢。
在源码里面看见如下:
lv_img_src_get_type()中有:
/*The first byte shows the type of the image source*/
if(u8_p[0] >= 0x20 && u8_p[0] <= 0x7F) {
img_src_type = LV_IMG_SRC_FILE; /*If it's an ASCII character then it's file name*/
} else if(u8_p[0] >= 0x80) {
img_src_type = LV_IMG_SRC_SYMBOL; /*Symbols begins after 0x7F*/
} else {
img_src_type = LV_IMG_SRC_VARIABLE; /*`lv_img_dsc_t` is design to the first byte < 0x20*/
}
那么 pcfs_drv.letter = 'P';这个字符P是不是可以为0x20到0x7E的任意ASCILL码呢?
pcfs_drv.file_size = sizeof(pc_file_t); /*Set up fields...*/
pcfs_drv.letter = 'P';
pcfs_drv.open = pcfs_open;
pcfs_drv.close = pcfs_close;
pcfs_drv.read = pcfs_read;
pcfs_drv.seek = pcfs_seek;
pcfs_drv.tell = pcfs_tell;
lv_fs_add_drv(&pcfs_drv);
lv_obj_t * img_bin = lv_img_create(lv_scr_act(), NULL); /*Create an image object*/
/* Set the image's file according to the current color depth
* a blue flower picture*/
#if LV_COLOR_DEPTH == 32
lv_img_set_src(img_bin, "P:/lv_examples/lv_tutorial/6_images/blue_flower_32.bin");
离线
解决了,应该是一个类似设备描述符的
离线