Browse Source

update eez-framework

master
Martin Vladic 5 months ago
parent
commit
cab35c1107
  1. 2
      eez-framework
  2. 567
      lvgl-template-web.eez-project
  3. 8
      src/ui/actions.h
  4. 39
      src/ui/flow_def.c
  5. 8
      src/ui/flow_def.h
  6. 8
      src/ui/fonts.h
  7. 8
      src/ui/images.h
  8. 30
      src/ui/screens.c
  9. 12
      src/ui/screens.h
  10. 26
      src/ui/structs.h
  11. 117
      src/ui/ui.c
  12. 28
      src/ui/ui.h
  13. 112
      src/ui/ui_image_log_eez.c
  14. 21
      src/ui/vars.h

2
eez-framework

@ -1 +1 @@
Subproject commit 6639aff33e74c2eae10116551272a07a53a6f883
Subproject commit c3e0ac049e0fda5a0d5518e2e00ee2f708099158

567
lvgl-template-web.eez-project

@ -1,20 +1,23 @@
{
"objID": "6666cd76-f969-5646-9e7b-e39d750cc7d9",
"lvglStyles": {
"objID": "a31bd004-35c5-b3fb-5c8b-78ea5c7693b8",
"styles": [],
"defaultStyles": {}
},
"objID": "6666cd76-f969-5646-9e7b-e39d750cc7d9",
"settings": {
"objID": "e007d988-9fba-797d-72e9-efc33ca6d05c",
"general": {
"objID": "fd434352-2277-c4a8-e87e-e96cfcbf2305",
"projectVersion": "v3",
"projectType": "lvgl",
"lvglVersion": "8.3",
"extensions": [],
"imports": [],
"flowSupport": true,
"displayWidth": 800,
"displayHeight": 480,
"colorFormat": "BGR",
"description": "LVGL project template for the web browser using emscripten",
"keywords": "emscripten WebAssembly",
"targetPlatform": "Emscripten is a complete compiler toolchain to WebAssembly, using LLVM, with a special focus on speed, size, and the Web platform.",
@ -31,69 +34,64 @@
],
"files": [
{
"objID": "05204dce-0fc5-4c81-b733-2ccc8e6c8671",
"objID": "e3912dd1-da67-4f29-9f2b-860fd62a0139",
"fileName": "screens.h",
"template": "#ifndef EEZ_LVGL_UI_SCREENS_H\r\n#define EEZ_LVGL_UI_SCREENS_H\r\n\r\n//${eez-studio LVGL_INCLUDE}\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n//${eez-studio LVGL_SCREENS_DECL}\r\n//${eez-studio LVGL_SCREENS_DECL_EXT}\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /*EEZ_LVGL_UI_SCREENS_H*/"
},
{
"objID": "2212bc5e-cf4a-4a81-c9ab-a671066d086f",
"objID": "858cb4ca-4c93-4e70-eb13-b00319a7a8fe",
"fileName": "screens.c",
"template": "#include \"screens.h\"\n#include \"images.h\"\n#include \"fonts.h\"\n#include \"actions.h\"\n#include \"ui.h\"\n\n//${eez-studio LVGL_SCREENS_DEF}\n//${eez-studio LVGL_SCREENS_DEF_EXT}"
"template": "#include \"screens.h\"\n#include \"images.h\"\n#include \"fonts.h\"\n#include \"actions.h\"\n#include \"vars.h\"\n#include \"styles.h\"\n#include \"ui.h\"\n\n//${eez-studio LVGL_SCREENS_DEF}\n//${eez-studio LVGL_SCREENS_DEF_EXT}"
},
{
"objID": "19d3d573-88a3-4550-f4da-753b61d7f0c4",
"objID": "14c9d28d-8ac9-4833-fd9a-14c140afd98a",
"fileName": "actions.h",
"template": "#ifndef EEZ_LVGL_UI_EVENTS_H\r\n#define EEZ_LVGL_UI_EVENTS_H\r\n\r\n//${eez-studio LVGL_INCLUDE}\r\n\r\n//${eez-studio LVGL_ACTIONS_DECL}\r\n\r\n#endif /*EEZ_LVGL_UI_EVENTS_H*/"
"template": "#ifndef EEZ_LVGL_UI_EVENTS_H\r\n#define EEZ_LVGL_UI_EVENTS_H\r\n\r\n//${eez-studio LVGL_INCLUDE}\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n//${eez-studio LVGL_ACTIONS_DECL}\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /*EEZ_LVGL_UI_EVENTS_H*/"
},
{
"objID": "e95514b3-1083-49b9-a4f6-847d4792f050",
"objID": "b512d240-9a84-44ef-a0af-dc1e28383d1a",
"fileName": "vars.h",
"template": "#ifndef EEZ_LVGL_UI_VARS_H\r\n#define EEZ_LVGL_UI_VARS_H\r\n\r\n#include <stdint.h>\r\n\r\n//${eez-studio LVGL_VARS_DECL}\r\n\r\n#endif /*EEZ_LVGL_UI_VARS_H*/"
},
{
"objID": "9c770003-b028-4a8b-9447-fea072e67b3a",
"fileName": "flow_def.h",
"template": "#ifndef EEZ_LVGL_UI_FLOW_DEF_H\n#define EEZ_LVGL_UI_FLOW_DEF_H\n\n#include <stdint.h>\n\n//${eez-studio GUI_ASSETS_DECL_COMPRESSED}\n\n#endif /*EEZ_LVGL_UI_FLOW_DEF_H*/"
"template": "#ifndef EEZ_LVGL_UI_VARS_H\r\n#define EEZ_LVGL_UI_VARS_H\r\n\r\n#include <stdint.h>\r\n#include <stdbool.h>\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n// enum declarations\r\n\r\n//${eez-studio FLOW_ENUMS}\r\n\r\n// Flow global variables\r\n\r\n//${eez-studio FLOW_GLOBAL_VARIABLES_ENUM}\r\n\r\n// Native global variables\r\n\r\n//${eez-studio LVGL_VARS_DECL}\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /*EEZ_LVGL_UI_VARS_H*/"
},
{
"objID": "0f3ea37c-f0d3-4061-c693-76b52bd9d632",
"fileName": "flow_def.c",
"template": "#include <eez/core/vars.h>\n\n#include \"flow_def.h\"\n#include \"vars.h\"\n\n//${eez-studio GUI_ASSETS_DEF_COMPRESSED}\n\n//${eez-studio LVGL_NATIVE_VARS_TABLE_DEF}\n"
"objID": "3e6c4a8d-0bb6-4071-8ec5-d3b24765ddd7",
"fileName": "structs.h",
"template": "#ifndef EEZ_LVGL_UI_STRUCTS_H\n#define EEZ_LVGL_UI_STRUCTS_H\n\n//${eez-studio EEZ_FOR_LVGL_CHECK}\n\n#if defined(EEZ_FOR_LVGL)\n\n#include <eez/flow/flow.h>\n#include <stdint.h>\n#include <stdbool.h>\n\n#include \"vars.h\"\n\nusing namespace eez;\n\n//${eez-studio FLOW_STRUCTS}\n\n//${eez-studio FLOW_STRUCT_VALUES}\n\n#endif\n\n#endif /*EEZ_LVGL_UI_STRUCTS_H*/\n"
},
{
"objID": "81fa9cb7-33e4-4272-9340-49a50037b327",
"objID": "327dc94f-3d8c-4ebf-f0aa-e5c86c2601a5",
"fileName": "images.h",
"template": "#ifndef EEZ_LVGL_UI_IMAGES_H\r\n#define EEZ_LVGL_UI_IMAGES_H\r\n\r\n//${eez-studio LVGL_INCLUDE}\r\n\r\n//${eez-studio LVGL_IMAGES_DECL}\r\n\r\n#endif /*EEZ_LVGL_UI_IMAGES_H*/"
"template": "#ifndef EEZ_LVGL_UI_IMAGES_H\r\n#define EEZ_LVGL_UI_IMAGES_H\r\n\r\n//${eez-studio LVGL_INCLUDE}\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n//${eez-studio LVGL_IMAGES_DECL}\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /*EEZ_LVGL_UI_IMAGES_H*/"
},
{
"objID": "5844b3a8-54b7-4bdf-ff04-d052e689328c",
"objID": "1dde5fe7-4caf-45fe-c066-56931abc55f4",
"fileName": "images.c",
"template": "#include \"images.h\"\n\n//${eez-studio LVGL_IMAGES_DEF}"
},
{
"objID": "bad0addd-10de-48f7-e57e-b40fce3e7c45",
"objID": "e1888cf7-4dd7-46df-f11c-68f0e34246ae",
"fileName": "fonts.h",
"template": "#ifndef EEZ_LVGL_UI_FONTS_H\r\n#define EEZ_LVGL_UI_FONTS_H\r\n\r\n//${eez-studio LVGL_INCLUDE}\r\n\r\n//${eez-studio LVGL_FONTS_DECL}\r\n\r\n#endif /*EEZ_LVGL_UI_FONTS_H*/"
"template": "#ifndef EEZ_LVGL_UI_FONTS_H\r\n#define EEZ_LVGL_UI_FONTS_H\r\n\r\n//${eez-studio LVGL_INCLUDE}\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n//${eez-studio LVGL_FONTS_DECL}\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /*EEZ_LVGL_UI_FONTS_H*/"
},
{
"objID": "4743460c-3867-4a04-9673-213804dc3078",
"objID": "7c091216-ed0b-4343-8af1-1ee66fb1498c",
"fileName": "styles.h",
"template": "#ifndef EEZ_LVGL_UI_STYLES_H\r\n#define EEZ_LVGL_UI_STYLES_H\r\n\r\n//${eez-studio LVGL_INCLUDE}\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n//${eez-studio LVGL_STYLES_DECL}\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /*EEZ_LVGL_UI_STYLES_H*/"
},
{
"objID": "d6250de9-847c-4f7f-ed5c-41e7134db9f1",
"objID": "d4d6001d-95d1-428e-eeed-ead46be26db1",
"fileName": "styles.c",
"template": "#include \"styles.h\"\n#include \"images.h\"\n#include \"fonts.h\"\n\n//${eez-studio LVGL_STYLES_DEF}\n"
},
{
"objID": "7bc0152a-1716-469c-a3f8-8346707369a1",
"objID": "f99a083b-e1da-4361-810d-e35eac4e1d1d",
"fileName": "ui.h",
"template": "#ifndef EEZ_LVGL_UI_GUI_H\n#define EEZ_LVGL_UI_GUI_H\n\n#include <eez/flow/lvgl_api.h>\n\nvoid ui_init();\nvoid ui_tick();\n\n#endif // EEZ_LVGL_UI_GUI_H"
"template": "#ifndef EEZ_LVGL_UI_GUI_H\n#define EEZ_LVGL_UI_GUI_H\n\n//${eez-studio LVGL_INCLUDE}\n\n//${eez-studio EEZ_FOR_LVGL_CHECK}\n\n#if defined(EEZ_FOR_LVGL)\n#include <eez/flow/lvgl_api.h>\n#endif\n\n#if !defined(EEZ_FOR_LVGL)\n#include \"screens.h\"\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n//${eez-studio GUI_ASSETS_DECL}\n\nvoid ui_init();\nvoid ui_tick();\n\n#if !defined(EEZ_FOR_LVGL)\nvoid loadScreen(enum ScreensEnum screenId);\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // EEZ_LVGL_UI_GUI_H"
},
{
"objID": "cb1d0e99-b8a8-43f7-815f-e6a8f7f5fe6f",
"objID": "7bb6d9af-ac92-4b4a-c946-994b5e9f692a",
"fileName": "ui.c",
"template": "#include \"ui.h\"\n#include \"screens.h\"\n#include \"images.h\"\n#include \"flow_def.h\"\n\n//${eez-studio LVGL_ACTIONS_ARRAY_DEF}\n\nvoid ui_init() {\n eez_flow_init(assets, sizeof(assets), (lv_obj_t **)&objects, sizeof(objects), images, sizeof(images), actions);\n}\n\nvoid ui_tick() {\n eez_flow_tick();\n tick_screen(g_currentScreen);\n}\n"
"template": "#if defined(EEZ_FOR_LVGL)\n#include <eez/core/vars.h>\n#endif\n\n#include \"ui.h\"\n#include \"screens.h\"\n#include \"images.h\"\n#include \"actions.h\"\n#include \"vars.h\"\n\n//${eez-studio GUI_ASSETS_DEF}\n\n//${eez-studio LVGL_NATIVE_VARS_TABLE_DEF}\n\n//${eez-studio LVGL_ACTIONS_ARRAY_DEF}\n\n#if defined(EEZ_FOR_LVGL)\n\nvoid ui_init() {\n eez_flow_init(assets, sizeof(assets), (lv_obj_t **)&objects, sizeof(objects), images, sizeof(images), actions);\n}\n\nvoid ui_tick() {\n eez_flow_tick();\n tick_screen(g_currentScreen);\n}\n\n#else\n\nstatic int16_t currentScreen = -1;\n\nstatic lv_obj_t *getLvglObjectFromIndex(int32_t index) {\n if (index == -1) {\n return 0;\n }\n return ((lv_obj_t **)&objects)[index];\n}\n\nstatic const void *getLvglImageByName(const char *name) {\n for (size_t imageIndex = 0; imageIndex < sizeof(images) / sizeof(ext_img_desc_t); imageIndex++) {\n if (strcmp(images[imageIndex].name, name) == 0) {\n return images[imageIndex].img_dsc;\n }\n }\n return 0;\n}\n\nvoid loadScreen(enum ScreensEnum screenId) {\n currentScreen = screenId - 1;\n lv_obj_t *screen = getLvglObjectFromIndex(currentScreen);\n lv_scr_load_anim(screen, LV_SCR_LOAD_ANIM_FADE_IN, 200, 0, false);\n}\n\nvoid ui_init() {\n create_screens();\n loadScreen(SCREEN_ID_MAIN);\n}\n\nvoid ui_tick() {\n tick_screen(currentScreen);\n}\n\n#endif\n"
}
],
"destinationFolder": "src/ui",
@ -112,161 +110,75 @@
"objID": "4b40eba7-b31a-468a-b887-11dfd0b6637f",
"components": [
{
"objID": "2d76b841-eeb5-4a2c-81da-dbd4be70632c",
"type": "LVGLImageWidget",
"left": 130,
"top": 79,
"width": 220,
"height": 64,
"objID": "9e57303c-cc4b-4ba3-8fae-ba096f2cf716",
"type": "SetVariableActionComponent",
"left": 141,
"top": 532,
"width": 177,
"height": 57,
"customInputs": [],
"customOutputs": [],
"style": {
"objID": "0b19b9b1-6ab9-455c-b8f7-4663a43fdf2b",
"inheritFrom": "default"
},
"timeline": [],
"eventHandlers": [],
"leftUnit": "px",
"topUnit": "px",
"widthUnit": "content",
"heightUnit": "content",
"children": [],
"flags": "PRESS_LOCK|ADV_HITTEST|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_CHAIN",
"hiddenFlagType": "literal",
"clickableFlagType": "literal",
"scrollbarMode": "auto",
"scrollDirection": "all",
"checkedStateType": "literal",
"disabledStateType": "literal",
"states": "",
"localStyles": {
"objID": "8a592882-0d02-46a5-80c3-df72553ddc61"
},
"image": "log_eez",
"pivotX": 0,
"pivotY": 0,
"zoom": 256,
"angle": 0
"entries": [
{
"objID": "998d16f4-e74e-4329-bb68-a343ad6704f7",
"variable": "counter",
"value": "counter + 1"
}
]
},
{
"objID": "c3b00b12-28c7-4c95-d54a-bbe58f0c3104",
"type": "LVGLImageWidget",
"left": 457,
"top": 79,
"width": 220,
"height": 70,
"objID": "f327ef7f-640a-4b30-d3a7-f5537497e4e8",
"type": "SetVariableActionComponent",
"left": 495,
"top": 532,
"width": 177,
"height": 57,
"customInputs": [],
"customOutputs": [],
"style": {
"objID": "d6868bfc-9ad2-427c-8f97-a11857378c95",
"inheritFrom": "default"
},
"timeline": [],
"eventHandlers": [],
"leftUnit": "px",
"topUnit": "px",
"widthUnit": "content",
"heightUnit": "content",
"children": [],
"flags": "PRESS_LOCK|ADV_HITTEST|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_CHAIN",
"hiddenFlagType": "literal",
"clickableFlagType": "literal",
"scrollbarMode": "auto",
"scrollDirection": "all",
"checkedStateType": "literal",
"disabledStateType": "literal",
"states": "",
"localStyles": {
"objID": "2b4ba950-0529-413b-d378-02dd4fa19b30"
},
"image": "logo_lvgl",
"pivotX": 0,
"pivotY": 0,
"zoom": 256,
"angle": 0
"entries": [
{
"objID": "998d16f4-e74e-4329-bb68-a343ad6704f7",
"variable": "counter",
"value": "counter - 1"
}
]
},
{
"objID": "1c46cbe3-936f-468e-d4d0-6b93e194ec80",
"type": "LVGLLabelWidget",
"objID": "3ff50907-83c1-3780-6dd9-86fd394135b5",
"type": "LVGLScreenWidget",
"left": 0,
"top": 0,
"width": 150,
"height": 35,
"width": 800,
"height": 480,
"customInputs": [],
"customOutputs": [],
"style": {
"objID": "5dffb049-0a8f-49b9-9e04-5c01de563f90",
"inheritFrom": "default"
"objID": "a16b7fcc-e6a6-7e64-aacd-2ed15424d643",
"useStyle": "default",
"conditionalStyles": [],
"childStyles": []
},
"timeline": [],
"eventHandlers": [],
"leftUnit": "px",
"topUnit": "px",
"widthUnit": "content",
"heightUnit": "content",
"children": [],
"flags": "PRESS_LOCK|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLLABLE|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_CHAIN",
"hiddenFlagType": "literal",
"clickableFlagType": "literal",
"scrollbarMode": "auto",
"scrollDirection": "all",
"checkedStateType": "literal",
"disabledStateType": "literal",
"states": "",
"localStyles": {
"objID": "ae7a17a4-3214-44f8-f154-f102a9053931",
"definition": {
"MAIN": {
"DEFAULT": {
"align": "CENTER",
"text_font": "MONTSERRAT_32"
}
}
}
},
"text": "counter",
"textType": "expression",
"longMode": "WRAP",
"recolor": false
},
{
"objID": "34739d22-2efa-402d-ebe2-2946e5282349",
"type": "LVGLButtonWidget",
"left": 268,
"top": 348,
"width": 100,
"height": 40,
"customInputs": [],
"customOutputs": [],
"style": {
"objID": "2c324954-dffe-47ba-cbc6-e97ca21b6a88",
"inheritFrom": "default"
},
"timeline": [],
"eventHandlers": [
{
"objID": "c43f76ad-7561-46e4-f050-34a8422526cb",
"eventName": "PRESSED",
"handlerType": "flow"
}
],
"leftUnit": "px",
"topUnit": "px",
"widthUnit": "px",
"heightUnit": "px",
"children": [
{
"objID": "6c627b80-0864-4642-d513-bf9025010946",
"type": "LVGLLabelWidget",
"left": 0,
"top": 0,
"width": 28,
"height": 52,
"objID": "2d76b841-eeb5-4a2c-81da-dbd4be70632c",
"type": "LVGLImageWidget",
"left": 130,
"top": 79,
"width": 220,
"height": 64,
"customInputs": [],
"customOutputs": [],
"style": {
"objID": "ac11a4b4-15c5-46a9-fdeb-e0f86741d36d",
"inheritFrom": "default"
"objID": "0b19b9b1-6ab9-455c-b8f7-4663a43fdf2b",
"useStyle": "default",
"conditionalStyles": [],
"childStyles": []
},
"timeline": [],
"eventHandlers": [],
@ -275,7 +187,7 @@
"widthUnit": "content",
"heightUnit": "content",
"children": [],
"flags": "PRESS_LOCK|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLLABLE|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_CHAIN",
"flags": "PRESS_LOCK|ADV_HITTEST|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_CHAIN",
"hiddenFlagType": "literal",
"clickableFlagType": "literal",
"scrollbarMode": "auto",
@ -284,73 +196,67 @@
"disabledStateType": "literal",
"states": "",
"localStyles": {
"objID": "5661b6e5-1720-4455-b045-3ddb340d87cd",
"definition": {
"MAIN": {
"DEFAULT": {
"text_font": "MONTSERRAT_48",
"align": "CENTER"
}
}
}
"objID": "8a592882-0d02-46a5-80c3-df72553ddc61"
},
"text": "+",
"textType": "literal",
"longMode": "WRAP",
"recolor": false
}
],
"flags": "PRESS_LOCK|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLL_ELASTIC|SCROLL_ON_FOCUS|SCROLL_MOMENTUM|SCROLL_CHAIN",
"hiddenFlagType": "literal",
"clickableFlag": true,
"clickableFlagType": "literal",
"scrollbarMode": "auto",
"scrollDirection": "all",
"checkedStateType": "literal",
"disabledStateType": "literal",
"states": "",
"localStyles": {
"objID": "77010546-38ab-4a5e-a04f-f3e55ab58dd2"
}
},
{
"objID": "e6c88623-2256-4771-f786-b5e6d356f35b",
"type": "LVGLButtonWidget",
"left": 408,
"top": 348,
"width": 100,
"height": 40,
"customInputs": [],
"customOutputs": [],
"style": {
"objID": "2c324954-dffe-47ba-cbc6-e97ca21b6a88",
"inheritFrom": "default"
},
"timeline": [],
"eventHandlers": [
"image": "log_eez",
"pivotX": 0,
"pivotY": 0,
"zoom": 256,
"angle": 0
},
{
"objID": "c3538efb-e5bb-431b-9494-bc1c52dfc06d",
"eventName": "PRESSED",
"handlerType": "flow"
}
],
"leftUnit": "px",
"topUnit": "px",
"widthUnit": "px",
"heightUnit": "px",
"children": [
"objID": "c3b00b12-28c7-4c95-d54a-bbe58f0c3104",
"type": "LVGLImageWidget",
"left": 457,
"top": 79,
"width": 220,
"height": 70,
"customInputs": [],
"customOutputs": [],
"style": {
"objID": "d6868bfc-9ad2-427c-8f97-a11857378c95",
"useStyle": "default",
"conditionalStyles": [],
"childStyles": []
},
"timeline": [],
"eventHandlers": [],
"leftUnit": "px",
"topUnit": "px",
"widthUnit": "content",
"heightUnit": "content",
"children": [],
"flags": "PRESS_LOCK|ADV_HITTEST|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_CHAIN",
"hiddenFlagType": "literal",
"clickableFlagType": "literal",
"scrollbarMode": "auto",
"scrollDirection": "all",
"checkedStateType": "literal",
"disabledStateType": "literal",
"states": "",
"localStyles": {
"objID": "2b4ba950-0529-413b-d378-02dd4fa19b30"
},
"image": "logo_lvgl",
"pivotX": 0,
"pivotY": 0,
"zoom": 256,
"angle": 0
},
{
"objID": "f0785b0d-a2be-4ecc-96a6-7d1e5bb601a1",
"objID": "1c46cbe3-936f-468e-d4d0-6b93e194ec80",
"type": "LVGLLabelWidget",
"left": 0,
"top": 0,
"width": 18,
"height": 52,
"width": 150,
"height": 35,
"customInputs": [],
"customOutputs": [],
"style": {
"objID": "88950bc0-9056-4dbd-efc2-14f2f1436efb",
"inheritFrom": "default"
"objID": "5dffb049-0a8f-49b9-9e04-5c01de563f90",
"useStyle": "default",
"conditionalStyles": [],
"childStyles": []
},
"timeline": [],
"eventHandlers": [],
@ -368,23 +274,199 @@
"disabledStateType": "literal",
"states": "",
"localStyles": {
"objID": "71393c8b-e295-400f-f3ee-e6ed3f0d72a1",
"objID": "ae7a17a4-3214-44f8-f154-f102a9053931",
"definition": {
"MAIN": {
"DEFAULT": {
"text_font": "MONTSERRAT_48",
"align": "CENTER"
"align": "CENTER",
"text_font": "MONTSERRAT_32"
}
}
}
},
"text": "-",
"textType": "literal",
"text": "counter",
"textType": "expression",
"longMode": "WRAP",
"recolor": false
},
{
"objID": "34739d22-2efa-402d-ebe2-2946e5282349",
"type": "LVGLButtonWidget",
"left": 268,
"top": 348,
"width": 100,
"height": 40,
"customInputs": [],
"customOutputs": [],
"style": {
"objID": "2c324954-dffe-47ba-cbc6-e97ca21b6a88",
"useStyle": "default",
"conditionalStyles": [],
"childStyles": []
},
"timeline": [],
"eventHandlers": [
{
"objID": "c43f76ad-7561-46e4-f050-34a8422526cb",
"eventName": "PRESSED",
"handlerType": "flow"
}
],
"leftUnit": "px",
"topUnit": "px",
"widthUnit": "px",
"heightUnit": "px",
"children": [
{
"objID": "6c627b80-0864-4642-d513-bf9025010946",
"type": "LVGLLabelWidget",
"left": 0,
"top": 0,
"width": 28,
"height": 52,
"customInputs": [],
"customOutputs": [],
"style": {
"objID": "ac11a4b4-15c5-46a9-fdeb-e0f86741d36d",
"useStyle": "default",
"conditionalStyles": [],
"childStyles": []
},
"timeline": [],
"eventHandlers": [],
"leftUnit": "px",
"topUnit": "px",
"widthUnit": "content",
"heightUnit": "content",
"children": [],
"flags": "PRESS_LOCK|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLLABLE|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_CHAIN",
"hiddenFlagType": "literal",
"clickableFlagType": "literal",
"scrollbarMode": "auto",
"scrollDirection": "all",
"checkedStateType": "literal",
"disabledStateType": "literal",
"states": "",
"localStyles": {
"objID": "5661b6e5-1720-4455-b045-3ddb340d87cd",
"definition": {
"MAIN": {
"DEFAULT": {
"text_font": "MONTSERRAT_48",
"align": "CENTER"
}
}
}
},
"text": "+",
"textType": "literal",
"longMode": "WRAP",
"recolor": false
}
],
"flags": "PRESS_LOCK|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLL_ELASTIC|SCROLL_ON_FOCUS|SCROLL_MOMENTUM|SCROLL_CHAIN",
"hiddenFlagType": "literal",
"clickableFlag": true,
"clickableFlagType": "literal",
"scrollbarMode": "auto",
"scrollDirection": "all",
"checkedStateType": "literal",
"disabledStateType": "literal",
"states": "",
"localStyles": {
"objID": "77010546-38ab-4a5e-a04f-f3e55ab58dd2"
}
},
{
"objID": "e6c88623-2256-4771-f786-b5e6d356f35b",
"type": "LVGLButtonWidget",
"left": 408,
"top": 348,
"width": 100,
"height": 40,
"customInputs": [],
"customOutputs": [],
"style": {
"objID": "2c324954-dffe-47ba-cbc6-e97ca21b6a88",
"useStyle": "default",
"conditionalStyles": [],
"childStyles": []
},
"timeline": [],
"eventHandlers": [
{
"objID": "c3538efb-e5bb-431b-9494-bc1c52dfc06d",
"eventName": "PRESSED",
"handlerType": "flow"
}
],
"leftUnit": "px",
"topUnit": "px",
"widthUnit": "px",
"heightUnit": "px",
"children": [
{
"objID": "f0785b0d-a2be-4ecc-96a6-7d1e5bb601a1",
"type": "LVGLLabelWidget",
"left": 0,
"top": 0,
"width": 18,
"height": 52,
"customInputs": [],
"customOutputs": [],
"style": {
"objID": "88950bc0-9056-4dbd-efc2-14f2f1436efb",
"useStyle": "default",
"conditionalStyles": [],
"childStyles": []
},
"timeline": [],
"eventHandlers": [],
"leftUnit": "px",
"topUnit": "px",
"widthUnit": "content",
"heightUnit": "content",
"children": [],
"flags": "PRESS_LOCK|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLLABLE|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_CHAIN",
"hiddenFlagType": "literal",
"clickableFlagType": "literal",
"scrollbarMode": "auto",
"scrollDirection": "all",
"checkedStateType": "literal",
"disabledStateType": "literal",
"states": "",
"localStyles": {
"objID": "71393c8b-e295-400f-f3ee-e6ed3f0d72a1",
"definition": {
"MAIN": {
"DEFAULT": {
"text_font": "MONTSERRAT_48",
"align": "CENTER"
}
}
}
},
"text": "-",
"textType": "literal",
"longMode": "WRAP",
"recolor": false
}
],
"flags": "PRESS_LOCK|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLL_ELASTIC|SCROLL_ON_FOCUS|SCROLL_MOMENTUM|SCROLL_CHAIN",
"hiddenFlagType": "literal",
"clickableFlag": true,
"clickableFlagType": "literal",
"scrollbarMode": "auto",
"scrollDirection": "all",
"checkedStateType": "literal",
"disabledStateType": "literal",
"states": "",
"localStyles": {
"objID": "77010546-38ab-4a5e-a04f-f3e55ab58dd2"
}
}
],
"flags": "PRESS_LOCK|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLL_ELASTIC|SCROLL_ON_FOCUS|SCROLL_MOMENTUM|SCROLL_CHAIN",
"flags": "PRESS_LOCK|CLICK_FOCUSABLE|GESTURE_BUBBLE|SNAPPABLE|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_CHAIN",
"hiddenFlagType": "literal",
"clickableFlag": true,
"clickableFlagType": "literal",
@ -394,42 +476,8 @@
"disabledStateType": "literal",
"states": "",
"localStyles": {
"objID": "77010546-38ab-4a5e-a04f-f3e55ab58dd2"
"objID": "a7b31582-66ef-c8bd-2d0d-602f921469e6"
}
},
{
"objID": "9e57303c-cc4b-4ba3-8fae-ba096f2cf716",
"type": "SetVariableActionComponent",
"left": 141,
"top": 532,
"width": 177,
"height": 56,
"customInputs": [],
"customOutputs": [],
"entries": [
{
"objID": "998d16f4-e74e-4329-bb68-a343ad6704f7",
"variable": "counter",
"value": "counter + 1"
}
]
},
{
"objID": "f327ef7f-640a-4b30-d3a7-f5537497e4e8",
"type": "SetVariableActionComponent",
"left": 495,
"top": 532,
"width": 177,
"height": 56,
"customInputs": [],
"customOutputs": [],
"entries": [
{
"objID": "998d16f4-e74e-4329-bb68-a343ad6704f7",
"variable": "counter",
"value": "counter - 1"
}
]
}
],
"connectionLines": [
@ -461,10 +509,7 @@
"left": 0,
"top": 0,
"width": 800,
"height": 480,
"lvglLocalStyles": {
"objID": "e85dbd5d-8325-1629-003b-86fd654ae635"
}
"height": 480
}
],
"userWidgets": [],

