当前位置:网站首页>Lvgl8.1 hi3536c platform use
Lvgl8.1 hi3536c platform use
2022-06-12 04:56:00 【hi_ LeTian】
LVGL8.1 Hi3536C Platform use
LVGL8.1 Hi3536C Platform use
Why use LVGL
There are still many embedded platforms UI The library of can be selected , There are open source 、 Closed source , Free of charge ! I have used emWIN,MiniGUI,QT, It also has its own set of UI library . I learned about it earlier LVGL, But there is no deep understanding , In the past, it seemed that there was still a lot missing UI Components of the library , It may be used in product development. There are many things that need to be handled by yourself .
The products made in recent years have human-computer interaction interfaces , It's all about UI Interface interaction , The main use is QT, But in embedded LINUX System ,QT In memory usage , And display on the large screen , And there are UI When interacting , It was very difficult to respond , With the help of hardware 2D Acceleration is not very easy , High resolution , It still needs a lot of optimization , The effect is not so good . I did one before VGA Output embedded products , use QT When the output , The refresh speed is obviously slow , Later, the lower floor was also replaced by DFB There are some improvements , But the effect is also average .
In a recent want to , When making new products, we should consider changing other products UI Plan to achieve it , Learned more UI programme , I saw LVGL Of DEMO, It feels like this in embedded systems UI effect , One tight Demo They all feel very modern , Look at the code inside , Realization way , Element attributes , The control methods are very modern . Looking at the code structure, it is very simple , In embedded systems , Keep it simple , It can take a few layers to replace the bottom , The way , It means that we can , Very deep and simple customization in our system , Application products ,UI The functional feeling of is also just suitable .LVGL At the same time, it will be updated soon , Unlike other old ones UI The library basically stops updating or is rarely updated every few years , Native controls can only be described as old , The operating experience is also very old MFC Style experience .
LVGL Related websites
Official website
https://lvgl.io/
Github Code
https://github.com/lvgl
Use version
Here we use the latest one directly 8.1 Version of .
Download the corresponding source code
LVGL
lvgl-8.1.0.tar.gz
LVGL UI library .
LV_DRIVERS
lv_drivers-release-v8.1
The bottom layer drawing method is involved, such as Framebuffer The way , still DRM The way , Whether to use SDL, Input and output such as mouse , keyboard , Touch, etc .
LV_PORT
lv_port_linux_frame_buffer-master, Use here Framebuffer The way , So in git Download a configured project directly from .
lv_demos
lv_demos-release-v8.1 Some corresponding demo.
compile LVGL
1: decompression lv_port_linux_frame_buffer-master In a directory , Empty... Will be used in the directory lv_demos,lv_drivers,lvgl Empty directory , And there are related configuration files ;
2: decompression lvgl-8.1.0.tar.gz ,lv_drivers-release-v8.1, And put it in the previous step lv_port in ;
3: To facilitate integration with applications , We put LVGL Compile into a library , Here's a change lv_port Inside Makefile, Add the following configuration to it :
lib: $(AOBJS) $(COBJS) $(AR) rv liblvgl.a $(AOBJS) $(COBJS)4: In this way, we can integrate our UI 了 .
In Haisi Hi3536c Run in LVGL
If you want to Hi3536c Run on the platform lvgl The program , We basically need the following two things in the first step :
- 1: initialization Hi3536c Upper mpp Some modules in the system, such as vo,hifb;
- 2: function LVGL Code ;
Here it is PUPANVR Project realization , stay PUPANVR There is a hal_media The library of , The initialization of hardware related platforms is implemented in this library .
The following code implements the operation LVGL Of Demo operation :
#include "lvgl/examples/lv_examples.h"
#include "lvgl/lvgl.h"
#include "lvgl/lv_port_indev.h"
#include "lv_drivers/display/fbdev.h"
#include "lv_drivers/indev/evdev.h"
#include "lv_demos/lv_demo.h"
#include <unistd.h>
#include <pthread.h>
#include <time.h>
#include <sys/time.h>
int lvgl_test(void)
{
/*LittlevGL init*/
lv_init();
/*Linux frame buffer device init*/
fbdev_init();
/*A small buffer for LittlevGL to draw the screen's content*/
static lv_color_t buf[DISP_BUF_SIZE];
/*Initialize a descriptor for the buffer*/
static lv_disp_draw_buf_t disp_buf;
lv_disp_draw_buf_init(&disp_buf, buf, NULL, DISP_BUF_SIZE);
/*Initialize and register a display driver*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.draw_buf = &disp_buf;
disp_drv.flush_cb = fbdev_flush;
disp_drv.hor_res = 1920;
disp_drv.ver_res = 1080;
lv_disp_drv_register(&disp_drv);
//lv_port_indev_init();
/*Create a Demo*/
lv_demo_widgets();
//lv_demo_benchmark();
//lv_demo_keypad_encoder();
//lv_demo_music();
//lv_demo_stress();
//lv_example_arc_1();
/*Handle LitlevGL tasks (tickless mode)*/
while(1) {
lv_task_handler();
usleep(5000);
}
return 0;
}
int main(int argc, char** argv)
{
int ret = 0;
ret = sys_init();
if(ret != 0)
{
LOG(ERROR) << "sys_init failure! ret:" << ret << endl;
return -1;
}
ret = hal_media_init();
if(ret != 0)
{
LOG(ERROR) << "hal_media_init failure!" << endl;
return -1;
}
lvgl_test();
while(1)
{
sleep(1);
}
return 0;
}
hal_media_init Initializes the operation of Haspin , lvgl_test That is to call lvgl Of demo Program .
Add mouse support
Use here lv_drivers/indev/evdev.h Method to introduce mouse support .
First, in the lv_drivers Inside USE_EVDEV Macro on , In the code above lvgl_test() Add one indev Device operation registration support for .
lv_indev_t * indev_mouse;
int lv_indev_init()
{
static lv_indev_drv_t indev_drv;
evdev_init();
/*Register a mouse input device*/
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = evdev_read;
indev_mouse = lv_indev_drv_register(&indev_drv);
/*Set cursor. For simplicity set a HOME symbol now.*/
lv_obj_t * mouse_cursor = lv_img_create(lv_scr_act());
lv_img_set_src(mouse_cursor, LV_SYMBOL_SETTINGS);
lv_indev_set_cursor(indev_mouse, mouse_cursor);
return 0;
}
stay lvgl_test Inside lv_disp_drv_register And call lv_indev_init that will do !
Running like this Demo Can UI Using the mouse to interact !
UI It's fresh , Modern feeling , There are many kinds of mobile phones nowadays , The way of platform interaction can be reflected in the above ! Omit the embedded system , stay UI Special effects need to be achieved in .
From the above use process ,LVGL Even a complete compilation project has not been completed ! But this just shows his simplicity ! It's not a fault , The opposite is more like a good thing !
There are few levels of abstraction , Easy to transplant ! There is no other burden !
边栏推荐
- [cjson] precautions for root node
- Solid programming concepts
- Yolov5 realizes road crack detection
- Gavin teacher's perception of transformer live class - rasa dialogue robot project practice in the field of education agency mode and core component source code analysis under the microservice of educ
- L1-066 cat is liquid (5 points)
- JS set the position of the current scroll bar
- Chapter 1
- WiFi smartconfig implementation
- Surface net radiation flux data, solar radiation data, rainfall data, air temperature data, sunshine duration, water vapor pressure distribution, wind speed and direction data, surface temperature
- 2022-02-28 WPF upper computer 126 understand mqtt
猜你喜欢

