硬汉嵌入式论坛

 找回密码
 立即注册
查看: 304|回复: 4
收起左侧

[有问必答] RA8875显示emwin

[复制链接]

16

主题

21

回帖

69

积分

初级会员

积分
69
发表于 2024-1-11 11:05:54 | 显示全部楼层 |阅读模式
求助,现在我用ra8875显示emwin的demo是好的,但是用于显示我自己的窗口创建,刷新很缓慢,慢到肉眼可以看见刷新的那种程度,目前就用GUI_CreateDialogBox这个函数创建了几个小窗口,然后上面有数值切换的小功能,那个数值切换都是有间隔才刷新的,不知道是不是底层没有优化好,
LCD的接口配置用的这个文件

#include "GUI.h"
#include "GUIDRV_Lin.h"
#include "LCDConf_Lin_Template.h"
/*********************************************************************
*
*       Layer configuration (to be modified)
*
**********************************************************************
*/
//
// Physical display size
//
#define XSIZE_PHYS 320
#define YSIZE_PHYS 240

#define TOUCH_AD_TOP                 160
#define TOUCH_AD_BOTTOM         930//940
#define TOUCH_AD_LEFT                 60
#define TOUCH_AD_RIGHT                 980

//
// Color conversion
//
#define COLOR_CONVERSION GUICC_M565  //GUICC_8888

//
// Display driver
//
#define DISPLAY_DRIVER GUIDRV_TEMPLATE  //GUIDRV_WIN32

//
// Buffers / VScreens
//
#define NUM_BUFFERS  3 // Number of multiple buffers to be used
#define NUM_VSCREENS 1 // Number of virtual screens to be used

/*********************************************************************
*
*       Configuration checking
*
**********************************************************************
*/
#ifndef   VRAM_ADDR
  #define VRAM_ADDR 0 // TBD by customer: This has to be the frame buffer start address
#endif
#ifndef   XSIZE_PHYS
  #error Physical X size of display is not defined!
#endif
#ifndef   YSIZE_PHYS
  #error Physical Y size of display is not defined!
#endif
#ifndef   COLOR_CONVERSION
  #error Color conversion not defined!
#endif
#ifndef   DISPLAY_DRIVER
  #error No display driver defined!
#endif
#ifndef   NUM_VSCREENS
  #define NUM_VSCREENS 1
#else
  #if (NUM_VSCREENS <= 0)
    #error At least one screeen needs to be defined!
  #endif
#endif
#if (NUM_VSCREENS > 1) && (NUM_BUFFERS > 1)
  #error Virtual screens and multiple buffers are not allowed!
#endif

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/


/****************************************************************************
* 名    称:LCD_SetTouchOrg(void)
* 功    能:设置触摸屏
* 入口参数:无
* 出口参数:无
* 说    明:
* 调用方法:无
****************************************************************************/
void LCD_SetTouchOrg(void)
{  
    /* 校准触摸屏 */
    GUI_TOUCH_SetOrientation(GUI_SWAP_XY);
    GUI_TOUCH_Calibrate(GUI_COORD_X, 0, 320, TOUCH_AD_LEFT, TOUCH_AD_RIGHT); /* Calibrate X-axis */
    GUI_TOUCH_Calibrate(GUI_COORD_Y, 0, 240, TOUCH_AD_TOP, TOUCH_AD_BOTTOM); /* Calibrate Y-axis */
}

/*********************************************************************
*
*       LCD_X_Config
*
* Purpose:
*   Called during the initialization process in order to set up the
*   display driver configuration.
*   
*/
void LCD_X_Config(void) {
  //
  // At first initialize use of multiple buffers on demand
  //
  #if (NUM_BUFFERS > 1)
    GUI_MULTIBUF_Config(NUM_BUFFERS);
  #endif
  //
  // Set display driver and color conversion for 1st layer
  //
  GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, COLOR_CONVERSION, 0, 0);
  //
  // Display driver configuration, required for Lin-driver
  //
  if (LCD_GetSwapXY()) {
    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);
  }
  LCD_SetVRAMAddrEx(0, (void *)VRAM_ADDR);
  //
  // Set user palette data (only required if no fixed palette is used)
  //
  #if defined(PALETTE)
    LCD_SetLUTEx(0, PALETTE);
  #endif
  
  //
  // Set custom functions for several operations to optimize native processes
  //
  LCD_SetDevFunc(0, LCD_DEVFUNC_COPYBUFFER, (void(*)(void))CUSTOM_LCD_CopyBuffer);
  LCD_SetDevFunc(0, LCD_DEVFUNC_COPYRECT,   (void(*)(void))CUSTOM_LCD_CopyRect);
  LCD_SetDevFunc(0, LCD_DEVFUNC_FILLRECT, (void(*)(void))CUSTOM_LCD_FillRect);
  LCD_SetDevFunc(0, LCD_DEVFUNC_DRAWBMP_8BPP, (void(*)(void))CUSTOM_LCD_DrawBitmap8bpp);
  LCD_SetDevFunc(0, LCD_DEVFUNC_DRAWBMP_16BPP, (void(*)(void))CUSTOM_LCD_DrawBitmap16bpp);
  LCD_SetTouchOrg();
}

