新手入门
- 积分
- 14
- 金钱
- 14
- 注册时间
- 2020-1-6
- 在线时间
- 7 小时
|
楼主 |
发表于 2021-1-30 16:52:28
|
显示全部楼层
main.c
#include "delay.h"
#include "sys.h"
#include "lcd.h"
#include "touch.h"
#include "gui.h"
#include "test.h"
#include "lv_port_disp.h"
#include "lv_port_indev.h"
void lvgl_first_demo_start(void);
int main(void)
{
delay_init(168); //3õê¼»ˉÑóê±oˉêy
LCD_Init(); //òo¾§Æá3õê¼»ˉ
lv_init(); //lvgl ?????
lv_port_disp_init();
// lv_port_indev_init();
LCD_Fill(0,0,lcddev.width,lcddev.height,GREEN);
lvgl_first_demo_start();
while(1)
{
lv_tick_inc(1);
lv_task_handler();
}
}
void lvgl_first_demo_start(void)
{
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button the current screen*/
lv_obj_set_pos(btn, 1, 1); /*Set its position*/
lv_obj_set_size(btn, 12, 5); /*Set its size*/
// lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to the button*/
lv_obj_t * label = lv_label_create(btn, NULL); /*Add a label to the button*/
lv_label_set_text(label, "Button"); /*Set the labels text*/
lv_obj_t * label1 = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(label1, "Hello world!");
lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_align(btn, label1, LV_ALIGN_OUT_TOP_MID, 0, -10);
} |
|