Skip to content

LVGL graphics library

lbuild module: modm:lvgl

LVGL is a free and open-source graphics library providing everything you need to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint.

Configuration

LVGL defines defaults for all it's configuration settings, which you can find in the configuration template.

This module generates a lv_conf.h file to define the options necessary for integration with modm which are:

  • Heap is provided by the modm:platform:heap module.
  • Tick is implemented via the modm:platform:clock module.
  • LV_LOG_PRINTF = 0: logging is redirected to MODM_LOG_* if the modm:debug module is included and LV_USE_LOG = 1.

To add your own configuration you can create a <lv_conf_local.h> file which will automatically be included at the beginning of our lv_conf.h.

Example <lv_conf_local.h> configuration:

// Maximal resolutions
#define LV_HOR_RES_MAX  240
#define LV_VER_RES_MAX  320
#define LV_DPI          200

/* Color depth:
 * - 1:  1 byte per pixel
 * - 8:  RGB332
 * - 16: RGB565
 * - 32: ARGB8888
 */
#define LV_COLOR_DEPTH  16

// Enable logging at INFO level
#define LV_USE_LOG    1
#define LV_LOG_LEVEL  LV_LOG_LEVEL_INFO

// Disable anti-aliasing
#define LV_ANTIALIAS  0

Initialization

modm will call lv_init() as a constructor with priority 1000 and then set the required callbacks for the modm port to work. Static constructors are called afterwards therefore can already use the LVGL functions.

Dependencies

modm:lvgl modm_lvgl modm: lvgl modm_architecture_clock modm: architecture: clock modm_lvgl->modm_architecture_clock modm_platform_heap modm: platform: heap modm_lvgl->modm_platform_heap