../GUI/lvgl/porting/lv_port_disp.c(115): error: no member named 'gpu_blend' in 'struct _disp_drv_t'; did you mean 'gpu_blend_cb'? disp_drv.gpu_blend = gpu_blend; ^~~~~~~~~ gpu_blend_cb
打开lv_conf.h文件,关闭LV_USE_GPU宏并重新编译即可解决。
继续编译,又遇到如下错误。
1 2 3
../GUI/lvgl/porting/lv_port_disp.c(154): error: use of undeclared identifier 'disp' lv_disp_flush_ready(disp); ^
voidlv_port_disp_init(void) { /*------------------------- * Initialize your display * -----------------------*/ disp_init();
/*----------------------------- * Create a buffer for drawing *----------------------------*/
/* LittlevGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row * * There are three buffering configurations: * 1. Create ONE buffer with some rows: * LittlevGL will draw the display's content here and writes it to your display * * 2. Create TWO buffer with some rows: * LittlevGL will draw the display's content to a buffer and writes it your display. * You should use DMA to write the buffer's content to the display. * It will enable LittlevGL to draw the next part of the screen to the other buffer while * the data is being sent form the first buffer. It makes rendering and flushing parallel. * * 3. Create TWO screen-sized buffer: * Similar to 2) but the buffer have to be screen sized. When LittlevGL is ready it will give the * whole frame to display. This way you only need to change the frame buffer's address instead of * copying the pixels. * */
// /* Example for 1) */ //屏蔽 // static lv_disp_buf_t disp_buf_1; // static lv_color_t buf1_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/ // lv_disp_buf_init(&disp_buf_1, buf1_1, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
/* Example for 2) */ staticlv_disp_buf_t disp_buf_2; staticlv_color_t buf2_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/ staticlv_color_t buf2_2[LV_HOR_RES_MAX * 10]; /*An other buffer for 10 rows*/ lv_disp_buf_init(&disp_buf_2, buf2_1, buf2_2, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
/*----------------------------------- * Register the display in LittlevGL *----------------------------------*/
lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/ lv_disp_drv_init(&disp_drv); /*Basic initialization*/
/*Set up the functions to access to your display*/
/*Set the resolution of the display*/ disp_drv.hor_res = 800; //修改为实际屏幕尺寸 disp_drv.ver_res = 480;
/*Used to copy the buffer's content to the display*/ disp_drv.flush_cb = disp_flush;
/*Set a display buffer*/ disp_drv.buffer = &disp_buf_2;
#if LV_USE_GPU /*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/
/*Blend two color array using opacity*/ disp_drv.gpu_blend = gpu_blend;
/*Fill a memory array with a color*/ disp_drv.gpu_fill = gpu_fill; #endif
/*Finally register the driver*/ lv_disp_drv_register(&disp_drv); }
完善disp_flush函数,添加屏幕画点函数接口。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
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); }
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); //LittleVGL心跳,1ms调用一次 /* USER CODE END SysTick_IRQn 1 */ }
/** * @file lv_ex_conf.h * */ /* * COPY THIS FILE AS lv_ex_conf.h */
#if 1 /*Set it to "1" to enable the content*/
#ifndef LV_EX_CONF_H #define LV_EX_CONF_H
/******************* * GENERAL SETTING *******************/ #define LV_EX_PRINTF 0 /*Enable printf-ing data*/ #define LV_EX_KEYBOARD 1 /*Add PC keyboard support to some examples (`lv_drivers` repository is required)*/ #define LV_EX_MOUSEWHEEL 0 /*Add 'encoder' (mouse wheel) support to some examples (`lv_drivers` repository is required)*/
/******************* * TEST USAGE *******************/ #define LV_USE_TESTS 1