Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting LVGL examples to version 9 #22

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ Arduino_H7_Video Display(800, 480, GigaDisplayShield);
Arduino_GigaDisplayTouch TouchDetector;

static void btn_event_cb(lv_event_t * e) {
lv_obj_t * btn = lv_event_get_target(e);
#if (LVGL_VERSION_MAJOR == 9)
lv_obj_t * btn = (lv_obj_t *) lv_event_get_target(e);
#else
lv_obj_t * btn = lv_event_get_target(e);
#endif
lv_obj_t * label = lv_obj_get_child(btn, 0);
lv_label_set_text_fmt(label, "Clicked!");
}
Expand Down
5 changes: 5 additions & 0 deletions examples/lvgl/image_lvgl/image_lvgl.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* 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"

Expand Down
10 changes: 10 additions & 0 deletions examples/lvgl/image_lvgl/img_arduinologo.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,15 @@ const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_IMG_ARDUI
#endif
};

#if (LVGL_VERSION_MAJOR == 9)
const lv_img_dsc_t img_arduinologo = {
.header.cf = LV_COLOR_FORMAT_RGB565,
.header.w = 200,
.header.h = 150,
.data_size = 30000 * LV_COLOR_DEPTH / 8,
.data = img_arduinologo_map,
};
#else
const lv_img_dsc_t img_arduinologo = {
.header.cf = LV_IMG_CF_TRUE_COLOR,
.header.always_zero = 0,
Expand All @@ -645,3 +654,4 @@ const lv_img_dsc_t img_arduinologo = {
.data_size = 30000 * LV_COLOR_SIZE / 8,
.data = img_arduinologo_map,
};
#endif
10 changes: 10 additions & 0 deletions examples/lvgl/imu_orientation/img_arduinologo.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,15 @@ const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_IMG_ARDUI
#endif
};

#if (LVGL_VERSION_MAJOR == 9)
const lv_img_dsc_t img_arduinologo = {
.header.cf = LV_COLOR_FORMAT_RGB565,
.header.w = 200,
.header.h = 150,
.data_size = 30000 * LV_COLOR_DEPTH / 8,
.data = img_arduinologo_map,
};
#else
const lv_img_dsc_t img_arduinologo = {
.header.cf = LV_IMG_CF_TRUE_COLOR,
.header.always_zero = 0,
Expand All @@ -645,3 +654,4 @@ const lv_img_dsc_t img_arduinologo = {
.data_size = 30000 * LV_COLOR_SIZE / 8,
.data = img_arduinologo_map,
};
#endif
5 changes: 5 additions & 0 deletions examples/lvgl/imu_orientation/imu_orientation.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* 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_BMI270_BMM150.h"
#include "Arduino_H7_Video.h"
#include "lvgl.h"
Expand Down
3 changes: 0 additions & 3 deletions examples/lvgl/squarelinestudio_lvgl/README.md

This file was deleted.

6 changes: 6 additions & 0 deletions examples/lvgl/squarelinestudio_lvgl_v8/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
> [!NOTE]
> SquareLine Studio has ended its collaboration with LVGL. It only supports LVGL version 8 and earlier.

# How to run the sketch:
- move the `ui` folder into your `Arduino/libraries` directory
- upload the sketch and see the magic!
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 1. Create a SquareLine Studio project with the following settings:
* - Resolution: 800x480
* - Color depth: 16-bit
* - LVGL version: 8.3.x
* - LVGL version: 8.3.x (NOTE: It only supports LVGL version 8 and earlier.)
* 2. Design your GUI using the drag-and-drop tool.
* 3. Export the LVGL UI files.
* 4. Open the exported file and copy the 'libraries/ui' folder into your 'Arduino/libraries' directory.
Expand All @@ -29,6 +29,10 @@
Arduino_H7_Video Display(800, 480, GigaDisplayShield);
Arduino_GigaDisplayTouch Touch;

#if (LVGL_VERSION_MAJOR >= 9)
#error "SquareLine Studio has ended its collaboration with LVGL. It only supports LVGL version 8 and earlier."
#endif

void setup() {
Display.begin();
Touch.begin();
Expand Down
Loading