您尚未登录。

楼主 #1 2020-08-04 09:56:15

明月照我沟渠
会员
注册时间: 2020-07-09
已发帖子: 120
积分: 114

学习 Linux FrameBuffer + LVGL 7.0

离线

楼主 #2 2020-08-04 10:00:28

明月照我沟渠
会员
注册时间: 2020-07-09
已发帖子: 120
积分: 114

Re: 学习 Linux FrameBuffer + LVGL 7.0

项目地址: https://github.com/lvgl/lv_port_linux_frame_buffer

递归克隆到本地:

git clone https://github.com/lvgl/lv_port_linux_frame_buffer.git
cd lv_port_linux_frame_buffer
git submodule update --init --recursive





上面速度太慢了, 本站下载: lv_port_linux_frame_buffer.tgz (消耗晕哥70M空间 ~~~)

md5校验码: 4f1d02832086dc1011c98e64c2abe08c








原子哥视频教程: https://www.bilibili.com/video/BV1ug4y1q7ha
这个视频教程基于LVGL6, 与最新的LVGL7接口又有很大变化, 但是仍然有很重要的参考价值.

最近编辑记录 明月照我沟渠 (2020-08-04 10:01:35)

离线

楼主 #4 2020-08-04 10:05:24

明月照我沟渠
会员
注册时间: 2020-07-09
已发帖子: 120
积分: 114

Re: 学习 Linux FrameBuffer + LVGL 7.0

QQ截图20200804100417.png

QQ截图20200804100350.png

QQ截图20200804100336.png

离线

楼主 #5 2020-08-04 10:27:57

明月照我沟渠
会员
注册时间: 2020-07-09
已发帖子: 120
积分: 114

Re: 学习 Linux FrameBuffer + LVGL 7.0

离线

楼主 #6 2020-08-04 10:38:35

明月照我沟渠
会员
注册时间: 2020-07-09
已发帖子: 120
积分: 114

Re: 学习 Linux FrameBuffer + LVGL 7.0

QQ截图20200804103606.png

QtCreator 编辑/编译

离线

楼主 #8 2020-08-04 10:47:58

明月照我沟渠
会员
注册时间: 2020-07-09
已发帖子: 120
积分: 114

Re: 学习 Linux FrameBuffer + LVGL 7.0

阿黄 说:

我觉得可以在windows下使用QT,虚拟机下总感觉卡卡的,也可能我电脑不行

我感觉速度还挺不错的, 至少比Eclipse快多了.

离线

楼主 #9 2020-08-04 15:35:55

明月照我沟渠
会员
注册时间: 2020-07-09
已发帖子: 120
积分: 114

Re: 学习 Linux FrameBuffer + LVGL 7.0

diff --git a/Makefile b/Makefile
index bb8e264..6bf149c 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ CC ?= gcc
 LVGL_DIR_NAME ?= lvgl
 LVGL_DIR ?= ${shell pwd}
 CFLAGS ?= -O3 -g0 -I$(LVGL_DIR)/ -Wall -Wshadow -Wundef -Wmaybe-uninitialized -Wmissing-prototypes -Wno-discarded-qualifiers -Wall -Wextra -Wno-unused-function -Wundef -Wno-error=strict-prototypes -Wpointer-arith -fno-strict-aliasing -Wno-error=cpp -Wuninitialized -Wmaybe-uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wno-cast-qual -Wunreachable-code -Wno-switch-default -Wno-switch-enum -Wreturn-type -Wmultichar -Wformat-security -Wno-ignored-qualifiers -Wno-error=pedantic -Wno-sign-compare -Wno-error=missing-prototypes -Wdouble-promotion -Wclobbered -Wdeprecated -Wempty-body -Wtype-limits -Wshift-negative-value -Wstack-usage=1024 -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers -Wuninitialized -Wmaybe-uninitialized -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wpointer-arith -Wno-cast-qual -Wmissing-prototypes -Wunreachable-code -Wno-switch-default -Wswitch-enum -Wreturn-type -Wmultichar -Wno-discarded-qualifiers -Wformat-security -Wno-ignored-qualifiers -Wno-sign-compare
-LDFLAGS ?= -lSDL2 -lm
+LDFLAGS ?= -lSDL2 -lm -linput
 BIN = demo
 
 
diff --git a/lv_conf.h b/lv_conf.h
index b31a820..e03cf82 100644
--- a/lv_conf.h
+++ b/lv_conf.h
@@ -20,8 +20,8 @@
  *====================*/
 
 /* Maximal horizontal and vertical resolution to support by the library.*/
