基于安凯3760E的SDK-01

移植说明

下载源码:
lvgl v7.11.0.

移植及配置

  1. 复制到指定目录 lvgl_v7
  2. 在该目录下新建两个文件夹”layout“,“api”
  3. 其中layout文件中用于创建功能逻辑代码,api下用于创建模块功能
  4. 解压压缩包: tar -zxvf lvlg-7.11.0.tar.gz,并且将解压后的文件夹重新命名“lvgl”
  5. 进入lvgl目录下,将lv_conf_template.h重新命名lv_conf.h并且打开将#if 0修改位#if 1
  6. 在lvgl_v7目录下创建文件 :CMakeLists.txt,并且编辑
cmake_minimum_required (VERSION 2.8)  
#cmake最低使用版本
#编译工具链的路径
set(CMAKE_C_COMPILER "/opt/arm-anykav500-linux-uclibcgnueabi/usr/bin/arm-anykav500-linux-uclibcgnueabi-gcc")
set(CMAKE_CXX_COMPILER "/opt/arm-anykav500-linux-uclibcgnueabi/usr/bin/arm-anykav500-linux-uclibcgnueabi-g++")
#执行文件命名
SET(leo_proj ANYKA37EOS)
#add_definitions(-DLV_CONF_INCLUDE_SIMPLE )
project(${leo_proj})
#工程名

SET(CMAKE_BUILD_TYPE "Release")
SET(CMAKE_C_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall -std=gnu11")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall -std=c++1y")


find_package(Threads)

aux_source_directory(./layout DIR_SRCS)

include_directories(./) 

#添加目录
add_subdirectory(lvgl)
#add_subdirectory(layout)
add_subdirectory(api)


set(VAR ${VAR} lvgl)
set(VAR ${VAR} api)

add_executable(${leo_proj} ${DIR_SRCS})

message("VAR : ${VAR}")
target_link_libraries(${leo_proj} ${VAR}) 

  1. 在api目录下新建”CMakeLists.txt“
file(GLOB_RECURSE SOURCES ./*.c  ./*.cpp)

add_library(api ${SOURCES} )

编译说明

在lvgl_v7 目录下输入命令:cmake .
然后make
在目录下生成执行文件:”ANYKA37EOS“

功能模块配置

配置lv_conf.h

#define LV_HOR_RES_MAX          (480)
#define LV_VER_RES_MAX          (320)

/* Color depth:
 * - 1:  1 byte per pixel
 * - 8:  RGB332
 * - 16: RGB565
 * - 32: ARGB8888
 */
#define LV_COLOR_DEPTH     16

/* Swap the 2 bytes of RGB565 color.
 * Useful if the display has a 8 bit interface (e.g. SPI)*/
#define LV_COLOR_16_SWAP   0

/* 1: Enable screen transparency.
 * Useful for OSD or other overlapping GUIs.
 * Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/
#define LV_COLOR_SCREEN_TRANSP    0

#define LV_DISP_DEF_REFR_PERIOD      30      /*[ms]*/

lvgl初始化配置

  1. 系统初始化.
static void* lvlg_titck_task(void* arg)
{
	struct ak_timeval tv1,tv2;
	while(1)
	{
		ak_get_ostime(&tv1);
		lv_tick_inc(tv1.sec*1000 + tv1.usec/1000 - tv2.sec*1000 - tv2.usec/1000);
		ak_get_ostime(&tv2);
		ak_sleep_ms(1);
	}
}

int main(int argc,char** argv)
{
 	/*lvgl 系统初始化*/
	lv_init();
	
	/*显示设备初始化*/
	lv_port_disp_init();
	
	/* 输入设备初始化*/
	lv_port_indev_int();
	
	/*跳转到当前显示页面*/
	goto_layout(pLayout(home));
	
	ak_ptrhread_t thread_id;
	ak_thread_create(&thread_id,lvlg_titck_task,NULL,lvlg_titck_task);
	while(1)
	{
		/*系统任务调度*/
		lv_task_handler();
		ak_sleep_ms(1);
	}
	return 0;
}

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>