Question
BMP reading stop in the loop ?
Dear Members,
I have question related with BMP reading from SDcard then display to LCD ?
It stopped in one file,
Is it related with internal SRAM of my STM32F103, and I'm running out of internal SRAM memory,
I read some bmp files, and freeze.
Regards,
Code :
//Function reading 256 file
void LCD_BMP_reading_256(char filename[120])
{
char temp_buffer[100],line[512];
int count,z,bmpData,bmpAddr;
int x = 0;
int i,y = 0;
int xx, yy;
uint8_t hdr[0x28];
UINT bytesread;
uint8_t hdr_256[0x36];
static uint16_t w[256];
uint32_t off;
delay_ms(1500);
res = f_open(&fsrc, filename, FA_READ);
f_read(&fsrc, hdr_256, sizeof(hdr_256), &bytesread); // Read header
off = *((uint32_t *)&hdr_256[0x0A]); // offset to rasters
xx = *((uint32_t *)&hdr_256[0x12]); // X pixels
yy = *((uint32_t *)&hdr_256[0x16]); // Y pixels
for(i=0; i<256; i++) // Build palette conversion (+0x46 count?)
{
uint32_t pal;
f_read(&fsrc, &pal, 4, &bytesread); // Read palette B G R
// RRRRRRRRGGGGGGGGBBBBBBBB 8:8:8
// BBBBBGGGGGGRRRRR 5:6:5
//pal = ((pal & 0x00FC00) >> 5) | ((pal & 0xF80000) >> 19) | ((pal & 0x0000F8) << 8);
pal = ((pal & 0xF80000) >> 8) | ((pal & 0x00FC00) >> 5) | ((pal & 0x0000F8) >> 3);
//pal = ((pal & 0x1F0000) >> 8) | ((pal & 0x007E00) >> 5) | ((pal & 0x0000F8) >> 3);
w[i] = (uint16_t)pal;
}
f_lseek(&fsrc, off); // Seek to the data
for(y=0; y<yy; y++)
{
for(x=0; x<xx; x++)
{
uint8_t b;
f_read(&fsrc, &b, 1, &bytesread); // Read byte
LCD_SetPoint(y, x, w[b]); // Colour Map
} // x
} // y
f_close(&fsrc);
}I repeated that function many times in main()
