[bsp][stm32l475] update lvgl driver
This commit is contained in:
parent
f3a46a1c87
commit
0f7b99e2da
|
@ -11,13 +11,14 @@
|
||||||
#include <drv_lcd.h>
|
#include <drv_lcd.h>
|
||||||
|
|
||||||
#define MY_DISP_HOR_RES LCD_W
|
#define MY_DISP_HOR_RES LCD_W
|
||||||
|
#define DISP_BUFFER_LINES 10
|
||||||
|
|
||||||
/*A static or global variable to store the buffers*/
|
/*A static or global variable to store the buffers*/
|
||||||
static lv_disp_draw_buf_t disp_buf;
|
static lv_disp_draw_buf_t disp_buf;
|
||||||
|
|
||||||
/*Static or global buffer(s). The second buffer is optional*/
|
/*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_1[MY_DISP_HOR_RES * DISP_BUFFER_LINES];
|
||||||
static lv_color_t buf_2[MY_DISP_HOR_RES * 10];
|
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*/
|
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.*/
|
*'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)
|
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);
|
lcd_fill_array(area->x1, area->y1, area->x2, area->y2, color_p);
|
||||||
|
|
||||||
/*IMPORTANT!!!
|
/*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)
|
void lv_port_disp_init(void)
|
||||||
{
|
{
|
||||||
/*Initialize `disp_buf` with the buffer(s). With only one buffer use NULL instead buf_2 */
|
/*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*/
|
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
|
||||||
|
|
||||||
/*Set the resolution of the display*/
|
/*Set the resolution of the display*/
|
||||||
disp_drv.hor_res = MY_DISP_HOR_RES;
|
disp_drv.hor_res = LCD_W;
|
||||||
disp_drv.ver_res = MY_DISP_HOR_RES;
|
disp_drv.ver_res = LCD_H;
|
||||||
|
|
||||||
/*Set a display buffer*/
|
/*Set a display buffer*/
|
||||||
disp_drv.draw_buf = &disp_buf;
|
disp_drv.draw_buf = &disp_buf;
|
||||||
|
|
Loading…
Reference in New Issue