Skip to content

Commit 0f7b99e

Browse files
committed
[bsp][stm32l475] update lvgl driver
1 parent f3a46a1 commit 0f7b99e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

bsp/stm32/stm32l475-atk-pandora/board/ports/lvgl/lv_port_disp.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
#include <drv_lcd.h>
1212

1313
#define MY_DISP_HOR_RES LCD_W
14+
#define DISP_BUFFER_LINES 10
1415

1516
/*A static or global variable to store the buffers*/
1617
static lv_disp_draw_buf_t disp_buf;
1718

1819
/*Static or global buffer(s). The second buffer is optional*/
19-
static lv_color_t buf_1[MY_DISP_HOR_RES * 10];
20-
static lv_color_t buf_2[MY_DISP_HOR_RES * 10];
20+
static lv_color_t buf_1[MY_DISP_HOR_RES * DISP_BUFFER_LINES];
21+
static lv_color_t buf_2[MY_DISP_HOR_RES * DISP_BUFFER_LINES];
2122

2223
static lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
2324

@@ -26,6 +27,7 @@ static lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
2627
*'lv_disp_flush_ready()' has to be called when finished.*/
2728
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
2829
{
30+
/* color_p is a buffer pointer; the buffer is provided by LVGL */
2931
lcd_fill_array(area->x1, area->y1, area->x2, area->y2, color_p);
3032

3133
/*IMPORTANT!!!
@@ -36,13 +38,13 @@ static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_colo
3638
void lv_port_disp_init(void)
3739
{
3840
/*Initialize `disp_buf` with the buffer(s). With only one buffer use NULL instead buf_2 */
39-
lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, MY_DISP_HOR_RES*10);
41+
lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, MY_DISP_HOR_RES * DISP_BUFFER_LINES);
4042

4143
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
4244

4345
/*Set the resolution of the display*/
44-
disp_drv.hor_res = MY_DISP_HOR_RES;
45-
disp_drv.ver_res = MY_DISP_HOR_RES;
46+
disp_drv.hor_res = LCD_W;
47+
disp_drv.ver_res = LCD_H;
4648

4749
/*Set a display buffer*/
4850
disp_drv.draw_buf = &disp_buf;

0 commit comments

Comments
 (0)