存储器的保护

Ubunt 20.04 uses CDROM or ISO as the installation source

Acquisition of Lai data, NPP data, GPP data and vegetation coverage data

How to deploy PostgreSQL as a docker container

Interview must ask: summary of ten classic sorting algorithms

Image processing 13- calculation of integral diagram

cellular automaton

Transpiration and evapotranspiration (ET) data, potential evapotranspiration, actual evapotranspiration data, temperature data, rainfall data

Normalized vegetation index (NDVI) data, NPP data, GPP data, evapotranspiration data, vegetation type data, ecosystem type distribution data

AI and logistics Patent
随机推荐
How to count the total length of roads in the region and draw data histogram
Transpiration and evapotranspiration (ET) data, potential evapotranspiration, actual evapotranspiration data, temperature data, rainfall data
Sword finger offer30 days re brush
Common MySQL date query
Chrome is amazingly fast, fixing 40 vulnerabilities in less than 30 days
[GIS tutorial] land use transfer matrix
Musk promotes the development of fascinating new products partners remind important questions
Sentinel-2 data introduction and download
[backtracking based on bit operation] queen n problem 2
JWT學習與使用
Ray. Tune visual adjustment super parameter tensorflow 2.0
These programming languages are worth learning
CCF access control system
MySQL5.7.21 Build For ARM
1006 next spread
JWT learning and use
存储器的保护
Spatial distribution data of China's tertiary watershed / national new area distribution data /npp net primary productivity data / spatial distribution data of vegetation cover / land use data /ndvi d
Realease package appears – missing type parameter
InnoDB data storage structure – MySQL