Skip to content

Commit ddb2707

Browse files
Merge pull request #22 from leonardocavagnis/lvgl9_ex_porting
Porting LVGL examples to version 9
2 parents 404f22a + e82c8b3 commit ddb2707

File tree

20 files changed

+46
-5
lines changed

20 files changed

+46
-5
lines changed

examples/lvgl/button_lvgl_example/button_lvgl.ino renamed to examples/lvgl/button_lvgl/button_lvgl.ino

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ Arduino_H7_Video Display(800, 480, GigaDisplayShield);
66
Arduino_GigaDisplayTouch TouchDetector;
77

88
static void btn_event_cb(lv_event_t * e) {
9-
lv_obj_t * btn = lv_event_get_target(e);
9+
#if (LVGL_VERSION_MAJOR == 9)
10+
lv_obj_t * btn = (lv_obj_t *) lv_event_get_target(e);
11+
#else
12+
lv_obj_t * btn = lv_event_get_target(e);
13+
#endif
1014
lv_obj_t * label = lv_obj_get_child(btn, 0);
1115
lv_label_set_text_fmt(label, "Clicked!");
1216
}

examples/lvgl/image_lvgl/image_lvgl.ino

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Online image converter for LVGL v9: https://lvgl.io/tools/imageconverter_v9
3+
* Online image converter for LVGL v8 or earlier: https://lvgl.io/tools/imageconverter
4+
*/
5+
16
#include "Arduino_H7_Video.h"
27
#include "lvgl.h"
38

examples/lvgl/image_lvgl/img_arduinologo.c

+10
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,15 @@ const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_IMG_ARDUI
636636
#endif
637637
};
638638

639+
#if (LVGL_VERSION_MAJOR == 9)
640+
const lv_img_dsc_t img_arduinologo = {
641+
.header.cf = LV_COLOR_FORMAT_RGB565,
642+
.header.w = 200,
643+
.header.h = 150,
644+
.data_size = 30000 * LV_COLOR_DEPTH / 8,
645+
.data = img_arduinologo_map,
646+
};
647+
#else
639648
const lv_img_dsc_t img_arduinologo = {
640649
.header.cf = LV_IMG_CF_TRUE_COLOR,
641650
.header.always_zero = 0,
@@ -645,3 +654,4 @@ const lv_img_dsc_t img_arduinologo = {
645654
.data_size = 30000 * LV_COLOR_SIZE / 8,
646655
.data = img_arduinologo_map,
647656
};
657+
#endif

examples/lvgl/imu_orientation/img_arduinologo.c

+10
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,15 @@ const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_IMG_ARDUI
636636
#endif
637637
};
638638

639+
#if (LVGL_VERSION_MAJOR == 9)
640+
const lv_img_dsc_t img_arduinologo = {
641+
.header.cf = LV_COLOR_FORMAT_RGB565,
642+
.header.w = 200,
643+
.header.h = 150,
644+
.data_size = 30000 * LV_COLOR_DEPTH / 8,
645+
.data = img_arduinologo_map,
646+
};
647+
#else
639648
const lv_img_dsc_t img_arduinologo = {
640649
.header.cf = LV_IMG_CF_TRUE_COLOR,
641650
.header.always_zero = 0,
@@ -645,3 +654,4 @@ const lv_img_dsc_t img_arduinologo = {
645654
.data_size = 30000 * LV_COLOR_SIZE / 8,
646655
.data = img_arduinologo_map,
647656
};
657+
#endif

examples/lvgl/imu_orientation/imu_orientation.ino

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Online image converter for LVGL v9: https://lvgl.io/tools/imageconverter_v9
3+
* Online image converter for LVGL v8 or earlier: https://lvgl.io/tools/imageconverter
4+
*/
5+
16
#include "Arduino_BMI270_BMM150.h"
27
#include "Arduino_H7_Video.h"
38
#include "lvgl.h"

examples/lvgl/squarelinestudio_lvgl/README.md

-3
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
> [!NOTE]
2+
> SquareLine Studio has ended its collaboration with LVGL. It only supports LVGL version 8 and earlier.
3+
4+
# How to run the sketch:
5+
- move the `ui` folder into your `Arduino/libraries` directory
6+
- upload the sketch and see the magic!

examples/lvgl/squarelinestudio_lvgl/squarelinestudio_lvgl.ino renamed to examples/lvgl/squarelinestudio_lvgl_v8/squarelinestudio_lvgl_v8.ino

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* 1. Create a SquareLine Studio project with the following settings:
99
* - Resolution: 800x480
1010
* - Color depth: 16-bit
11-
* - LVGL version: 8.3.x
11+
* - LVGL version: 8.3.x (NOTE: It only supports LVGL version 8 and earlier.)
1212
* 2. Design your GUI using the drag-and-drop tool.
1313
* 3. Export the LVGL UI files.
1414
* 4. Open the exported file and copy the 'libraries/ui' folder into your 'Arduino/libraries' directory.
@@ -29,6 +29,10 @@
2929
Arduino_H7_Video Display(800, 480, GigaDisplayShield);
3030
Arduino_GigaDisplayTouch Touch;
3131

32+
#if (LVGL_VERSION_MAJOR >= 9)
33+
#error "SquareLine Studio has ended its collaboration with LVGL. It only supports LVGL version 8 and earlier."
34+
#endif
35+
3236
void setup() {
3337
Display.begin();
3438
Touch.begin();

0 commit comments

Comments
 (0)