[Digi-Key Follow Me Issue 4] Getting Started Task 3 - Porting ZLGGUI and LCD Display
[Copy link]
This post was last edited by qinyunti on 2024-2-15 22:19
- Transplant ZLGGUI-display characters
3.1 Add code
CMakeLists.txt中
aux_source_directory(ZLG_GUI ZLG_GUI_SOURCES)
include_directories(ZLG_GUI/include.)
add_executable(blink
blink.c
ls013.c
ls013_lcd.c
${ZLG_GUI_SOURCES}
)
3.2 Driver Porting
Need to implement the functions in lcmdrv.c
#include"config.h"
#include"ls013_lcd.h"
void GUI_Initialize ( void) Initialization
voidGUI_Initialize(void)
{
lcd_init();
}
void GUI_FillSCR(TCOLOR dat) Fill the entire screen with the specified color
voidGUI_FillSCR(TCOLORdat)
{
lcd_fill(that);
}
void GUI_Point(uint16 x, uint16_t y, TCOLOR color) Write the color value of the point
voidGUI_Point(uint16x, uint16_ty, TCOLORcolor)
{
lcd_set_pixel(x,y,color);
}
uint32_t GUI_ReadPoint(uint16 x, uint16_t y, TCOLOR *ret) Get the color value of a point. Can be empty
uint32_tGUI_ReadPoint(uint16x, uint16_ty, TCOLOR*ret)
{
uint32_tretc;
retc= lcd_get_pixel(x,y);
if(ret!= 0)
{
*right = rightc;
}
returnretc;
}
void GUI_Exec(void) Refresh the video memory display
voidGUI_Exec(void)
{
lcd_sync();
}
Definition of resolution in Lcmdrv.h
#defineGUI_LCM_XMAX 144u
#define GUI_LCM_YMAX 168u
3.3 Configuration
UI_CONFIG.h can be used to enable the configuration of each module. We use 8x8 font to print HelloWorld
So enable configuration #define FONT8x8_EN 1
3.4 Testing
#include "config.h"
GUI_Initialize();
GUI_SetColor(1,0);
GUI_PutString8_8(0,0,"HelloWorld");
while(1)
{
GUI_Exec();
sleep_ms(10);
}
The download and run results are as follows
|