/*********************************************************************
*
*       LCD_X_DisplayDriver
*
* Purpose:
*   This function is called by the display driver for several purposes.
*   To support the according task the routine needs to be adapted to
*   the display controller. Please note that the commands marked with
*   'optional' are not cogently required and should only be adapted if
*   the display controller supports these features.
*
* Parameter:
*   LayerIndex - Index of layer to be configured
*   Cmd        - Please refer to the details in the switch statement below
*   pData      - Pointer to a LCD_X_DATA structure
*
* Return Value:
*   < -1 - Error
*     -1 - Command not handled
*      0 - Ok
*/
int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData) {
  int r;

  switch (Cmd) {
  case LCD_X_INITCONTROLLER: {
    //
    // Called during the initialization process in order to set up the
    // display controller and put it into operation. If the display
    // controller is not initialized by any external routine this needs
    // to be adapted by the customer...
    //
    // ...
    return 0;
  }
  case LCD_X_SETVRAMADDR: {
    //
    // Required for setting the address of the video RAM for drivers
    // with memory mapped video RAM which is passed in the 'pVRAM' element of p
    //
    LCD_X_SETVRAMADDR_INFO * p;
    p = (LCD_X_SETVRAMADDR_INFO *)pData;
    //...
    return 0;
  }
  case LCD_X_SETORG: {
    //
    // Required for setting the display origin which is passed in the 'xPos' and 'yPos' element of p
    //
    LCD_X_SETORG_INFO * p;
    p = (LCD_X_SETORG_INFO *)pData;
    //...
    return 0;
  }
  case LCD_X_SHOWBUFFER: {
    //
    // Required if multiple buffers are used. The 'Index' element of p contains the buffer index.
    //
    LCD_X_SHOWBUFFER_INFO * p;
    p = (LCD_X_SHOWBUFFER_INFO *)pData;
    //...
    return 0;
  }
  case LCD_X_SETLUTENTRY: {
    //
    // Required for setting a lookup table entry which is passed in the 'Pos' and 'Color' element of p
    //
    LCD_X_SETLUTENTRY_INFO * p;
    p = (LCD_X_SETLUTENTRY_INFO *)pData;
    //...
    return 0;
  }
  case LCD_X_ON: {
    //
    // Required if the display controller should support switching on and off
    //
    return 0;
  }
  case LCD_X_OFF: {
    //
    // Required if the display controller should support switching on and off
    //
    // ...
    return 0;
  }
  default:
    r = -1;
  }
  return r;
}

/*************************** End of file ****************************/  请教一下有什么地方还需要优化;

回复

使用道具 举报

16

主题

21

回帖

69

积分

初级会员

积分
69
 楼主| 发表于 2024-1-11 11:07:37 | 显示全部楼层
LCD_SetDevFunc(0, LCD_DEVFUNC_COPYBUFFER, (void(*)(void))CUSTOM_LCD_CopyBuffer);
  LCD_SetDevFunc(0, LCD_DEVFUNC_COPYRECT,   (void(*)(void))CUSTOM_LCD_CopyRect);
  LCD_SetDevFunc(0, LCD_DEVFUNC_FILLRECT, (void(*)(void))CUSTOM_LCD_FillRect);
  LCD_SetDevFunc(0, LCD_DEVFUNC_DRAWBMP_8BPP, (void(*)(void))CUSTOM_LCD_DrawBitmap8bpp);
  LCD_SetDevFunc(0, LCD_DEVFUNC_DRAWBMP_16BPP, (void(*)(void))CUSTOM_LCD_DrawBitmap16bpp);
这些地方报错  所以源工程中屏蔽掉了  CUSTOM_LCD_CopyBuffer   CUSTOM_LCD_CopyRect   CUSTOM_LCD_FillRect   CUSTOM_LCD_DrawBitmap8bpp   CUSTOM_LCD_DrawBitmap16bpp这些函数没有实现
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106647
QQ
发表于 2024-1-11 16:22:19 | 显示全部楼层
参考我们的V5的emWin驱动代码,速度还可以,底层都做优化了。
回复

使用道具 举报

16

主题

21

回帖

69

积分

初级会员

积分
69
 楼主| 发表于 2024-1-16 08:49:15 | 显示全部楼层
eric2013 发表于 2024-1-11 16:22
参考我们的V5的emWin驱动代码,速度还可以,底层都做优化了。

好的 谢谢大大
回复

使用道具 举报

16

主题

21

回帖

69

积分

初级会员

积分
69
 楼主| 发表于 2024-1-18 09:40:35 | 显示全部楼层
eric2013 发表于 2024-1-11 16:22
参考我们的V5的emWin驱动代码,速度还可以,底层都做优化了。

硬汉哥,我在想是不是因为我芯片使用的是GD32F4的,然后直接使用STemwin的库,没开CRC校验,然后导致emwin使用不正常呢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-4-27 17:29 , Processed in 0.248350 second(s), 26 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表