打印
[STM32F4]

429开发板双层显示屏幕闪烁问题

[复制链接]
1731|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
lg75|  楼主 | 2018-3-21 07:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
使用野火的429开发板,实测《21-LTDC—液晶显示汉字(显示任意大小)》的例程,发现双层显示使用的都是ARGB1555格式,如果都换成RGB565,或者一层是ARGB15555另外一层使用RGB565,则屏幕都会闪烁。

求解,谢谢!


void LCD_LayerInit(void)
{
LTDC_Layer_InitTypeDef LTDC_Layer_InitStruct;

  /* 层窗口配置 */
  /* 配置本层的窗口边界,注意这些参数是包含HBP HSW VBP VSW的 */   
        //一行的第一个起始像素,该成员值应用为 (LTDC_InitStruct.LTDC_AccumulatedHBP+1)的值
        LTDC_Layer_InitStruct.LTDC_HorizontalStart = HBP + HSW;
        //一行的最后一个像素,该成员值应用为 (LTDC_InitStruct.LTDC_AccumulatedActiveW)的值
        LTDC_Layer_InitStruct.LTDC_HorizontalStop = HSW+HBP+LCD_PIXEL_WIDTH-1;
        //一列的第一个起始像素,该成员值应用为 (LTDC_InitStruct.LTDC_AccumulatedVBP+1)的值
        LTDC_Layer_InitStruct.LTDC_VerticalStart =  VBP + VSW;
        //一列的最后一个像素,该成员值应用为 (LTDC_InitStruct.LTDC_AccumulatedActiveH)的值
        LTDC_Layer_InitStruct.LTDC_VerticalStop = VSW+VBP+LCD_PIXEL_HEIGHT-1;

/* Pixel Format configuration*/
LTDC_Layer_InitStruct.LTDC_PixelFormat = LTDC_Pixelformat_RGB565;
/* Alpha constant (255 totally opaque) */
LTDC_Layer_InitStruct.LTDC_ConstantAlpha = 255;
/* Default Color configuration (configure A,R,G,B component values) */
LTDC_Layer_InitStruct.LTDC_DefaultColorBlue = 0;
LTDC_Layer_InitStruct.LTDC_DefaultColorGreen = 0;
LTDC_Layer_InitStruct.LTDC_DefaultColorRed = 0;
LTDC_Layer_InitStruct.LTDC_DefaultColorAlpha = 0;
/* Configure blending factors */
LTDC_Layer_InitStruct.LTDC_BlendingFactor_1 = LTDC_BlendingFactor1_CA;
LTDC_Layer_InitStruct.LTDC_BlendingFactor_2 = LTDC_BlendingFactor2_CA;

/* the length of one line of pixels in bytes + 3 then :
Line Lenth = Active high width x number of bytes per pixel + 3
Active high width         = LCD_PIXEL_WIDTH
number of bytes per pixel = 2    (pixel_format : RGB565)
*/
LTDC_Layer_InitStruct.LTDC_CFBLineLength = ((LCD_PIXEL_WIDTH * 2) + 3);
/* the pitch is the increment from the start of one line of pixels to the
start of the next line in bytes, then :
Pitch = Active high width x number of bytes per pixel */
LTDC_Layer_InitStruct.LTDC_CFBPitch = (LCD_PIXEL_WIDTH * 2);

/* Configure the number of lines */
LTDC_Layer_InitStruct.LTDC_CFBLineNumber = LCD_PIXEL_HEIGHT;

/* Start Address configuration : the LCD Frame buffer is defined on SDRAM */
LTDC_Layer_InitStruct.LTDC_CFBStartAdress = LCD_FRAME_BUFFER;

/* Initialize LTDC layer 1 */
LTDC_LayerInit(LTDC_Layer1, <DC_Layer_InitStruct);

  /* Configure Layer2 */
/* Pixel Format configuration*/
LTDC_Layer_InitStruct.LTDC_PixelFormat = LTDC_Pixelformat_ARGB1555;

  /* Start Address configuration : the LCD Frame buffer is defined on SDRAM w/ Offset */
LTDC_Layer_InitStruct.LTDC_CFBStartAdress = LCD_FRAME_BUFFER + BUFFER_OFFSET;

  /* Configure blending factors */
LTDC_Layer_InitStruct.LTDC_BlendingFactor_1 = LTDC_BlendingFactor1_PAxCA;
LTDC_Layer_InitStruct.LTDC_BlendingFactor_2 = LTDC_BlendingFactor2_PAxCA;

  /* Initialize LTDC layer 2 */
LTDC_LayerInit(LTDC_Layer2, <DC_Layer_InitStruct);

  /* LTDC configuration reload */
LTDC_ReloadConfig(LTDC_IMReload);

  /* Enable foreground & background Layers */
LTDC_LayerCmd(LTDC_Layer1, ENABLE);
LTDC_LayerCmd(LTDC_Layer2, ENABLE);

  /* LTDC configuration reload */
LTDC_ReloadConfig(LTDC_IMReload);

  /* Set default font */
LCD_SetFont(&LCD_DEFAULT_FONT);

  /* dithering activation */
LTDC_DitherCmd(ENABLE);
}
沙发
zhuomuniao110| | 2018-3-21 09:05 | 只看该作者
不是很懂这个格式,只是说是软字幕。

使用特权

评论回复
板凳
小灵通2018| | 2018-3-21 10:22 | 只看该作者
应该是不兼容。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

60

主题

205

帖子

2

粉丝