-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from aliphys/squarelineStudioLVGL9
Update Squareline Studio example to LVGL 9.1
- Loading branch information
Showing
28 changed files
with
797 additions
and
522 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
...s/lvgl/squarelinestudio_lvgl_v8/README.md → ...ples/lvgl/squarelinestudio_lvgl/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
> [!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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name=ui | ||
version=1.0 | ||
author=SquareLine_Studio | ||
category=Display | ||
url=https://squareline.io | ||
architectures=* | ||
includes=ui.h | ||
sentence=SquareLine_Studio | ||
paragraph=Squareline Studio creates smart, user-friendly LVGL UI solutions. | ||
name=ui | ||
maintainer=Squareline Studio | ||
maintainer_email=contact@squareline.io | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
SET(SOURCES ui_comp_button.c | ||
ui_comp.c | ||
ui_Screen1.c | ||
ui.c | ||
ui_comp_hook.c | ||
ui_helpers.c | ||
ui_events.c) | ||
|
||
add_library(ui ${SOURCES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ui_comp_button.c | ||
ui_comp.c | ||
ui_Screen1.c | ||
ui.c | ||
ui_comp_hook.c | ||
ui_helpers.c | ||
ui_events.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// This file was generated by SquareLine Studio | ||
// SquareLine Studio version: SquareLine Studio 1.4.1 | ||
// LVGL version: 9.1.0 | ||
// Project name: SquareLine_Project | ||
|
||
#include "ui.h" | ||
#include "ui_helpers.h" | ||
|
||
///////////////////// VARIABLES //////////////////// | ||
|
||
|
||
// SCREEN: ui_Screen1 | ||
void ui_Screen1_screen_init(void); | ||
lv_obj_t * ui_Screen1; | ||
lv_obj_t * ui_Button; | ||
lv_obj_t * ui_Label1; | ||
lv_obj_t * ui____initial_actions0; | ||
|
||
///////////////////// TEST LVGL SETTINGS //////////////////// | ||
#if LV_COLOR_DEPTH != 16 | ||
#error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" | ||
#endif | ||
|
||
///////////////////// ANIMATIONS //////////////////// | ||
|
||
///////////////////// FUNCTIONS //////////////////// | ||
|
||
///////////////////// SCREENS //////////////////// | ||
|
||
void ui_init(void) | ||
{ | ||
LV_EVENT_GET_COMP_CHILD = lv_event_register_id(); | ||
|
||
lv_disp_t * dispp = lv_display_get_default(); | ||
lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), | ||
false, LV_FONT_DEFAULT); | ||
lv_disp_set_theme(dispp, theme); | ||
ui_Screen1_screen_init(); | ||
ui____initial_actions0 = lv_obj_create(NULL); | ||
lv_disp_load_scr(ui_Screen1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// This file was generated by SquareLine Studio | ||
// SquareLine Studio version: SquareLine Studio 1.4.1 | ||
// LVGL version: 9.1.0 | ||
// Project name: SquareLine_Project | ||
|
||
#ifndef _SQUARELINE_PROJECT_UI_H | ||
#define _SQUARELINE_PROJECT_UI_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#if defined __has_include | ||
#if __has_include("lvgl.h") | ||
#include "lvgl.h" | ||
#elif __has_include("lvgl/lvgl.h") | ||
#include "lvgl/lvgl.h" | ||
#else | ||
#include "lvgl.h" | ||
#endif | ||
#else | ||
#include "lvgl.h" | ||
#endif | ||
|
||
#include "ui_helpers.h" | ||
#include "ui_comp.h" | ||
#include "ui_comp_hook.h" | ||
#include "ui_events.h" | ||
|
||
// SCREEN: ui_Screen1 | ||
void ui_Screen1_screen_init(void); | ||
extern lv_obj_t * ui_Screen1; | ||
extern lv_obj_t * ui_Button; | ||
extern lv_obj_t * ui_Label1; | ||
extern lv_obj_t * ui____initial_actions0; | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
void ui_init(void); | ||
|
||
#ifdef __cplusplus | ||
} /*extern "C"*/ | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// This file was generated by SquareLine Studio | ||
// SquareLine Studio version: SquareLine Studio 1.4.1 | ||
// LVGL version: 9.1.0 | ||
// Project name: SquareLine_Project | ||
|
||
#include "ui.h" | ||
|
||
void ui_Screen1_screen_init(void) | ||
{ | ||
ui_Screen1 = lv_obj_create(NULL); | ||
lv_obj_remove_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE); /// Flags | ||
|
||
ui_Button = ui_Button_create(ui_Screen1); | ||
lv_obj_set_width(ui_Button, lv_pct(30)); | ||
lv_obj_set_height(ui_Button, lv_pct(20)); | ||
lv_obj_set_x(ui_Button, 0); | ||
lv_obj_set_y(ui_Button, -3); | ||
|
||
ui_Label1 = lv_label_create(ui_Button); | ||
lv_obj_set_width(ui_Label1, lv_pct(100)); | ||
lv_obj_set_height(ui_Label1, lv_pct(100)); | ||
lv_obj_set_x(ui_Label1, 18); | ||
lv_obj_set_y(ui_Label1, 11); | ||
lv_obj_set_align(ui_Label1, LV_ALIGN_CENTER); | ||
lv_label_set_text(ui_Label1, "Button"); | ||
lv_obj_set_style_text_font(ui_Label1, &lv_font_montserrat_14, LV_PART_MAIN | LV_STATE_DEFAULT); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// This file was generated by SquareLine Studio | ||
// SquareLine Studio version: SquareLine Studio 1.4.1 | ||
// LVGL version: 9.1.0 | ||
// Project name: SquareLine_Project | ||
|
||
#include "ui.h" | ||
#include "ui_helpers.h" | ||
#include "ui_comp.h" | ||
|
||
uint32_t LV_EVENT_GET_COMP_CHILD; | ||
|
||
typedef struct { | ||
uint32_t child_idx; | ||
lv_obj_t * child; | ||
} ui_comp_get_child_t; | ||
|
||
lv_obj_t * ui_comp_get_child(lv_obj_t * comp, uint32_t child_idx) | ||
{ | ||
ui_comp_get_child_t info; | ||
info.child = NULL; | ||
info.child_idx = child_idx; | ||
lv_obj_send_event(comp, LV_EVENT_GET_COMP_CHILD, &info); | ||
return info.child; | ||
} | ||
|
||
void get_component_child_event_cb(lv_event_t * e) | ||
{ | ||
lv_obj_t ** c = lv_event_get_user_data(e); | ||
ui_comp_get_child_t * info = lv_event_get_param(e); | ||
info->child = c[info->child_idx]; | ||
} | ||
|
||
void del_component_child_event_cb(lv_event_t * e) | ||
{ | ||
lv_obj_t ** c = lv_event_get_user_data(e); | ||
lv_free(c); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// This file was generated by SquareLine Studio | ||
// SquareLine Studio version: SquareLine Studio 1.4.1 | ||
// LVGL version: 9.1.0 | ||
// Project name: SquareLine_Project | ||
|
||
#ifndef _UI_COMP__H | ||
#define _UI_COMP__H | ||
|
||
#include "ui.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void get_component_child_event_cb(lv_event_t * e); | ||
void del_component_child_event_cb(lv_event_t * e); | ||
|
||
lv_obj_t * ui_comp_get_child(lv_obj_t * comp, uint32_t child_idx); | ||
extern uint32_t LV_EVENT_GET_COMP_CHILD; | ||
#include "ui_comp_button.h" | ||
|
||
#ifdef __cplusplus | ||
} /*extern "C"*/ | ||
#endif | ||
|
||
#endif |
31 changes: 31 additions & 0 deletions
31
examples/lvgl/squarelinestudio_lvgl/ui/src/ui_comp_button.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// This file was generated by SquareLine Studio | ||
// SquareLine Studio version: SquareLine Studio 1.4.1 | ||
// LVGL version: 9.1.0 | ||
// Project name: SquareLine_Project | ||
|
||
#include "ui.h" | ||
|
||
|
||
// COMPONENT Button | ||
|
||
lv_obj_t * ui_Button_create(lv_obj_t * comp_parent) | ||
{ | ||
|
||
lv_obj_t * cui_Button; | ||
cui_Button = lv_button_create(comp_parent); | ||
lv_obj_set_width(cui_Button, 100); | ||
lv_obj_set_height(cui_Button, 50); | ||
lv_obj_set_x(cui_Button, 0); | ||
lv_obj_set_y(cui_Button, -3); | ||
lv_obj_set_align(cui_Button, LV_ALIGN_CENTER); | ||
lv_obj_add_flag(cui_Button, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags | ||
lv_obj_remove_flag(cui_Button, LV_OBJ_FLAG_SCROLLABLE); /// Flags | ||
|
||
lv_obj_t ** children = lv_malloc(sizeof(lv_obj_t *) * _UI_COMP_BUTTON_NUM); | ||
children[UI_COMP_BUTTON_BUTTON] = cui_Button; | ||
lv_obj_add_event_cb(cui_Button, get_component_child_event_cb, LV_EVENT_GET_COMP_CHILD, children); | ||
lv_obj_add_event_cb(cui_Button, del_component_child_event_cb, LV_EVENT_DELETE, children); | ||
ui_comp_Button_create_hook(cui_Button); | ||
return cui_Button; | ||
} | ||
|
24 changes: 24 additions & 0 deletions
24
examples/lvgl/squarelinestudio_lvgl/ui/src/ui_comp_button.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// This file was generated by SquareLine Studio | ||
// SquareLine Studio version: SquareLine Studio 1.4.1 | ||
// LVGL version: 9.1.0 | ||
// Project name: SquareLine_Project | ||
|
||
#ifndef _UI_COMP_BUTTON_H | ||
#define _UI_COMP_BUTTON_H | ||
|
||
#include "ui.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
// COMPONENT Button | ||
#define UI_COMP_BUTTON_BUTTON 0 | ||
#define _UI_COMP_BUTTON_NUM 1 | ||
lv_obj_t * ui_Button_create(lv_obj_t * comp_parent); | ||
|
||
#ifdef __cplusplus | ||
} /*extern "C"*/ | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// This file was generated by SquareLine Studio | ||
// SquareLine Studio version: SquareLine Studio 1.4.1 | ||
// LVGL version: 9.1.0 | ||
// Project name: SquareLine_Project | ||
|
||
#include "ui.h" | ||
|
||
void ui_comp_Button_create_hook(lv_obj_t * comp) | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// This file was generated by SquareLine Studio | ||
// SquareLine Studio version: SquareLine Studio 1.4.1 | ||
// LVGL version: 9.1.0 | ||
// Project name: SquareLine_Project | ||
|
||
#ifndef _SQUARELINE_PROJECT_UI_COMP_HOOK_H | ||
#define _SQUARELINE_PROJECT_UI_COMP_HOOK_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void ui_comp_Button_create_hook(lv_obj_t * comp); | ||
|
||
#ifdef __cplusplus | ||
} /*extern "C"*/ | ||
#endif | ||
|
||
#endif |
6 changes: 3 additions & 3 deletions
6
...uarelinestudio_lvgl_v8/ui/src/ui_events.h → .../squarelinestudio_lvgl/ui/src/ui_events.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.