../GUI/lvgl/demos/widgets/assets/img_lvgl_logo.c(1): error: '../../../lvgl.h' file not found, did you mean 'lvgl.h'? #include "../../../lvgl.h" ^~~~~~~~~~~~~~~~~ "lvgl.h"
/*Show some widget. It might be required to increase `LV_MEM_SIZE` */ #define LV_USE_DEMO_WIDGETS 1 #if LV_USE_DEMO_WIDGETS #define LV_DEMO_WIDGETS_SLIDESHOW 0 #endif
/*Flush the content of the internal buffer the specific area on the display *You can use DMA or any hardware acceleration to do this operation in the background but *'lv_disp_flush_ready()' has to be called when finished.*/ staticvoiddisp_flush(lv_disp_drv_t * disp_drv, constlv_area_t * area, lv_color_t * color_p) { /*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/
int32_t x; int32_t y; for(y = area->y1; y <= area->y2; y++) { for(x = area->x1; x <= area->x2; x++) { /*Put a pixel to the display. For example:*/ /*put_px(x, y, *color_p)*/ LTDC_Disp_Point(x, y, *(uint16_t*)color_p); //屏幕画点函数 color_p++; } }
/*IMPORTANT!!! *Inform the graphics library that you are ready with the flushing*/ lv_disp_flush_ready(disp_drv); }
添加lvgl心跳
直接利用滴答定时器产生心跳。
1 2 3 4 5 6 7 8 9 10
voidSysTick_Handler(void) { /* USER CODE BEGIN SysTick_IRQn 0 */
/* USER CODE END SysTick_IRQn 0 */ HAL_IncTick(); /* USER CODE BEGIN SysTick_IRQn 1 */ lv_tick_inc(1); //lvgl心跳 /* USER CODE END SysTick_IRQn 1 */ }
voidlv_port_indev_init(void) { /** * Here you will find example implementation of input devices supported by LittelvGL: * - Touchpad * - Mouse (with cursor support) * - Keypad (supports GUI usage only with key) * - Encoder (supports GUI usage only with: left, right, push) * - Button (external buttons to press points on the screen) * * The `..._read()` function are only examples. * You should shape them according to your hardware */
// /*Set cursor. For simplicity set a HOME symbol now.*/ // lv_obj_t * mouse_cursor = lv_img_create(lv_scr_act()); // lv_img_set_src(mouse_cursor, LV_SYMBOL_HOME); // lv_indev_set_cursor(indev_mouse, mouse_cursor);
// /*Later you should create group(s) with `lv_group_t * group = lv_group_create()`, // *add objects to the group with `lv_group_add_obj(group, obj)` // *and assign this input device to group to navigate in it: // *`lv_indev_set_group(indev_keypad, group);`*/
// /*Later you should create group(s) with `lv_group_t * group = lv_group_create()`, // *add objects to the group with `lv_group_add_obj(group, obj)` // *and assign this input device to group to navigate in it: // *`lv_indev_set_group(indev_encoder, group);`*/