Skip to main content
MMett
Associate III
June 24, 2019
Question

Draw Bitmap with "BSP_LCD_DrawBitmap" on STM32 F7

  • June 24, 2019
  • 2 replies
  • 1863 views

I'm experimenting with the LCD library on the STM32F746G-DISCO board. I wanted to display an image from a BMP file on the display. Unfortunately this never worked. I looked at several examples, and finally noticed that the function

LL_ConvertLineToARGB8888((uint32_t *)pbmp, (uint32_t *)address, width, input_color_mode) 

in the file "stm32746g_discovery_lcd.c" called does not do what it promises.

When I replace this line with :

uint8_t * sourcefile = (uint8_t *)pbmp;
uint8_t * targetlocation = (uint8_t*)(address);
for(uint32_t i = 0; i<width; i++){
 	targetlocation[i*4+0] = sourcefile[i*4+1];
 	targetlocation[i*4+1] = sourcefile[i*4+2];
 	targetlocation[i*4+2] = sourcefile[i*4+3];
 	targetlocation[i*4+3] = sourcefile[i*4+0];
 }

the BMP display works. Only it won't be so efficient, I guess. How do I make the function "LL_ConvertLineToARGB8888" work? I see it works with "hDma2dHandler". Is it possible that I have to initialize something special?

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
June 24, 2019

BMP files come in dozens of formats, with different colour depths, and colour tables.

Some years back I posted several different decoders.

BMP files, from my recollection raster from the bottom up, where as screens raster from the top down. You have to unpack a line at a time, translating from the colour mapping of the line, to that of the display.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
MMett
MMettAuthor
Associate III
June 24, 2019

Thanks for your answer. So you think it's a problem of decoding? I don't suppose the problem is there. I tried to do the same with images from examples online as well as with self-generated ones. The result was always the same. I didn't see anything. Also not in wrong colors, mirror-inverted or the like. I have the impression that the HDMA doesn't do its job. But why don't I know.