LkdGui is a graphical library designed for monochrome displays. It's used in the industrial control field for the simple and beautiful graphic interface. Its source code is written in C language and conforms to the C99 standard. LkdGui contains commonly used graphical functions to drawing points, lines, rectangles, text display, button widgets and progress bars. It uses 'Windows' for unified management and scheduling of widgets, making the display modules lowly coupled and beneficial to application development.
The presentation video is posting on RT-Thread Youtube Channel!
LkdGui Source Code
lkdGui_source file: lkdGui all source code.
A. include file: It contains all the header files of GUI. This path should be added to the project when porting to a new platform.
- lkdGui.h: This file contains all the Gui function interfaces. This header file should be included when using the Gui functions.
- lkdGuiConfig.h: This file is used to configure and tailor Gui.
- lkdGuiTypedef.h: This file defines the GUI-related data structures that you don’t have to read it.
B. portFile: This file contains the porting files.
- fontDriver File: It includes commonly used font library, font library chip driver, and so on. You can add font-related drivers here.
- lcdDriverPort File: It contains a commonly-used LCD drive. You can add the LCD-related drive into here.
- lcdDriverPort.c: LCD drive porting interfaces of Gui. You can add the relevant functions inside.
- userFontPort.c: Font-driven porting interface of GUI. You can add the relevant functions inside.
- userAppPort.c: This input application layer, which contains initialization functions, window management functions and others. You can write the application here.
C. source file: Gui drawing function, window management function and other related functions to implement the source code.
The font porting interface contains fontDriver folder and userFontPort.c. The porting process is as follows:
A. You should look at the fontDriver folder to see if there is a font library or font library chip driver you want. If not you need to add it.
B. Then modify userFontPort.c. Fill in the related functions in this file.
- GetDfontData() This function is used to obtain a font model. The font library should contain a function that gets the font model, which can be called with this function.
- GetSfontData() This function is used to obtain the ASCII code model, such as GetDfontData ().
- Using lkdFont structure object to declare your own font->initialization->use GuiFontSet() as the system default font.
LCD Porting interface contains lcdDriverPort folder and lcdDriverPort.c. The porting process is as follows:
A. You should look at the lcdDriverPort folder to see if there has the LCD driver you want. If not you need to add it.
B. Then modify lcdDriverPort.c. Fill in the related functions in this file. (Some functions can be filled in as you need). Here are the required functions need to be fill in:
- GuiUpdateDisplayAll(): This function is used to flush cached data to the LCD.
- GuiDrawPoint(): Draw a point at the fixed position of the LCD.
Modify lkdGuiConfig.h in the LCD size related macro GUI_LCM_XMAX, GUI_LCM_YMAX.
User interface: Available user interface functions are included in lkdGui.h. userAppPort.c is a template that you can use.
lkdGui Window Introduction
LkdGui uses windows as a management and scheduling unit. All user drawings should be included in a specific window.
1、The GUIWINMANAGE_NUM in lkdGuiConfig.h is used to modify the maximum number of nested windows.
2、You should use it to initialize window-related resources when powering on GuiWinInit() systems.
3、GuiWinDisplay() is a window scheduling function that requires programs to execute all the time.
4、lkdWin is the structure of the...Read more »