8
src/ui/actions.h

@ -3,6 +3,14 @@
#include <lvgl/lvgl.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /*EEZ_LVGL_UI_EVENTS_H*/

39
src/ui/flow_def.c

@ -1,39 +0,0 @@
#include <eez/core/vars.h>
#include "flow_def.h"
#include "vars.h"
// ASSETS DEFINITION
const uint8_t assets[409] = {
0x7E, 0x65, 0x65, 0x7A, 0x03, 0x00, 0x06, 0x00, 0xB8, 0x03, 0x00, 0x00, 0x6E, 0x24, 0x00, 0x00,
0x00, 0x24, 0x00, 0x01, 0x00, 0x18, 0x20, 0x0C, 0x00, 0x43, 0x03, 0xE0, 0x01, 0x01, 0x28, 0x00,
0x13, 0x01, 0x1C, 0x00, 0x00, 0x08, 0x00, 0xA6, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x34, 0x03, 0x2C, 0x00, 0x13, 0x0C, 0x08, 0x00, 0x10, 0x10, 0x18, 0x00, 0x43, 0x00, 0x00, 0x00,
0x02, 0x08, 0x00, 0x53, 0x09, 0x00, 0x00, 0x00, 0x30, 0x38, 0x00, 0x13, 0x4C, 0x18, 0x00, 0x2E,
0x08, 0x03, 0x78, 0x00, 0xF0, 0x1A, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x00, 0xFF, 0xFF,
0x08, 0x42, 0x28, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x7C, 0x00,
0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0xB4, 0x00, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x00, 0xEC, 0x64,
0x00, 0x96, 0x01, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x10, 0x27, 0x40, 0x00, 0x01, 0x70, 0x00,
0x12, 0x01, 0x68, 0x00, 0x00, 0x08, 0x00, 0x2E, 0xFF, 0xFF, 0x20, 0x00, 0x13, 0x20, 0x20, 0x00,
0x13, 0x20, 0x20, 0x00, 0x17, 0x11, 0x20, 0x00, 0x00, 0x93, 0x00, 0x13, 0x0C, 0x20, 0x00, 0x13,
0x10, 0x20, 0x00, 0x1B, 0x12, 0x40, 0x00, 0x17, 0xFC, 0x08, 0x00, 0x0C, 0x40, 0x00, 0x13, 0x02,
0x9C, 0x00, 0x13, 0x01, 0x08, 0x00, 0x0F, 0x40, 0x00, 0x01, 0x17, 0xD8, 0x08, 0x00, 0x0F, 0x40,
0x00, 0x01, 0x13, 0xC8, 0x40, 0x00, 0x13, 0xC8, 0x20, 0x00, 0x22, 0xEF, 0x03, 0x10, 0x00, 0x17,
0xBC, 0x28, 0x01, 0x00, 0x10, 0x00, 0x13, 0xB0, 0x20, 0x00, 0x00, 0x0C, 0x00, 0x26, 0xA8, 0x00,
0x28, 0x00, 0x1B, 0xA0, 0x28, 0x00, 0x17, 0x94, 0x28, 0x00, 0x13, 0x8C, 0x18, 0x00, 0x1B, 0x07,
0x78, 0x01, 0x17, 0x78, 0x04, 0x00, 0x17, 0x80, 0x04, 0x00, 0x1B, 0x88, 0x04, 0x00, 0x17, 0x90,
0x04, 0x00, 0x13, 0x98, 0x6C, 0x00, 0x04, 0x04, 0x00, 0x17, 0xA8, 0x04, 0x00, 0x00, 0x9C, 0x00,
0x17, 0xB8, 0x04, 0x00, 0x13, 0x00, 0xC0, 0x00, 0x13, 0xC4, 0x94, 0x00, 0x00, 0x08, 0x00, 0x10,
0xCC, 0x15, 0x00, 0x13, 0xE0, 0x04, 0x00, 0x08, 0x8D, 0x00, 0x0F, 0x14, 0x00, 0x09, 0x3F, 0x40,
0x00, 0xE0, 0x2C, 0x00, 0x0D, 0x13, 0x01, 0xC8, 0x00, 0x1F, 0x00, 0x60, 0x00, 0x18, 0x00, 0x34,
0x00, 0x1F, 0x48, 0x34, 0x00, 0x09, 0x07, 0x28, 0x00, 0x0C, 0x34, 0x03, 0x04, 0x0C, 0x03, 0x13,
0x1C, 0x1C, 0x03, 0x23, 0x20, 0x00, 0xA8, 0x00, 0x74, 0x40, 0x02, 0x00, 0x00, 0xC0, 0x00, 0xE0,
0x0C, 0x00, 0x40, 0x01, 0xC0, 0x00, 0xE0, 0x78, 0x01, 0x53, 0x08, 0x00, 0x01, 0x00, 0x10, 0x30,
0x00, 0x00, 0xE4, 0x02, 0x2F, 0x03, 0x03, 0x68, 0x00, 0x03, 0x08, 0x01, 0x00, 0x04, 0xB0, 0x01,
0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
native_var_t native_vars[] = {
{ NATIVE_VAR_TYPE_NONE, 0, 0 },
};

8
src/ui/flow_def.h

@ -1,8 +0,0 @@
#ifndef EEZ_LVGL_UI_FLOW_DEF_H
#define EEZ_LVGL_UI_FLOW_DEF_H
#include <stdint.h>
extern const uint8_t assets[409];
#endif /*EEZ_LVGL_UI_FLOW_DEF_H*/

8
src/ui/fonts.h

@ -3,7 +3,15 @@
#include <lvgl/lvgl.h>
#ifdef __cplusplus
extern "C" {
#endif
extern const lv_font_t ui_font_small_font;
#ifdef __cplusplus
}
#endif
#endif /*EEZ_LVGL_UI_FONTS_H*/

8
src/ui/images.h

@ -3,6 +3,10 @@
#include <lvgl/lvgl.h>
#ifdef __cplusplus
extern "C" {
#endif
extern const lv_img_dsc_t img_log_eez;
extern const lv_img_dsc_t img_logo_lvgl;
@ -17,4 +21,8 @@ typedef struct _ext_img_desc_t {
extern const ext_img_desc_t images[2];
#ifdef __cplusplus
}
#endif
#endif /*EEZ_LVGL_UI_IMAGES_H*/

30
src/ui/screens.c

@ -2,31 +2,33 @@
#include "images.h"
#include "fonts.h"
#include "actions.h"
#include "vars.h"
#include "styles.h"
#include "ui.h"
objects_t objects;
lv_obj_t *tick_value_change_obj;
static void event_handler_cb_main__obj_button_1(lv_event_t *e) {
static void event_handler_cb_main_obj1(lv_event_t *e) {
lv_event_code_t event = lv_event_get_code(e);
void *flowState = e->user_data;
if (event == LV_EVENT_PRESSED) {
flowPropagateValue(flowState, 3, 1);
flowPropagateValue(flowState, 6, 0);
}
}
static void event_handler_cb_main__obj_button_2(lv_event_t *e) {
static void event_handler_cb_main_obj2(lv_event_t *e) {
lv_event_code_t event = lv_event_get_code(e);
void *flowState = e->user_data;
if (event == LV_EVENT_PRESSED) {
flowPropagateValue(flowState, 5, 1);
flowPropagateValue(flowState, 8, 0);
}
}
void create_screen_main() {
void *flowState = getFlowState(0, 0);
lv_obj_t *obj = lv_obj_create(0);
objects.Main = obj;
objects.main = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, 800, 480);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
@ -50,7 +52,7 @@ void create_screen_main() {
}
{
lv_obj_t *obj = lv_label_create(parent_obj);
objects._obj_label_0 = obj;
objects.obj0 = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "");
@ -59,10 +61,10 @@ void create_screen_main() {
}
{
lv_obj_t *obj = lv_btn_create(parent_obj);
objects._obj_button_1 = obj;
objects.obj1 = obj;
lv_obj_set_pos(obj, 268, 348);
lv_obj_set_size(obj, 100, 40);
lv_obj_add_event_cb(obj, event_handler_cb_main__obj_button_1, LV_EVENT_ALL, flowState);
lv_obj_add_event_cb(obj, event_handler_cb_main_obj1, LV_EVENT_ALL, flowState);
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
{
@ -79,10 +81,10 @@ void create_screen_main() {
}
{
lv_obj_t *obj = lv_btn_create(parent_obj);
objects._obj_button_2 = obj;
objects.obj2 = obj;
lv_obj_set_pos(obj, 408, 348);
lv_obj_set_size(obj, 100, 40);
lv_obj_add_event_cb(obj, event_handler_cb_main__obj_button_2, LV_EVENT_ALL, flowState);
lv_obj_add_event_cb(obj, event_handler_cb_main_obj2, LV_EVENT_ALL, flowState);
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
{
@ -103,11 +105,11 @@ void create_screen_main() {
void tick_screen_main() {
void *flowState = getFlowState(0, 0);
{
const char *new_val = evalTextProperty(flowState, 2, 2, "Failed to evaluate Text in Label widget");
const char *cur_val = lv_label_get_text(objects._obj_label_0);
const char *new_val = evalTextProperty(flowState, 5, 3, "Failed to evaluate Text in Label widget");
const char *cur_val = lv_label_get_text(objects.obj0);
if (strcmp(new_val, cur_val) != 0) {
tick_value_change_obj = objects._obj_label_0;
lv_label_set_text(objects._obj_label_0, new_val);
tick_value_change_obj = objects.obj0;
lv_label_set_text(objects.obj0, new_val);
tick_value_change_obj = NULL;
}
}

12
src/ui/screens.h

@ -8,14 +8,18 @@ extern "C" {
#endif
typedef struct _objects_t {
lv_obj_t *Main;
lv_obj_t *_obj_button_1;
lv_obj_t *_obj_button_2;
lv_obj_t *_obj_label_0;
lv_obj_t *main;
lv_obj_t *obj0;
lv_obj_t *obj1;
lv_obj_t *obj2;
} objects_t;
extern objects_t objects;
enum ScreensEnum {
SCREEN_ID_MAIN = 1,
};
void create_screen_main();
void tick_screen_main();

26
src/ui/structs.h

@ -0,0 +1,26 @@
#ifndef EEZ_LVGL_UI_STRUCTS_H
#define EEZ_LVGL_UI_STRUCTS_H
#if !defined(EEZ_FOR_LVGL)
#warning "EEZ_FOR_LVGL is not enabled"
#define EEZ_FOR_LVGL
#endif
#if defined(EEZ_FOR_LVGL)
#include <eez/flow/flow.h>
#include <stdint.h>
#include <stdbool.h>
#include "vars.h"
using namespace eez;
#endif
#endif /*EEZ_LVGL_UI_STRUCTS_H*/

117
src/ui/ui.c

@ -1,12 +1,90 @@
#if defined(EEZ_FOR_LVGL)
#include <eez/core/vars.h>
#endif
#include "ui.h"
#include "screens.h"
#include "images.h"
#include "flow_def.h"
#include "actions.h"
#include "vars.h"
// ASSETS DEFINITION
const uint8_t assets[972] = {
0x7E, 0x45, 0x45, 0x5A, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x03, 0xE0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x3C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
0x00, 0x00, 0xFF, 0xFF, 0x10, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x34, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x50, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x65, 0x66, 0x61,
0x75, 0x6C, 0x74, 0x00, 0xFF, 0xFF, 0x08, 0x42, 0x2C, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
0x74, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0xAC, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x00,
0xE4, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1C, 0x01, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00,
0x54, 0x01, 0x00, 0x00, 0xEF, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x58, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4C, 0x01, 0x00, 0x00,
0xFF, 0xFF, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x01, 0x00, 0x00, 0xEF, 0x03, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x3C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x28, 0x01, 0x00, 0x00, 0x20, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0x00, 0x00, 0x21, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0x00, 0x00, 0x21, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0x00, 0x00, 0x22, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0x00, 0x00, 0x23, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0xCC, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0x00, 0x00, 0x22, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0x00, 0x00, 0x23, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0xA8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xAC, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0x00, 0x00, 0x22, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00,
0x94, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00,
0x94, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00,
0x94, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00,
0x94, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00,
0x9C, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00,
0x9C, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x00,
0xA4, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00,
0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00,
0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00,
0x00, 0x40, 0x00, 0xE0, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00,
0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00,
0x00, 0xE0, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x40, 0x00, 0xF0,
0x07, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x01, 0xC0, 0x00, 0xE0, 0x00, 0x40, 0x00, 0xF0,
0x07, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0xC0, 0x00, 0xE0, 0x08, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x1C, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
native_var_t native_vars[] = {
{ NATIVE_VAR_TYPE_NONE, 0, 0 },
};
ActionExecFunc actions[] = {
0
};
#if defined(EEZ_FOR_LVGL)
void ui_init() {
eez_flow_init(assets, sizeof(assets), (lv_obj_t **)&objects, sizeof(objects), images, sizeof(images), actions);
}
@ -15,3 +93,40 @@ void ui_tick() {
eez_flow_tick();
tick_screen(g_currentScreen);
}
#else
static int16_t currentScreen = -1;
static lv_obj_t *getLvglObjectFromIndex(int32_t index) {
if (index == -1) {
return 0;
}
return ((lv_obj_t **)&objects)[index];
}
static const void *getLvglImageByName(const char *name) {
for (size_t imageIndex = 0; imageIndex < sizeof(images) / sizeof(ext_img_desc_t); imageIndex++) {
if (strcmp(images[imageIndex].name, name) == 0) {
return images[imageIndex].img_dsc;
}
}
return 0;
}
void loadScreen(enum ScreensEnum screenId) {
currentScreen = screenId - 1;
lv_obj_t *screen = getLvglObjectFromIndex(currentScreen);
lv_scr_load_anim(screen, LV_SCR_LOAD_ANIM_FADE_IN, 200, 0, false);
}
void ui_init() {
create_screens();
loadScreen(SCREEN_ID_MAIN);
}
void ui_tick() {
tick_screen(currentScreen);
}
#endif

28
src/ui/ui.h

@ -1,9 +1,37 @@
#ifndef EEZ_LVGL_UI_GUI_H
#define EEZ_LVGL_UI_GUI_H
#include <lvgl/lvgl.h>
#if !defined(EEZ_FOR_LVGL)
#warning "EEZ_FOR_LVGL is not enabled"
#define EEZ_FOR_LVGL
#endif
#if defined(EEZ_FOR_LVGL)
#include <eez/flow/lvgl_api.h>
#endif
#if !defined(EEZ_FOR_LVGL)
#include "screens.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern const uint8_t assets[972];
void ui_init();
void ui_tick();
#if !defined(EEZ_FOR_LVGL)
void loadScreen(enum ScreensEnum screenId);
#endif
#ifdef __cplusplus
}
#endif
#endif // EEZ_LVGL_UI_GUI_H

112
src/ui/ui_image_log_eez.c

File diff suppressed because one or more lines are too long

21
src/ui/vars.h

@ -2,7 +2,28 @@
#define EEZ_LVGL_UI_VARS_H
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
// enum declarations
// Flow global variables
enum FlowGlobalVariables {
FLOW_GLOBAL_VARIABLE_NONE
};
// Native global variables
#ifdef __cplusplus
}
#endif
#endif /*EEZ_LVGL_UI_VARS_H*/
Loading…
Cancel
Save