meta-digi-dey provides the lvgl-demo_8.3.0.bb recipe for the LVGL example included in the dey-image-lvgl image. This recipe uses the lv-drivers.inc file, which handles logic associated with LVGL’s lv_drivers library. Both of these files abstract the LVGL demo, allowing you to change its parameters via the Yocto configuration without having to modify the C sources directly.

Modify LVGL parameters

You can modify the following LVGL parameters in your conf/local.conf file:

  • LV_DRV_DISP_HOR_RES determines the application’s horizontal resolution. This parameter is handled in lv-drivers.inc and has a default value of 800. Its value should always be equal to or smaller than the maximum horizontal resolution of the display you’re using.

  • LV_DRV_DISP_VER_RES determines the application’s vertical resolution. This parameter is handled in lv-drivers.inc and has a default value of 480. Its value should always be equal to or smaller than the maximum vertical resolution of the display you’re using.

  • LVGL_CONFIG_EVDEV_INPUT determines the path to the evdev input device, which is used in the drm and fbdev back ends. Its default value is /dev/input/mouse0, a mouse.

  • PACKAGECONFIG:class-target-pn-lvgl-demo determines the LVGL back end, which can be set to:

    • wayland, recommended for environments with the Wayland desktop back end.

    • sdl, which relies on libsdl2 to handle both the rendering and the inputs.

    • drm, which relies on libdrm to render the application. The demo has been designed to query the DRM subsystem for the display’s resolution when using this back end, so both LV_DRV_DISP_HOR_RES and LV_DRV_DISP_VER_RES are ignored in this case.

    • fbdev, which renders the application directly to the system’s framebuffer.

For example, the following lines configure the demo for a 1280x720 display, use the touchscreen as input device, and use the fbdev back end:

conf/local.conf
LV_DRV_DISP_HOR_RES = "1280"
LV_DRV_DISP_VER_RES = "720"
LVGL_CONFIG_EVDEV_INPUT = "/dev/input/touchscreen"
PACKAGECONFIG:class-target-pn-lvgl-demo = "fbdev"

Build the firmware

After changing the parameters, you can build a full image or a software update package.

Digi Embedded Yocto provides two recipes to build firmware with the LVGL demo:

You can use these recipes or your own to create your firmware. To develop your own apps using LVGL, see Develop your own LVGL applications.