Skip to content

Commit d9d24d7

Browse files
committed
chore: add lvgl 9.1 UI files
1 parent de47486 commit d9d24d7

28 files changed

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

examples/lvgl/squarelinestudio_lvgl_v8/squarelinestudio_lvgl_v8.ino examples/lvgl/squarelinestudio_lvgl/squarelinestudio_lvgl.ino

+2-6
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 (NOTE: It only supports LVGL version 8 and earlier.)
11+
* - LVGL version: 9.1
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.
@@ -23,16 +23,12 @@
2323
#include "Arduino_GigaDisplayTouch.h"
2424

2525
#include "lvgl.h"
26-
#include "ui.h"
26+
#include "ui/ui.h"
2727

2828
/* Initialize the GIGA Display Shield with a resolution of 800x480 pixels */
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-
3632
void setup() {
3733
Display.begin();
3834
Touch.begin();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name=ui
2+
version=1.0
3+
author=SquareLine_Studio
4+
category=Display
5+
url=https://squareline.io
6+
architectures=*
7+
includes=ui.h
8+
sentence=SquareLine_Studio
9+
paragraph=Squareline Studio creates smart, user-friendly LVGL UI solutions.
10+
name=ui
11+
maintainer=Squareline Studio
12+
maintainer_email=contact@squareline.io
13+
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
SET(SOURCES ui_comp_button.c
2+
ui_comp.c
3+
ui_Screen1.c
4+
ui.c
5+
ui_comp_hook.c
6+
ui_helpers.c
7+
ui_events.c)
8+
9+
add_library(ui ${SOURCES})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ui_comp_button.c
2+
ui_comp.c
3+
ui_Screen1.c
4+
ui.c
5+
ui_comp_hook.c
6+
ui_helpers.c
7+
ui_events.c
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// This file was generated by SquareLine Studio
2+
// SquareLine Studio version: SquareLine Studio 1.4.1
3+
// LVGL version: 9.1.0
4+
// Project name: SquareLine_Project
5+
6+
#include "ui.h"
7+
#include "ui_helpers.h"
8+
9+
///////////////////// VARIABLES ////////////////////
10+
11+
12+
// SCREEN: ui_Screen1
13+
void ui_Screen1_screen_init(void);
14+
lv_obj_t * ui_Screen1;
15+
lv_obj_t * ui_Button;
16+
lv_obj_t * ui_Label1;
17+
lv_obj_t * ui____initial_actions0;
18+
19+
///////////////////// TEST LVGL SETTINGS ////////////////////
20+
#if LV_COLOR_DEPTH != 16
21+
#error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings"
22+
#endif
23+
24+
///////////////////// ANIMATIONS ////////////////////
25+
26+
///////////////////// FUNCTIONS ////////////////////
27+
28+
///////////////////// SCREENS ////////////////////
29+
30+
void ui_init(void)
31+
{
32+
LV_EVENT_GET_COMP_CHILD = lv_event_register_id();
33+
34+
lv_disp_t * dispp = lv_display_get_default();
35+
lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED),
36+
false, LV_FONT_DEFAULT);
37+
lv_disp_set_theme(dispp, theme);
38+
ui_Screen1_screen_init();
39+
ui____initial_actions0 = lv_obj_create(NULL);
40+
lv_disp_load_scr(ui_Screen1);
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// This file was generated by SquareLine Studio
2+
// SquareLine Studio version: SquareLine Studio 1.4.1
3+
// LVGL version: 9.1.0
4+
// Project name: SquareLine_Project
5+
6+
#ifndef _SQUARELINE_PROJECT_UI_H
7+
#define _SQUARELINE_PROJECT_UI_H
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
#if defined __has_include
14+
#if __has_include("lvgl.h")
15+
#include "lvgl.h"
16+
#elif __has_include("lvgl/lvgl.h")
17+
#include "lvgl/lvgl.h"
18+
#else
19+
#include "lvgl.h"
20+
#endif
21+
#else
22+
#include "lvgl.h"
23+
#endif
24+
25+
#include "ui_helpers.h"
26+
#include "ui_comp.h"
27+
#include "ui_comp_hook.h"
28+
#include "ui_events.h"
29+
30+
// SCREEN: ui_Screen1
31+
void ui_Screen1_screen_init(void);
32+
extern lv_obj_t * ui_Screen1;
33+
extern lv_obj_t * ui_Button;
34+
extern lv_obj_t * ui_Label1;
35+
extern lv_obj_t * ui____initial_actions0;
36+
37+
38+
39+
40+
41+
42+
43+
44+
void ui_init(void);
45+
46+
#ifdef __cplusplus
47+
} /*extern "C"*/
48+
#endif
49+
50+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// This file was generated by SquareLine Studio
2+
// SquareLine Studio version: SquareLine Studio 1.4.1
3+
// LVGL version: 9.1.0
4+
// Project name: SquareLine_Project
5+
6+
#include "ui.h"
7+
8+
void ui_Screen1_screen_init(void)
9+
{
10+
ui_Screen1 = lv_obj_create(NULL);
11+
lv_obj_remove_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
12+
13+
ui_Button = ui_Button_create(ui_Screen1);
14+
lv_obj_set_width(ui_Button, lv_pct(30));
15+
lv_obj_set_height(ui_Button, lv_pct(20));
16+
lv_obj_set_x(ui_Button, 0);
17+
lv_obj_set_y(ui_Button, -3);
18+
19+
ui_Label1 = lv_label_create(ui_Button);
20+
lv_obj_set_width(ui_Label1, lv_pct(100));
21+
lv_obj_set_height(ui_Label1, lv_pct(100));
22+
lv_obj_set_x(ui_Label1, 18);
23+
lv_obj_set_y(ui_Label1, 11);
24+
lv_obj_set_align(ui_Label1, LV_ALIGN_CENTER);
25+
lv_label_set_text(ui_Label1, "Button");
26+
lv_obj_set_style_text_font(ui_Label1, &lv_font_montserrat_46, LV_PART_MAIN | LV_STATE_DEFAULT);
27+
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// This file was generated by SquareLine Studio
2+
// SquareLine Studio version: SquareLine Studio 1.4.1
3+
// LVGL version: 9.1.0
4+
// Project name: SquareLine_Project
5+
6+
#include "ui.h"
7+
#include "ui_helpers.h"
8+
#include "ui_comp.h"
9+
10+
uint32_t LV_EVENT_GET_COMP_CHILD;
11+
12+
typedef struct {
13+
uint32_t child_idx;
14+
lv_obj_t * child;
15+
} ui_comp_get_child_t;
16+
17+
lv_obj_t * ui_comp_get_child(lv_obj_t * comp, uint32_t child_idx)
18+
{
19+
ui_comp_get_child_t info;
20+
info.child = NULL;
21+
info.child_idx = child_idx;
22+
lv_obj_send_event(comp, LV_EVENT_GET_COMP_CHILD, &info);
23+
return info.child;
24+
}
25+
26+
void get_component_child_event_cb(lv_event_t * e)
27+
{
28+
lv_obj_t ** c = lv_event_get_user_data(e);
29+
ui_comp_get_child_t * info = lv_event_get_param(e);
30+
info->child = c[info->child_idx];
31+
}
32+
33+
void del_component_child_event_cb(lv_event_t * e)
34+
{
35+
lv_obj_t ** c = lv_event_get_user_data(e);
36+
lv_free(c);
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// This file was generated by SquareLine Studio
2+
// SquareLine Studio version: SquareLine Studio 1.4.1
3+
// LVGL version: 9.1.0
4+
// Project name: SquareLine_Project
5+
6+
#ifndef _UI_COMP__H
7+
#define _UI_COMP__H
8+
9+
#include "ui.h"
10+
11+
#ifdef __cplusplus
12+
extern "C" {
13+
#endif
14+
15+
void get_component_child_event_cb(lv_event_t * e);
16+
void del_component_child_event_cb(lv_event_t * e);
17+
18+
lv_obj_t * ui_comp_get_child(lv_obj_t * comp, uint32_t child_idx);
19+
extern uint32_t LV_EVENT_GET_COMP_CHILD;
20+
#include "ui_comp_button.h"
21+
22+
#ifdef __cplusplus
23+
} /*extern "C"*/
24+
#endif
25+
26+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// This file was generated by SquareLine Studio
2+
// SquareLine Studio version: SquareLine Studio 1.4.1
3+
// LVGL version: 9.1.0
4+
// Project name: SquareLine_Project
5+
6+
#include "ui.h"
7+
8+
9+
// COMPONENT Button
10+
11+
lv_obj_t * ui_Button_create(lv_obj_t * comp_parent)
12+
{
13+
14+
lv_obj_t * cui_Button;
15+
cui_Button = lv_button_create(comp_parent);
16+
lv_obj_set_width(cui_Button, 100);
17+
lv_obj_set_height(cui_Button, 50);
18+
lv_obj_set_x(cui_Button, 0);
19+
lv_obj_set_y(cui_Button, -3);
20+
lv_obj_set_align(cui_Button, LV_ALIGN_CENTER);
21+
lv_obj_add_flag(cui_Button, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
22+
lv_obj_remove_flag(cui_Button, LV_OBJ_FLAG_SCROLLABLE); /// Flags
23+
24+
lv_obj_t ** children = lv_malloc(sizeof(lv_obj_t *) * _UI_COMP_BUTTON_NUM);
25+
children[UI_COMP_BUTTON_BUTTON] = cui_Button;
26+
lv_obj_add_event_cb(cui_Button, get_component_child_event_cb, LV_EVENT_GET_COMP_CHILD, children);
27+
lv_obj_add_event_cb(cui_Button, del_component_child_event_cb, LV_EVENT_DELETE, children);
28+
ui_comp_Button_create_hook(cui_Button);
29+
return cui_Button;
30+
}
31+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// This file was generated by SquareLine Studio
2+
// SquareLine Studio version: SquareLine Studio 1.4.1
3+
// LVGL version: 9.1.0
4+
// Project name: SquareLine_Project
5+
6+
#ifndef _UI_COMP_BUTTON_H
7+
#define _UI_COMP_BUTTON_H
8+
9+
#include "ui.h"
10+
11+
#ifdef __cplusplus
12+
extern "C" {
13+
#endif
14+
15+
// COMPONENT Button
16+
#define UI_COMP_BUTTON_BUTTON 0
17+
#define _UI_COMP_BUTTON_NUM 1
18+
lv_obj_t * ui_Button_create(lv_obj_t * comp_parent);
19+
20+
#ifdef __cplusplus
21+
} /*extern "C"*/
22+
#endif
23+
24+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This file was generated by SquareLine Studio
2+
// SquareLine Studio version: SquareLine Studio 1.4.1
3+
// LVGL version: 9.1.0
4+
// Project name: SquareLine_Project
5+
6+
#include "ui.h"
7+
8+
void ui_comp_Button_create_hook(lv_obj_t * comp)
9+
{
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// This file was generated by SquareLine Studio
2+
// SquareLine Studio version: SquareLine Studio 1.4.1
3+
// LVGL version: 9.1.0
4+
// Project name: SquareLine_Project
5+
6+
#ifndef _SQUARELINE_PROJECT_UI_COMP_HOOK_H
7+
#define _SQUARELINE_PROJECT_UI_COMP_HOOK_H
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
void ui_comp_Button_create_hook(lv_obj_t * comp);
14+
15+
#ifdef __cplusplus
16+
} /*extern "C"*/
17+
#endif
18+
19+
#endif

examples/lvgl/squarelinestudio_lvgl_v8/ui/src/ui_events.h examples/lvgl/squarelinestudio_lvgl/ui/src/ui_events.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This file was generated by SquareLine Studio
2-
// SquareLine Studio version: SquareLine Studio 1.3.2
3-
// LVGL version: 8.3.6
4-
// Project name: ButtonTest
2+
// SquareLine Studio version: SquareLine Studio 1.4.1
3+
// LVGL version: 9.1.0
4+
// Project name: SquareLine_Project
55

66
#ifndef _UI_EVENTS_H
77
#define _UI_EVENTS_H

0 commit comments

Comments
 (0)