对main.c文件进行操作
添加LVGL相关头文件
加入LVGL测试程序
#include "main.h"
#include "NZ_BitBand.h"
#include "delay.h"
#include "time.h"
#include "lcd.h"
#include "lvgl.h"
#include "lv_port_disp.h"
void lv_example_led_1(void)
{
/*Create a LED and switch it OFF*/
lv_obj_t * led1 = lv_led_create(lv_scr_act());
lv_obj_align(led1, LV_ALIGN_CENTER, -80, 0);
lv_led_off(led1);
/*Copy the previous LED and set a brightness*/
lv_obj_t * led2 = lv_led_create(lv_scr_act());
lv_obj_align(led2, LV_ALIGN_TOP_LEFT, 0, 0);
lv_led_set_brightness(led2, 150);
lv_led_set_color(led2, lv_palette_main(LV_PALETTE_RED));
/*Copy the previous LED and switch it ON*/
lv_obj_t * led3 = lv_led_create(lv_scr_act());
lv_obj_align(led3, LV_ALIGN_CENTER, 80, 0);
lv_led_on(led3);
}
int main(void)
{
TIME_Configuration_Init(5,5999);
LCD_Init();
lv_init(); // lvgl系统初始化
lv_port_disp_init(); // lvgl显示接口初始化,放在lv_init()的后面
lv_example_led_1();
while(1)
{
lv_task_handler(); // lvgl的事务处理
}
}
|