-#define LV_HOR_RES_MAX          (480)
-#define LV_VER_RES_MAX          (320)
+#define LV_HOR_RES_MAX          (800)
+#define LV_VER_RES_MAX          (480)
 
 /* Color depth:
  * - 1:  1 byte per pixel
@@ -190,7 +190,7 @@ typedef void * lv_fs_drv_user_data_t;
 #define LV_USE_USER_DATA        0
 
 /*1: Show CPU usage and FPS count in the right bottom corner*/
-#define LV_USE_PERF_MONITOR     1
+#define LV_USE_PERF_MONITOR     0
 
 /*========================
  * Image decoder and cache
diff --git a/lv_drivers b/lv_drivers
--- a/lv_drivers
+++ b/lv_drivers
@@ -1 +1 @@
-Subproject commit 4e26c37e7ba7518c4f48cabf31c53aeeace35b7d
+Subproject commit 4e26c37e7ba7518c4f48cabf31c53aeeace35b7d-dirty
diff --git a/lv_drv_conf.h b/lv_drv_conf.h
index 975c7b4..3e69dd3 100644
--- a/lv_drv_conf.h
+++ b/lv_drv_conf.h
@@ -310,22 +310,22 @@
  * Touchscreen as libinput interface (for Linux based systems)
  *------------------------------------------------*/
 #ifndef USE_LIBINPUT
-#  define USE_LIBINPUT           0
+#  define USE_LIBINPUT           1
 #endif
 
 #if USE_LIBINPUT
-#  define LIBINPUT_NAME   "/dev/input/event0"        /*You can use the "evtest" Linux tool to get the list of devices and test them*/
+#  define LIBINPUT_NAME   "/dev/input/event2"        /*You can use the "evtest" Linux tool to get the list of devices and test them*/
 #endif  /*USE_LIBINPUT*/
 
 /*-------------------------------------------------
  * Mouse or touchpad as evdev interface (for Linux based systems)
  *------------------------------------------------*/
 #ifndef USE_EVDEV
-#  define USE_EVDEV           0
+#  define USE_EVDEV           1
 #endif
 
 #if USE_EVDEV
-#  define EVDEV_NAME   "/dev/input/event0"        /*You can use the "evtest" Linux tool to get the list of devices and test them*/
+#  define EVDEV_NAME   "/dev/input/event2"        /*You can use the "evtest" Linux tool to get the list of devices and test them*/
 #  define EVDEV_SWAP_AXES         0               /*Swap the x and y axes of the touchscreen*/
 
 #  define EVDEV_SCALE             0               /* Scale input, e.g. if touchscreen resolution does not match display resolution */
diff --git a/main.c b/main.c
index d286cc7..ea505b4 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,6 @@
 #include "lvgl/lvgl.h"
 #include "lv_drivers/display/fbdev.h"
+#include "lv_drivers/indev/evdev.h"
 #include "lv_examples/lv_examples.h"
 #include <unistd.h>
 #include <pthread.h>
@@ -30,6 +31,24 @@ int main(void)
     disp_drv.flush_cb = fbdev_flush;
     lv_disp_drv_register(&disp_drv);
 
+
+
+
+    /* Add the mouse (or touchpad) as input device
+    * Use the 'mouse' driver which reads the PC's mouse*/
+    evdev_init();
+    evdev_set_file("/dev/input/event2");
+    /* Set up touchpad input device interface */
+    lv_indev_drv_t indev_drv;
+    lv_indev_drv_init(&indev_drv);
+    indev_drv.type = LV_INDEV_TYPE_POINTER;
+    indev_drv.read_cb = evdev_read;
+    lv_indev_t *indev = lv_indev_drv_register(&indev_drv);
+
+    lv_obj_t *cursor_img = lv_img_create(lv_scr_act(), NULL);
+    lv_img_set_src(cursor_img, LV_SYMBOL_OK);
+    lv_indev_set_cursor(indev, cursor_img);
+
     /*Create a Demo*/
     lv_demo_widgets();

按上面的patch, VMWARE + Ubuntu + LittleVGL + FrameBuffer支持鼠标了

lvgl_ubuntu_framebuffer_cursor.gif

离线

楼主 #13 2020-09-23 22:41:41

明月照我沟渠
会员
注册时间: 2020-07-09
已发帖子: 120
积分: 114

Re: 学习 Linux FrameBuffer + LVGL 7.0

达克罗德 说:

这是虚拟机跑Linux?

对的, 就是Ubuntu 18.04

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn