Optimization of UI interface for RA8889 display control on emWin platform

RA8889 and emWin driver porting guide and display optimization



Advantages of using emWin on RA8889

In order to better realize the functions of RA8889, such as multi-cache applications (built-in 128Mbit SDRAM), drawing geometric graphics engine, 2D graphics acceleration engine (BTE), picture-in-picture (PIP implements pop-up tool), display pictures (BMP, JPEG), video playback and other functions, we have added the above functions to the emWin platform to improve the display efficiency.

foreword

This article explains how to transplant the driver of RA8889 (LCD screen controller TFT LCD Controller) of Ruiyou Technology to emWin GUI Library, so as to realize the built-in LCD control function of RA8889 on the emWin platform. Please refer to the RA8889_API_emwin546_stm32f103_8080IF sample program for the following instructions. This example is based on using STM32F103VET6 MCU on RA8889 EV Board and compiling with Keil MDK.


1. Get emWin Graphic Library

1.1 Install Keil MDK and get the emWin library under the path of C:\Keil_v5\ARM\Segger\emWin

insert image description here

1.2 Get emWin User&Reference Guide at C:\Keil_v5\ARM\Segger\emWin\Doc

insert image description here

1.3 Get RA8889 API sample program

To obtain the RA8889 API sample program/RA8889_API_emwin546_stm32f103_8080IF, please contact the salesman of Ruifu Technology Shenzhen Branch to obtain the latest RA8889_API_Demo_Vxx and RA8889_API_emwin546_stm32f103_8080IF samples.

2. Start transplanting

RA8889_API_emwin546_stm32f103_8080IF is generated by adding RA8889_API_Demo_Vxx to emWin Library. Please refer to the RA8889_API_emwin546_stm32f103_8080IF sample program project for the following modification instructions.

2.1. Add 3 folders emwin_config, emwin_inc, emwin_lib

insert image description here
(1) In C:\Keil_v5\ARM\Segger\emWin\Sample\Config, copy GUIConf.c, GUIConf.h, LCDConf.c, LCDConf.h 4 files to emwin_config folder.
(2) In C:\Keil_v5\ARM\Segger\emWin\Sample\DisplayDriver, copy the GUIDRV_Template.c file to the emwin_config folder.
(3) In C:\Keil_v5\ARM\Segger\emWin\Sample\GUI_X, copy the GUI_X.c file to the emwin_config folder.
(4) In C:\Keil_v5\ARM\Segger\emWin\Include, copy all .h files to the emwin_inc folder.
(5) In C:\Keil_v5\ARM\Segger\emWin\Lib, copy the GUI_CM3.lib file to the emwin_lib folder. (Since our STM32F103 is a CM3 core, we choose CM3).
(6) In C:\Keil_v5\ARM\Segger\emWin\Sample\Application\GUIDemo, copy all the folders to the emwin_demo folder.

2.2 Establish emwin_config, emwin_lib, emwin_demo 3 Groups

Open the Keil project, create emwin_config, emwin_lib, emwin_demo 3 Groups in Manage Project Items and add files, as shown in the figure below. insert image description here
In the Include Paths in Option for Target, add 3 include paths as shown in the figure below.
insert image description here

2.3 After the above settings are completed, the following errors should be generated when we compile:

Error: L6218E: Undefined symbol GUI_X_GetTaskId (referred from gui_task.o).
Error: L6218E: Undefined symbol GUI_X_InitOS (referred from gui_task.o).
Error: L6218E: Undefined symbol GUI_X_Lock (referred from gui_task.o).
Error: L6218E: Undefined symbol GUI_X_Unlock (referred from gui_task.o).

Since this example does not use the OS operating system, let's ignore this problem first. In order to make the compilation normal, we add these functions in GUI_X.c, as shown in the figure below.
insert image description here

2.4 emWin GUI time base source

emWin GUI needs a time base source and must be incremented by 1ms, that is, the OS_TimeMS variable is declared in the GUI_X.c file, and the MCU must first provide a 1ms timer tick, which is usually set by SysTick in Cortex-M by the SysTick_Handler{} interrupt function Incrementing variables is implemented, and the example in this article uses the MCU TIMER interrupt to provide a 1ms tick, and the TIM3_IRQHandler() interrupt function in stm32f10x_it.c realizes tick incrementing.

2.5 Allocate memory to emWin system

Set in the GUIConf.c file, the memory size will affect the performance and must be configured according to the memory size of the MCU.
insert image description here

2.6. GUIDRV_Template.c modification

Use GUIDRV_Template.c as a new GUI device driver file. EmWin realizes the screen driver mainly to write a point and read a point. We must modify static void _SetPixelIndex(GUI_DEVICE * pDevice, int x, int y, LCD_PIXELINDEX PixelIndex) and static LCD_PIXELINDEX _GetPixelIndex(GUI_DEVICE * pDevice, int x, int y) two main functions, as shown in the figure below.
insert image description hereinsert image description here

The imported putPixel() and getPixel() functions come from RA8889_API.h. In this example, 16bit RGB565 or
24bit RGB888 data format is selected. Refer to UserDef.h to select the following settings:

The code is as follows (example):
supports 16bit RGB565 (using emWin GUICC_M565)
#define Parallel_8080
#define MCU_16bit_ColorDepth_16bpp
The code is as follows (example):
supporting 24bit RGB888 (using emWin GUICC_M888)
#define Parallel_8080
#define MCU_16bit_ColorDepth_2 4bpp_Mode_2

In addition, in order to optimize the filling efficiency, add the definition Add2D_Optimize in the GUIDRV_Template.c file, use the built-in 2D drawing acceleration function of RA8889 and add it to the _FillRect(), _DrawHLine(), _DrawVLine() functions, as shown below:
insert image description here

insert image description here

2.7 Modify LCDConf.c as shown below:

insert image description here

After the above settings are completed, add the following content to main.c to start running GUIDEMO.
insert image description here

3. Advantages of using emWin on RA8889

In order to better realize the functions of RA8889, such as multi-cache applications (built-in 128Mbit SDRAM), drawing geometric graphics engine, 2D graphics acceleration engine (BTE), picture-in-picture (PIP implements pop-up tool), display pictures (BMP, JPEG), video playback and other functions, we have added the above functions to the emWin platform to improve the display efficiency.

3.1 Display effect optimization

Use the built-in DRAM and BTE functions of RA8889 to replace the emWin Memory Device function. In order to update the display without flickering, please contact Ruiyou Technology for specific applications;

3.2 Multi-cache application

Use RA8889 built-in 128Mbit DRAM, allocate memory to emWin to operate on RA8889 video memory, you can realize: cache 1 is used for LCD display (that is, display area), cache 2 is used for emWin’s read and write operation memory, and other memory can be allocated Cache 3, Cache 4, etc. For example, Cache 3 can be used to display the Flash pictures hanging on RA8889. When it needs to be displayed, it can be displayed by copying and pasting the BTE to the display area. For example, Cache 4 is used as a video cache link. It can perfectly realize the combination of emWin window + video playback; the above implementation specific principles, as well as code routines, can be contacted with Ruiyou Technology.


Summarize

Use Ruiyou Technology's RA8889 LCD controller chip, with a low-end MCU, connect to a high-resolution screen (1366*2048) or a low-resolution screen on the emWin platform, and you can create a smooth and cool UI Operation interface.

RA8889 + emWin Demo video

Ruiyou Technology RA8889 + emWin Demo

Guess you like

Origin blog.csdn.net/qq_41528442/article/details/131186518