未验证 提交 ef05ecf7 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #5275 from mysterywolf/l745

[bsp][stm32l475] update lvgl driver
......@@ -11,13 +11,14 @@
#include <drv_lcd.h>
#define MY_DISP_HOR_RES LCD_W
#define DISP_BUFFER_LINES 10
/*A static or global variable to store the buffers*/
static lv_disp_draw_buf_t disp_buf;
/*Static or global buffer(s). The second buffer is optional*/
static lv_color_t buf_1[MY_DISP_HOR_RES * 10];
static lv_color_t buf_2[MY_DISP_HOR_RES * 10];
static lv_color_t buf_1[MY_DISP_HOR_RES * DISP_BUFFER_LINES];
static lv_color_t buf_2[MY_DISP_HOR_RES * DISP_BUFFER_LINES];
static lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
......@@ -26,6 +27,7 @@ static lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
*'lv_disp_flush_ready()' has to be called when finished.*/
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
/* color_p is a buffer pointer; the buffer is provided by LVGL */
lcd_fill_array(area->x1, area->y1, area->x2, area->y2, color_p);
/*IMPORTANT!!!
......@@ -36,13 +38,13 @@ static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_colo
void lv_port_disp_init(void)
{
/*Initialize `disp_buf` with the buffer(s). With only one buffer use NULL instead buf_2 */
lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, MY_DISP_HOR_RES*10);
lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, MY_DISP_HOR_RES * DISP_BUFFER_LINES);
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
/*Set the resolution of the display*/
disp_drv.hor_res = MY_DISP_HOR_RES;
disp_drv.ver_res = MY_DISP_HOR_RES;
disp_drv.hor_res = LCD_W;
disp_drv.ver_res = LCD_H;
/*Set a display buffer*/
disp_drv.draw_buf = &disp_buf;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册