LVGL basic sample

Overview

This sample application displays “Hello World” in the center of the screen and a counter at the bottom which increments every second. Based on the available input devices on the board used to run the sample, additional widgets may be displayed and additional interactions enabled:

  • Pointer

    If your board has a touch panel controller (zephyr,lvgl-pointer-input), a button widget is displayed in the center of the screen. Otherwise a label widget is displayed.

  • Button

    The button pseudo device (zephyr,lvgl-button-input) maps a press/release action to a specific coordinate on screen. In the case of this sample, the coordinates are mapped to the center of the screen.

  • Encoder

    The encoder pseudo device (zephyr,lvgl-encoder-input) can be used to navigate between widgets and edit their values. If the board contains an encoder, an arc widget is displayed, which can be edited.

  • Keypad

    The keypad pseudo device (zephyr,lvgl-keypad-input) can be used for focus shifting and also entering characters inside editable widgets such as text areas. If the board used with this sample has a keypad device, a button matrix is displayed at the bottom of the screen to showcase the focus shifting capabilities.

Requirements

Display shield and a board which provides a configuration for corresponding connectors, for example:

or a board with an integrated display:

or a simulated display environment in a native_sim application:

or

or

Building and Running

Example building for nRF52840 DK:

# From the root of the zephyr repository
west build -b nrf52840dk/nrf52840 --shield adafruit_2_8_tft_touch_v2 samples/subsys/display/lvgl
west flash

Example building for native_sim:

# From the root of the zephyr repository
west build -b native_sim samples/subsys/display/lvgl
west build -t run

Alternatively, if building from a 64-bit host machine, the previous target board argument may also be replaced by native_sim/native/64.

References

See also

Display Interface
Input Interface