2019-07-20 21:58发布
a458433334 发表于 2016-5-21 16:48 感觉是开窗显示那里的问题
正点原子 发表于 2016-5-21 20:06 仿真跟踪一下,比较容易找问题的
最多设置5个标签!
uint8_t bmpDecode(uint8_t *picname)
{
FIL *bmpFile;
FRESULT status;
//BMPINFOX *pbmptemp;
BMPINFOHEADERX bmpinfoheadx;
BMPFILEHEADERX bmpfileheadx;
uint8_t cnt;
uint8_t bitcount;
uint8_t bittype;
uint8_t *databuff;
uint8_t bmpbuff[3];
uint16_t i,j,k;
printf(" ×¼±¸½âÂëBMPͼƬ");
databuff = (uint8_t *)Malloc(LCD_WIDTH*3);
if(!databuff) return PIC_MEM_ERR;
bmpFile=(FIL *)Malloc(sizeof(FIL));
if(!bmpFile)
{
MemoryFree(databuff);
return PIC_MEM_ERR;
}
printf(" ÄÚ´æ·ÖÅä³É¹¦");
status = f_open(bmpFile,(const TCHAR *)picname,FA_READ|FA_OPEN_EXISTING);
if(status==FR_OK)
{
status = f_read(bmpFile,&bmpfileheadx,sizeof(BMPFILEHEADERX),(UINT *)&cnt);
if(status!=FR_OK) return PIC_READ_ERR;
status = f_read(bmpFile,&bmpinfoheadx,sizeof(BMPINFOHEADERX),(UINT *)&cnt);
if(status!=FR_OK) return PIC_READ_ERR;
bitcount =bmpfileheadx.bfOffBits;
bittype = bmpinfoheadx.biBitCount/8;
BmpInfoX.bmpWidth = bmpinfoheadx.biWidth;
BmpInfoX.bmpHeight = bmpinfoheadx.biHeight;
printf(" Æ«ÒÆÁ¿=%d",bitcount);
printf(" ͼÏñÀàÐÍ=%d",bittype);
printf(" ͼÏñ¸ß¶È=%d",BmpInfoX.bmpHeight);
printf(" ͼÏñ¿í¶È=%d",BmpInfoX.bmpWidth);
if((BmpInfoX.bmpWidth*bittype)%4) BmpInfoX.index = ((BmpInfoX.bmpWidth*bittype)/4+1)*4;
else BmpInfoX.index = BmpInfoX.bmpWidth*bittype;
printf(" ͼÏñʵ¼Ê¿í¶È=%d",BmpInfoX.index);
if(bittype >= 3)
{
printf(" ͼÏñÊÇ24λÕæ²Êͼ");
for(i=0;i<LCD_HEIGHT; i++)
{
if(LCD_WIDTH>BmpInfoX.bmpWidth)
{
printf(" ÆÁÄ»¿í¶È´óÓÚͼƬ¿í¶È");
f_read(bmpFile,databuff,BmpInfoX.index,(UINT *)&cnt);
for(j=cnt;j<LCD_WIDTH*3;j++)
{
databuff[j]=0x00;
}
}
else
{
f_read(bmpFile,databuff,LCD_WIDTH*3,(UINT *)&cnt);
if(LCD_WIDTH*3!=BmpInfoX.index)
{
printf(" ÆÁÄ»¿í¶ÈСÓÚͼƬ¿í¶È");
f_lseek(bmpFile,bitcount+(i+1)*BmpInfoX.index);
}
}
for(k=0;k<LCD_WIDTH;k++)
{
// printf("databuff[k]=0x%02x",databuff[j]);
bmpbuff[2]=databuff[k*3]; //B
bmpbuff[1]=databuff[k*3+1]; //G
bmpbuff[0]=databuff[k*3+2]; //R
LCDFastDrawPoint(k,i,bmpbuff);
//printf(" k=%d",k);
}
//printf(" i=%d",i);
}
f_close(bmpFile);
}
}
else
return PIC_OPEN_ERR;
MemoryFree((uint32_t *)databuff);
MemoryFree(bmpFile);
return 0;
}
void LCDFastDrawPoint(uint16_t x,uint16_t y,uint8_t *data)
{
SetWindow(x,y,1,1);
Zebra_SPI_RegWR(0x2C);
SPI_Prepare();
Zebra_SPI_RGBWR(data[0]);
Zebra_SPI_RGBWR(data[1]);
Zebra_SPI_RGBWR(data[2]);
// SetWindow(0,0,320,240);
}
[/mw_shl_code]
是指setwindow(x,y,1,1)这里吗?
应该不会,我用这个函数测试了画点 划线画圈
不太明白跟踪哪些变量耶。我昨天试着用img2lcd这个小软件将图片转换成数组,同时程序里面也串口打印显示的每个数据。。实在是太多了,不知道怎么做Debug
一周热门 更多>