2014-04-14 01:18 AM
Guys,
Does anyone of you know on how to display array of bitmap to TFT LCD ? I tried :
void LCD_DrawBMPFromFile()
{
char temp_buffer[100],line[512];
int count,bmpData,bmpAddr;
const int icon[220] =
{
0x42,0x4D,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x0A,
0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
0x80,0x00,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0xC0,0xC0,0xC0,0x00,0x00,0x00,0xFF,0x00,0x00,
0xFF,0x00,0x00,0x00,0xFF,0xFF,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,0xFF,0xFF,0x00,0x00,
0xFF,0xFF,0xFF,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x99,0x99,0x99,0x9F,0xFF,0x00,0x00,0x00,0x99,0x99,
0x99,0x9F,0xFF,0x00,0x00,0x00,0x99,0x99,0x99,0x9F,0xFF,0x00,0x00,0x00,0x99,0x99,0x99,0x9F,0xFF,
0x00,0x00,0x00,0x99,0x99,0x99,0x9F,0xFF,0x00,0x00,0x00,0x99,0x99,0x99,0x9F,0xFF,0x00,0x00,0x00,
0x99,0x99,0x99,0x9F,0xFF,0x00,0x00,0x00};
//write LCD RAM here
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
LCD_Clear(Yellow);
for (bmpAddr; bmpAddr < 100; bmpAddr += 2)
{
bmpData = (uint16_t)(*(icon + bmpAddr)) + (uint16_t)((*(icon + bmpAddr + 1)) << 8);
LCD_WriteRAM( bmpData );
}
__inline void LCD_WriteRAM(uint16_t RGB_Code)
{
/* Write 16-bit GRAM Reg */
LCD_RAM = RGB_Code;
}
but got no response, any clues ? thanks
2014-04-14 06:19 AM
You need to review the documentation available on BMP files.
This file uses a 4-bit colour depth, ahead of the bitmap data is a 16 entry palette table describing the colours used in the icon, after than is the line data packed two pixels per byte. You will need to take the palette data, and use that as you decode the pixel data, and translate that into the RGB format (or whatever) data the display is taking. You will need to process the image one line at a time, advancing to the next line on the display for each short line of data you have for the icon. Repeat for at the lines in the icon.2014-04-14 05:23 PM
any examples ?
I used this function and got stripe on LCD, thanks
void LCD_DrawPicture(uint16_t StartX,uint16_t StartY,uint16_t EndX,uint16_t EndY,uint16_t *pic)
{
uint16_t i;
LCD_SetCursor(StartX,StartY);
LCD_WriteRAM_Prepare();
for (i=0;i<(EndX*EndY);i++)
{
LCD_WriteRAM(*pic++);
}
}
================
uint16_t icon[220] =
{
0x42,0x4D,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x0A,
0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
0x80,0x00,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0xC0,0xC0,0xC0,0x00,0x00,0x00,0xFF,0x00,0x00,
0xFF,0x00,0x00,0x00,0xFF,0xFF,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,0xFF,0xFF,0x00,0x00,
0xFF,0xFF,0xFF,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x99,0x99,0x99,0x9F,0xFF,0x00,0x00,0x00,0x99,0x99,
0x99,0x9F,0xFF,0x00,0x00,0x00,0x99,0x99,0x99,0x9F,0xFF,0x00,0x00,0x00,0x99,0x99,0x99,0x9F,0xFF,
0x00,0x00,0x00,0x99,0x99,0x99,0x9F,0xFF,0x00,0x00,0x00,0x99,0x99,0x99,0x9F,0xFF,0x00,0x00,0x00,
0x99,0x99,0x99,0x9F,0xFF,0x00,0x00,0x00};
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
LCD_Clear(Yellow);
LCD_SetCursor(0,319);
LCD_DrawPicture(0,0,320,240,icon);
2014-04-14 09:54 PM
this is the result for the code
2016-08-03 08:16 AM
2016-08-03 09:29 AM
i'm having Driver Power State Failure
May be you can formulate that into some kind of question with some context, and in a new thread. That would be great..