michael_llh 发表于 2015-3-14 23:02
恩,互帮互助哈!
你有用过STM32显示BMP图片没?
使用STM32的例程,可以显示图片,把图片换成其它BMP图片,修改Lcd_show_bmp(0, 0,"/tupian.bmp");,并把图片放到SD卡,液晶不能显示图片,那么图片的路径是如何设置的?
void Lcd_show_bmp(unsigned short int x, unsigned short int y,unsigned char *pic_name)
{
int i, j, k;
int width, height, l_width;
BYTE red,green,blue;
BITMAPFILEHEADER bitHead;
BITMAPINFOHEADER bitInfoHead;
WORD fileType;
unsigned int read_num;
unsigned char tmp_name[20];
sprintf((char*)tmp_name,"0:%s",pic_name);
f_mount(0, &bmpfs[0]);
BMP_DEBUG_PRINTF("file mount ok \r\n");
bmpres = f_open( &bmpfsrc , (char *)tmp_name, FA_OPEN_EXISTING | FA_READ);
if(bmpres == FR_OK)
{
BMP_DEBUG_PRINTF("Open file success\r\n");
f_read(&bmpfsrc,&fileType,sizeof(WORD),&read_num);
if(fileType != 0x4d42)
{
BMP_DEBUG_PRINTF("file is not .bmp file!\r\n");
return;
}
else
{
BMP_DEBUG_PRINTF("Ok this is .bmp file\r\n");
}
f_read(&bmpfsrc,&bitHead,sizeof(tagBITMAPFILEHEADER),&read_num);
showBmpHead(&bitHead);
f_read(&bmpfsrc,&bitInfoHead,sizeof(BITMAPINFOHEADER),&read_num);
showBmpInforHead(&bitInfoHead);
}
else
{
BMP_DEBUG_PRINTF("file open fail!\r\n");
return;
}
width = bitInfoHead.biWidth;
height = bitInfoHead.biHeight;
l_width = WIDTHBYTES(width* bitInfoHead.biBitCount);
if(l_width > 960)
{
BMP_DEBUG_PRINTF("\n SORRY, PIC IS TOO BIG (