Apologies for the vague question, but I’m not quite familiar enough with LVGL to ask something more specific.
Typically when I write embedded code for a “low-level” environment (ie. no OS bigger than FreeRTOS), I’ll try to separate things by having eg. one component emit events I define (eg.
USER_OPERATION_START) and another component that listens for these events and does the appropriate thing. Typically these components will be separated by role eg. network functions is one, serial console is another.
For example, with the ESP32 I’d use
esp_event_post(...) (which uses FreeRTOS under the hood). So a network component might post a
DATA_REFRESH event that the UI registers to handle. Or the UI might post a
OPERATION_CANCEL event that the network stack handles.
Now that I’m using LVGL on an embedded Linux system, I’m not sure how this all relates to LVGL’s own event loop ie.
lv_send_event(...). It looks like these are purely for UI objects ie. I should not be trying to overload them to process my own events that are not LVGL-related. So perhaps I need to use another event library like
libev, and perhaps even hook LVGL into that instead of using pthreads/nanosleep etc (which is, in a way, using the kernel’s event loop), and note the caveats in the LVGL docs about thread safety.
If this is right, can anyone offer advice for a light-ish event library that might comfortably run on a router chipset with OpenWRT? (As in, if you’ve used one and it was good, I’d love to know about it.)
Or am I wrong about this, and it would be sensible to use LVGL’s event system for my own non-UI stuff? And if that’s right, are there examples or tutorials that go into more detail on such use?