MXC-A36_2024.04.18/fr3092_lvglcode/main.c

111 lines
2.7 KiB
C

/*********************
* INCLUDES
*********************/
#include <stdlib.h>
#include <unistd.h>
#include "lvgl/lvgl.h"
#include "lv_examples/src/lv_demo_widgets/lv_demo_widgets.h"
#include "lv_drivers/win32drv/win32drv.h"
#include "lv_conf.h"
#include <windows.h>
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
lv_obj_t *prj_parent_cont;
lv_obj_t *prj_prev_cont;
lv_obj_t *prj_float_cont = NULL;
lv_obj_t *prj_call_cont = NULL;
uint8_t dsp_ipc_cmd;
bool coming_call_ok;
bool call_flag;
void UpdateSysTime(void);
lv_timer_t *lvgl_main_task_timer;
/**********************
* STATIC PROTOTYPES
**********************/
static void mem_time_cb(lv_timer_t *t)
{
static uint16_t cnt=0;
static uint8_t index =0 ;
lv_mem_monitor_t mem;
lv_mem_monitor(&mem);
printf("--------%d------------mem heap size=%d, free_size=%d,used=%d\r\n",index,mem.total_size,mem.free_size,mem.total_size - mem.free_size);
cnt++;
}
void user_read_img_init(void);
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
#define TEST 1
// 定义点击事件的回调函数
static void my_obj_click_event_handler(lv_event_t *event) {
if (event->code == LV_EVENT_CLICKED) {
printf("LV_EVENT_CLICKED\r\n");
// 在这里执行点击事件触发时的操作
// 例如,可以在这里切换页面、改变对象属性等
}
}
/**********************
* GLOBAL FUNCTIONS
**********************/
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int nCmdShow)
{
/*Initialize LittlevGL*/
lv_init();
/*Initialize the HAL for LittlevGL*/
lv_win32_init(hInstance, SW_SHOWNORMAL, LV_HOR_RES_MAX, LV_VER_RES_MAX, NULL);
//lv_win32_init(hInstance, SW_SHOWNORMAL, 800, 480, NULL);
user_read_img_init();
lv_mem_monitor_t mem;
lv_mem_monitor(&mem);
printf("--------------------mem heap size=%d, free_size=%d used=%d\r\n",mem.total_size,mem.free_size,mem.total_size - mem.free_size);
//lv_timer_t *msg_hint_timer = lv_timer_create(mem_time_cb,500,NULL);
#if 1
lv_port_indev_init();
// moto_animo();
Enter_screen_id(get_root_win());
// #if !MMI_WIN32_SIM
// InitSysDateTime();
// GetCurTimeString();//Get system time
// lvgl_main_task_timer = lv_timer_create(UpdateSysTime, 1000, NULL);
// #endif
#endif
while(!lv_win32_quit_signal)
{
/* Periodically call the lv_task handler.
* It could be done in a timer interrupt or an OS task too.*/
lv_task_handler();
usleep(10000); /*Just to let the system breath*/
}
return 0;
}