|
平台 STM32F429 168MHZ, 外部16bit SDRAM
触摸 IIC,有触摸按下后,10ms 中断中发事件标志,在任务中读取。
屏 720*720 RGB565
GUI :STemwin 5.44
界面 主要是 图片,透明像素用得特别多。
目前的表现是:
每次触摸按下后,GUI线程阻塞。导致触摸任务不能及时正常读取。从而导致可能丢失触摸动作。
最长的阻塞0.5S左右。
1.个人感觉应该是DMA2D中等待传输结束 卡住了。。但是不明白的是 GUI的任务优先级是最低的。一旦高优先级的任务就绪,应该会发生跳转才对。
/* Wait until transfer is done */
while (DMA2D->CR & DMA2D_CR_START)
{
}
2. GUI中 没有画点,和画线的函数,是否STemwin 在库中间已经做了优化。
3. static void DMA2D_CopyBuffer(U32 LayerIndex, void * pSrc, void * pDst, U32 xSize, U32 ySize, U32 OffLineSrc, U32 OffLineDst)
这个函数应该使用率是很高的 ,但是调试发现 貌似使用率不高。
4. GUI_SetFuncMixColors(DMA2D_MixColors);//会导致显示效果变差
打开这个函数后,文字明显被腐蚀感觉,线条都变细了。
4. 其他函数都是参考硬汉的,
void LCD_X_Config(void)
{
U32 i;
LCD_LL_Init ();
/* At first initialize use of multiple buffers on demand */
#if (NUM_BUFFERS > 1)
for (i = 0; i < GUI_NUM_LAYERS; i++)
{
GUI_MULTIBUF_ConfigEx(i, NUM_BUFFERS);
}
#endif
/* Set display driver and color conversion for 1st layer */
GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER_0, COLOR_CONVERSION_0, 0, 0);
/* Set size of 1st layer */
if (LCD_GetSwapXYEx(0)) {
LCD_SetSizeEx (0, YSIZE_PHYS, XSIZE_PHYS);
LCD_SetVSizeEx(0, YSIZE_PHYS * NUM_VSCREENS, XSIZE_PHYS);
} else {
LCD_SetSizeEx (0, XSIZE_PHYS, YSIZE_PHYS);
LCD_SetVSizeEx(0, XSIZE_PHYS, YSIZE_PHYS * NUM_VSCREENS);
}
#if (GUI_NUM_LAYERS > 1)
/* Set display driver and color conversion for 2nd layer */
GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER_1, COLOR_CONVERSION_1, 0, 1);
/* Set size of 2nd layer */
if (LCD_GetSwapXYEx(1)) {
LCD_SetSizeEx (1, YSIZE_PHYS, XSIZE_PHYS);
LCD_SetVSizeEx(1, YSIZE_PHYS * NUM_VSCREENS, XSIZE_PHYS);
} else {
LCD_SetSizeEx (1, XSIZE_PHYS, YSIZE_PHYS);
LCD_SetVSizeEx(1, XSIZE_PHYS, YSIZE_PHYS * NUM_VSCREENS);
}
#endif
/*Initialize GUI Layer structure */
layer_prop[0].address = LCD_LAYER0_FRAME_BUFFER;
#if (GUI_NUM_LAYERS > 1)
layer_prop[1].address = LCD_LAYER1_FRAME_BUFFER;
#endif
/* Setting up VRam address and custom functions for CopyBuffer-, CopyRect- and FillRect operations */
for (i = 0; i < GUI_NUM_LAYERS; i++)
{
layer_prop.pColorConvAPI = (LCD_API_COLOR_CONV *)apColorConvAPI;
layer_prop.pending_buffer = -1;
/* Set VRAM address */
LCD_SetVRAMAddrEx(i, (void *)(layer_prop.address));
/* Remember color depth for further operations */
layer_prop.BytesPerPixel = LCD_GetBitsPerPixelEx(i) >> 3;
/* Set custom functions for several operations */
LCD_SetDevFunc(i, LCD_DEVFUNC_COPYBUFFER, (void(*)(void))CUSTOM_CopyBuffer);
LCD_SetDevFunc(i, LCD_DEVFUNC_COPYRECT, (void(*)(void))CUSTOM_CopyRect);
/* Filling via DMA2D does only work with 16bpp or more */
if (LCD_LL_GetPixelformat(i) <= LTDC_PIXEL_FORMAT_ARGB4444)
{
LCD_SetDevFunc(i, LCD_DEVFUNC_FILLRECT, (void(*)(void))CUSTOM_FillRect);
LCD_SetDevFunc(i, LCD_DEVFUNC_DRAWBMP_8BPP, (void(*)(void))CUSTOM_DrawBitmap8bpp);
}
/* Set up drawing routine for 16bpp bitmap using DMA2D */
if (LCD_LL_GetPixelformat(i) == LTDC_PIXEL_FORMAT_RGB565)
{LCD_SetDevFunc(i, LCD_DEVFUNC_DRAWBMP_16BPP, (void(*)(void))CUSTOM_DrawBitmap16bpp); /* Set up drawing routine for 16bpp bitmap using DMA2D. Makes only sense with RGB565 */
}
/* Set up drawing routine for 32bpp bitmap using DMA2D */
if (LCD_LL_GetPixelformat(i) == LTDC_PIXEL_FORMAT_ARGB8888)
LCD_SetDevFunc(i, LCD_DEVFUNC_DRAWBMP_32BPP, (void(*)(void))CUSTOM_DrawBitmap32bpp);
/* Set up drawing routine for 32bpp bitmap using DMA2D. Makes only sense with ARGB8888 */
/* Set up custom color conversion using DMA2D, works only for direct color modes because of missing LUT for DMA2D destination */
/* Set up custom color conversion using DMA2D, works only for direct color modes because of missing LUT for DMA2D destination */
GUICC_M1555I_SetCustColorConv(Color2IndexBulk_M1555IDMA2D, Index2ColorBulk_M1555IDMA2D); /* Set up custom bulk color conversion using DMA2D for ARGB1555 */
GUICC_M565_SetCustColorConv (Color2IndexBulk_M565DMA2D, Index2ColorBulk_M565DMA2D); /* Set up custom bulk color conversion using DMA2D for RGB565 */
GUICC_M4444I_SetCustColorConv(Color2IndexBulk_M4444IDMA2D, Index2ColorBulk_M4444IDMA2D); /* Set up custom bulk color conversion using DMA2D for ARGB4444 */
GUICC_M888_SetCustColorConv (Color2IndexBulk_M888DMA2D, Index2ColorBulk_M888DMA2D); /* Set up custom bulk color conversion using DMA2D for RGB888 */
GUICC_M8888I_SetCustColorConv(Color2IndexBulk_M8888IDMA2D, Index2ColorBulk_M8888IDMA2D); /* Set up custom bulk color conversion using DMA2D for ARGB8888 */
GUI_SetFuncAlphaBlending(DMA2D_AlphaBlending); /* Set up custom alpha blending function using DMA2D */
GUI_SetFuncGetpPalConvTable(_LCD_GetpPalConvTable);
//GUI_SetFuncMixColors(DMA2D_MixColors);//会导致显示效果变差
GUI_SetFuncMixColorsBulk(LCD_MixColorsBulk);
}
DebugTx_StrDirect("LCD_X_Config ok\r\n");
}
|
|