avatar

松果工作室

欢迎光临

  • 首页
  • freeRTOS
  • ESP
  • 开发手册
  • 快速笔记
  • 个人收藏
  • 工具
Home LVGL 移植
文章

LVGL 移植

Posted 2024-04-3 Updated 2024-04- 3
By YCP
9~12 min read

LVGL源码

https://github.com/lvgl/lvgl/tree/release/v8.3

主要文件

// 其余文件根据自己需要
- examples
- env_support
- src
lv_conf.h
lvgl.h

接口对接

examples中port文件夹,其中有显示接口,触控接口
将需要的对接文件复制到根目录,并改文件中的 #if 0为#if 1

显示对接

定义屏幕尺寸在 lv_conf.h

#define MY_DISP_HOR_RES 240
#define MY_DISP_VER_RES 240

双缓存刷新和单缓存刷新在lv_port_disp.c第 87 行
对接画点函数在lv_port_disp.c第 167 行

输入对接

例子

#include <math.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "sdkconfig.h"

#include "GC9A01.h"
#include "LVGL/lvgl.h"
#include "lv_port_disp.h"
#include "benchmark/lv_demo_benchmark.h"
#include "ui.h"


void lv_ex_label(void) {
	lv_obj_t *label = lv_label_create(lv_scr_act());//创建一个标签
	lv_label_set_recolor(label, true);//通过内联命令启用重新着色
	lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR);//使用比对象大小更长的文本设置标签的行为
	lv_obj_set_width(label, 240);
	lv_label_set_text_fmt(label, "#ff0000 6666666666666666666666666666666666666666666666#");
	lv_obj_align(label, LV_ALIGN_CENTER, 0, 10);//对齐方式
}

void LCD(void * arg)
{
	lv_init();
	lv_port_disp_init();
	//lv_demo_benchmark();
	//lv_ex_label();
    ui_init();
	while (vTaskDelay(1),true)
	{
		lv_task_handler();
		GC9A01_Update();
	}
}
void lv_tick_task() {
	lv_tick_inc(10);
}
void app_main(void)
{
	const esp_timer_create_args_t periodic_timer_args = {
			.callback = &lv_tick_task,
			.name = "periodic_gui"
	};
	esp_timer_handle_t periodic_timer;
	esp_timer_create(&periodic_timer_args, &periodic_timer);
	esp_timer_start_periodic(periodic_timer, 10000);

	xTaskCreate(LCD, "Test LCD", 24 * 1024, NULL, tskIDLE_PRIORITY, NULL);
坑和笔记
ESP
License:  CC BY 4.0
Share

Further Reading

Dec 23, 2024

其他笔记

EC800K AT连接移远云 配置过程 # 配置产品信息(初次连接需配置) AT+QIOTCFG="productinfo","pxxxxt","cDVTxxxxxxxxWGVB" # 连接开发者中心 AT+QIOTREG=1 # 查询当前连接状态(+QIOTSTATE: 8为正常) AT+QI

Jun 21, 2024

环形滤波算法

#include <stdio.h> #include <stdlib.h> #define BUFFER_SIZE 10 // 缓冲区大小 #define THRESHOLD 180

Jun 17, 2024

STM32 ADC采集的三种方式

采样周期 单个采集模式 ADC_Settings: 程序使用 uint16_t ADC_Read(

OLDER

算丰学院

NEWER

LVGL 创建对象

Recently Updated

  • ESP32(八) 简单的webserver
  • ESP32(七) NVS
  • ESP32(四) STA & AP
  • 多级菜单
  • ESP32(五) ESP32 OTA

Trending Tags

WCH Linux Elec freeRTOS STM ESP Flutter Others SwiftUI

Contents

©2025 松果工作室. Some rights reserved.

Using the Halo theme Chirpy