forked from arduino-libraries/Arduino_GigaDisplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage_lvgl.ino
46 lines (31 loc) · 1.13 KB
/
image_lvgl.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Online image converter for LVGL v9: https://lvgl.io/tools/imageconverter_v9
* Online image converter for LVGL v8 or earlier: https://lvgl.io/tools/imageconverter
*/
#include "Arduino_H7_Video.h"
#include "lvgl.h"
Arduino_H7_Video Display(800, 480, GigaDisplayShield);
void setup() {
Display.begin();
lv_obj_t * screen = lv_obj_create(lv_scr_act());
lv_obj_set_size(screen, Display.width(), Display.height());
static lv_coord_t col_dsc[] = { 500, LV_GRID_TEMPLATE_LAST};
static lv_coord_t row_dsc[] = { 400, LV_GRID_TEMPLATE_LAST};
lv_obj_t * grid = lv_obj_create(lv_scr_act());
lv_obj_set_grid_dsc_array(grid, col_dsc, row_dsc);
lv_obj_set_size(grid, Display.width(), Display.height());
lv_obj_center(grid);
lv_obj_t * obj;
lv_obj_t * img1;
obj = lv_obj_create(grid);
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, 0, 1,
LV_GRID_ALIGN_STRETCH, 0, 1);
LV_IMG_DECLARE(img_arduinologo);
img1 = lv_img_create(obj);
lv_img_set_src(img1, &img_arduinologo);
lv_obj_align(img1, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_size(img1, 200, 150);
}
void loop() {
lv_timer_handler();
}