You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+63-9Lines changed: 63 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,66 @@
1
-
# LVGL web simulator project with EEZ Studio
1
+
# Example of native interface between EEZ Studio and LVGL when EEZ Flow is not used
2
2
3
-
## How to get started
3
+
## User actions
4
+
5
+
In LVGL project with EEZ Flow you can define user actions that can be attached to the event handlers. You are doing this in 4 steps:
6
+
7
+
- Step 1: Add user actions
8
+
9
+
Go to User Actions tab, press + button, enter the name of user action and press OK:
10
+
11
+

12
+
13
+

14
+
15
+
- Step 2: Set the "Implementation type" property of user action to "Native"
16
+
17
+

18
+
19
+
Note: You can still provide flow implementation of native function. This implemenentation will be used when running project inside EEZ Studio with the Run button.
20
+
21
+
- Step 3: Create event handler and attach it to the user action
22
+
23
+
Select widget, for example Button, and in properties find Events section and press + button:
You need to implement in C++ function called `void action_<user action name>(lv_event_t * e)`. For example, if user action is called `inc_counter` you need to implement `void action_inc_counter(lv_event_t * e);`. Declaration of all user actions can be found in generated file `actions.h`. You can implement user actions in any C file or you can add `actions.cpp` file template in your project like this:
In LVGL project with EEZ Flow you can define native global variables with the get/set functions that you must implement in C++. You are doing this in 3 steps:
40
+
41
+
- Step 1: Add global variable
42
+
43
+
Go to Variables tab, select Global, press + button, enter the name and type of variable and press OK:
You need to implement in C++, for each variable, functions called `<variable type> get_var_<variable name>()` and `void set_var_<variable name>(<variable_type> value)`. For example, if variable is called `selected_item` and type is `integer` you need to implement `int32_t get_var_selected_item();` and `void set_var_selected_item(int32_t value)`. Function declarations for all variables can be found in generated file `vars.h`. You can implement these functions in any C++ file or you can add `vars.cpp` file template in your project like this:
56
+
57
+

58
+
59
+
## Accessing flow variables from the native code
60
+
61
+
Chech the `vars.cpp` file to see how can you **set flow variable value** from native code (check function `init_vars` from `vars.cpp`), or how can you **get flow variable value** from natiave code (check function `get_var_greeting_str` from `vars.cpp`).
62
+
63
+
## How to build project
4
64
5
65
### Install SDL
6
66
@@ -23,15 +83,9 @@ Download the [Emscripten SDK](https://kripken.github.io/emscripten-site/) and ma
23
83
More info here: https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html
0 commit comments