I’m trying to figure out how to set up my LVGL project in a way that LVGL’s Pro Editor likes it. I’ve been trolling through all the demos, documentation and a string of projects but none really get into the Editor’s way of creating the project. My experience is mostly C# & C++, so there might be some core concept of C that I just don’t know.
Or, maybe there is something like #define LV_IGNORE_THIS or something to STUB out that is hidden in the documentation.
So, lets say I have a code layout like this:
+src/main.c
- Top level file, includes “demo.h” and “logic.h”
+src/logic.c (and .h)
- Business logic, things like “access a database” and “read from a network”
- demo/demo.c (and .h) ← Export from LVGL XML project
- demo/demo_gen.c (and .h) ← Export from LVGL XML project
In demo.c, I have a function called “button_clicked” that is called via callback from a button on a screen created in the XML project. I want it to be able to call a function in logic.h. In my normal C#/C++ mind, I tag of a rider to the button_clicked event in the initliazation of logic.h.
void button_clicked(lv_event_t * e)
{
call_function_in_logic_h();
}
So, here is where things get murky.
If I try to build in LVGL, it gets upset because it can’t find that undefined symbol.
No problem. Add in an extern in demo.c:
extern void call_function_in_logic_h();
This will build at the top level build. But LVGL Editor fails: undefined symbol: call_function_in_logic_h
I went on to try different methods to do something like how there used to be lv_msg() in 8.0x to try to set it up to have some sort of global event sender. But I can’t figure out the functions to bind an event that might not exist when the screen changes or if I am going down the wrong rabbit hole.
So, I’m stuck with trying to figure out the “intended” way of using the lvgl project. I wish there was a simple short project like the lv_port set that is just a really,really simple LVGL Editor project with a wrapper to guide this expectation.