首先你要有一个已经移植好了的工程
哔哩哔哩视频 https://b23.tv/av82484462/p1
第二步,下载这示例https://github.com/littlevgl/lv_examples
这是我已经移植好了的
这是github地址
开始移植
- 将下载的lv_examples-master复制到你的工程中,和lvgl同级目录下
- 将lv_examples-master重命名为lv_examples
- 将lv_examples文件中的lv_ex_conf_templ.h复制到lv_examples同级目录下
- 重命名lv_ex_conf_templ.h为lv_ex_conf.h,
- 打开lv_ex_conf.h,把#if 0 改成 #if 1
/**
* @file lv_ex_conf.h
*
*/
/*
* COPY THIS FILE AS lv_ex_conf.h
*/
#if 1 /*Set it to "1" to enable the content*///就是这里
#ifndef LV_EX_CONF_H
#define LV_EX_CONF_H
.....
6.启用或禁用模块lv_ex_conf.h
- 在要用到示例的文件 #include "lv_examples.h",只需要包括这个文件的路径就可以了
下面是测试
- 测试函数 lv_test_theme_1(); 要#include "lv_test_theme_1.h"
- lv_ex_conf.h-> 0文件中 改为1 如下
/*******************
* TEST USAGE
*******************/
#define LV_USE_TESTS 1
- lv_conf.h文件中 0 改为1
#define LV_USE_THEME_NIGHT 1 /*Dark elegant theme*/
4.最终添加
lv_theme_t * th = lv_theme_night_init(20, NULL);
lv_test_theme_1(th);
网友评论