|
5#
楼主 |
发表于 2023-12-25 10:05:44
|
只看该作者
本帖最后由 KarryingLiu 于 2023-12-25 10:24 编辑
还是不明白:
1、SPI里的bin文件读到SDRAM不还是bin文件吗?内存读取的话也是直接读取bin文吧?
2、转化成数组的话是不是需要找一个bin2c.c文件呢?转出来的数组又存到哪里呢?
我这里有一串代码,我用它来读取工具“True color with alpha Binary RGB888” 输出的bin格式文件,但是读取不出来
- void loadBitmap(lv_img_dsc_t *image, uint32_t start_addr, uint32_t file_size)
- {
- uint8_t *pbuf; //读取数据缓冲区
- uint8_t *pbmp;
- uint32_t header;
- int secTime = file_size/4096;
- int secOff = file_size%4096;
- int i;
- dbg_printf(" secTime = %d, secOff = %d\r\n", secTime, secOff);
- pbuf = lv_mem_alloc(file_size);
- for (i=0; i<secTime; i++) {
- SPI_Flash_Read(&pbuf[i*4096], start_addr+i*4096, 4096);
- }
- if (secOff>0) {
- SPI_Flash_Read(&pbuf[secTime*4096], start_addr+secTime*4096, secOff);
- }
- /* 获取图片数据流 */
- pbmp = (uint8_t *)pbuf + 4;
- /* 获取头 */
- header = (uint32_t)pbuf[3] << 24;
- header |= (uint32_t)pbuf[2] << 16;
- header |= (uint32_t)pbuf[1] << 8;
- header |= (uint32_t)pbuf[0];
- image->header.cf = pbuf[0];
- image->header.always_zero = 0;
- image->header.w = (uint16_t)(header >> 10);
- image->header.h = (uint16_t)(header >> 21);
- image->data_size = file_size - 4;
- image->data = pbmp;
- }
复制代码 出自薛定谔是我的CAT:LVGL加载外部flash上图片
|
|