在线时间796 小时
UID3067179
注册时间2014-10-23
NXP金币1063
TA的每日心情 | 开心 前天 23:45 |
---|
签到天数: 1318 天 [LV.10]以坛为家III
版主
- 积分
- 7575
- 最后登录
- 2024-4-27
|
今天来测试下使用LPC55S16芯片板卡来运行下GUI-Guider软件生成的代码.
使用的板卡是之前参与活动DIY的板卡 https://www.nxpic.org.cn/module/forum/thread-621052-1-1.html
一、GUI-Guider软件设计界面
设计过程可以看之前的帖子https://www.nxpic.org.cn/module/forum/thread-621968-1-1.html生成图形界面
1.1、设计一个带图片背景的界面
简单的图片背景上面放置两行文字。
1.2、生成代码并模拟运行
模拟运行没有问题,下面将生成的代码,放置到我的工程文件中。
二、板卡编辑工程文件
2.1、GUI-Guider软件生成的代码在项目目录下的generated里
generated文件内容
主要的代码:
- /*
- * Copyright 2021 NXP
- * SPDX-License-Identifier: MIT
- */
- #include "lvgl/lvgl.h"
- #include <stdio.h>
- #include "gui_guider.h"
- #include "events_init.h"
- void setup_scr_screen(lv_ui *ui){
- //Write codes screen
- ui->screen = lv_obj_create(NULL, NULL);
- //Write codes screen_label1
- ui->screen_label1 = lv_label_create(ui->screen, NULL);
- lv_label_set_text(ui->screen_label1, "HELLO NXPIC!");
- lv_label_set_long_mode(ui->screen_label1, LV_LABEL_LONG_BREAK);
- lv_label_set_align(ui->screen_label1, LV_LABEL_ALIGN_CENTER);
- //Write style LV_LABEL_PART_MAIN for screen_label1
- static lv_style_t style_screen_label1_main;
- lv_style_init(&style_screen_label1_main);
- //Write style state: LV_STATE_DEFAULT for style_screen_label1_main
- lv_style_set_radius(&style_screen_label1_main, LV_STATE_DEFAULT, 0);
- lv_style_set_bg_color(&style_screen_label1_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
- lv_style_set_bg_grad_color(&style_screen_label1_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
- lv_style_set_bg_grad_dir(&style_screen_label1_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
- lv_style_set_bg_opa(&style_screen_label1_main, LV_STATE_DEFAULT, 255);
- lv_style_set_text_color(&style_screen_label1_main, LV_STATE_DEFAULT, lv_color_make(0x17, 0x14, 0xe1));
- lv_style_set_text_font(&style_screen_label1_main, LV_STATE_DEFAULT, &lv_font_montserratMedium_16);
- lv_style_set_text_letter_space(&style_screen_label1_main, LV_STATE_DEFAULT, 2);
- lv_style_set_pad_left(&style_screen_label1_main, LV_STATE_DEFAULT, 0);
- lv_style_set_pad_right(&style_screen_label1_main, LV_STATE_DEFAULT, 0);
- lv_style_set_pad_top(&style_screen_label1_main, LV_STATE_DEFAULT, 0);
- lv_style_set_pad_bottom(&style_screen_label1_main, LV_STATE_DEFAULT, 0);
- lv_obj_add_style(ui->screen_label1, LV_LABEL_PART_MAIN, &style_screen_label1_main);
- lv_obj_set_pos(ui->screen_label1, 42, 40);
- lv_obj_set_size(ui->screen_label1, 156, 0);
- //Write codes screen_label2
- ui->screen_label2 = lv_label_create(ui->screen, NULL);
- lv_label_set_text(ui->screen_label2, "LVGL GUI");
- lv_label_set_long_mode(ui->screen_label2, LV_LABEL_LONG_BREAK);
- lv_label_set_align(ui->screen_label2, LV_LABEL_ALIGN_CENTER);
- //Write style LV_LABEL_PART_MAIN for screen_label2
- static lv_style_t style_screen_label2_main;
- lv_style_init(&style_screen_label2_main);
- //Write style state: LV_STATE_DEFAULT for style_screen_label2_main
- lv_style_set_radius(&style_screen_label2_main, LV_STATE_DEFAULT, 0);
- lv_style_set_bg_color(&style_screen_label2_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
- lv_style_set_bg_grad_color(&style_screen_label2_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
- lv_style_set_bg_grad_dir(&style_screen_label2_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
- lv_style_set_bg_opa(&style_screen_label2_main, LV_STATE_DEFAULT, 255);
- lv_style_set_text_color(&style_screen_label2_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
- lv_style_set_text_font(&style_screen_label2_main, LV_STATE_DEFAULT, &lv_font_montserratMedium_16);
- lv_style_set_text_letter_space(&style_screen_label2_main, LV_STATE_DEFAULT, 2);
- lv_style_set_pad_left(&style_screen_label2_main, LV_STATE_DEFAULT, 0);
- lv_style_set_pad_right(&style_screen_label2_main, LV_STATE_DEFAULT, 0);
- lv_style_set_pad_top(&style_screen_label2_main, LV_STATE_DEFAULT, 0);
- lv_style_set_pad_bottom(&style_screen_label2_main, LV_STATE_DEFAULT, 0);
- lv_obj_add_style(ui->screen_label2, LV_LABEL_PART_MAIN, &style_screen_label2_main);
- lv_obj_set_pos(ui->screen_label2, 70, 77);
- lv_obj_set_size(ui->screen_label2, 100, 0);
- }
复制代码
2.2、将generated文件复制到自己的工程文件中。
添加后,编译报错,应该是程序的代码超出芯片内存空间。
2.3、将上面GUI-Guider软件工程文件中的背景图片删除,重新生成代码
2.4、再次仿真运行下
2.5、重新将生成的项目文件generated复制到项目中,重新编译。
编译通过
三、板卡运行
|
|