2019-03-07 12:47 AM
Hello,
I just had a look at the lcd module of the bsp for the stm32f746g disco board. It seems to support ARGB8888 and RGB565 pixel formats for framebuffer. Color code for draw actions is always rgb8888. When drawing a line and framebuffer has rgb565 format, the argb8888 color code is converted to rgb565 by dma2d during transfer. But when the cpu draws pixels, the color code isn't converted. There is just a cast from the 32bits of argb8888 to 16bits of rgb565. Seems there is missing a manual conversion???
/**
* @brief Draws a pixel on LCD.
* @param Xpos: X position
* @param Ypos: Y position
* @param RGB_Code: Pixel color in ARGB mode (8-8-8-8)
* @retval None
*/
void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t RGB_Code)
{
/* Write data value to all SDRAM memory */
if(hLtdcHandler.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565)
{ /* RGB565 format */
*(__IO uint16_t*) (hLtdcHandler.LayerCfg[ActiveLayer].FBStartAdress + (2*(Ypos*BSP_LCD_GetXSize() + Xpos))) = (uint16_t)RGB_Code;
}
else
{ /* ARGB8888 format */
*(__IO uint32_t*) (hLtdcHandler.LayerCfg[ActiveLayer].FBStartAdress + (4*(Ypos*BSP_LCD_GetXSize() + Xpos))) = RGB_Code;
}
}
Thanks Marc