Display

Introduction

Ameba display architecture adopts LVGL as GUI engine. LVGL is the most popular free and open-source embedded graphics library to create beautiful UIs for any MCU, MPU and display type. The whole architecure provides reference porting of the LVGL and many reference drivers. In addition to LVGL, the whole architecture also provides robust Wi-Fi/Bluetooth functionalities, smart voice algorithm, commonly used network protocol stacks and more, making it widely used in consumer electronics, home appliances.

../../rst_rtos/4_multimedia/figures/display_architecture.svg

Core Components

Components

The core functional components of the display mainly include:

  • GUI Rendering: LVGL provides a rich set of UI components (buttons, sliders, lists, etc.).

  • Communication Capabilities: Integration of protocol stacks like Wi-Fi, Bluetooth, USB, etc.

  • Multimedia Support: Audio playback, image decoding (JPEG/PNG).

  • Intelligent Interaction: AI voice recognition, touch control (Touch Driver).

Application Scenarios

The main application scenarios include:

  • Consumer Electronics (smart home, wearable devices).

  • Industrial HMI (Human-Machine Interface).

  • IoT Terminals (gateways, sensor nodes).

Application

The role of the application layer is to serve as the user interaction entry point, containing predefined application scenarios.

Module Name

Function Description

Launcher

Main screen interface, application launcher.

Settings

System settings (display, network, sound, etc.).

Music

Audio player.

Speech

Voice assistant interaction interface.

LVGL Library

LVGL Engine

LVGL (Light and Versatile Graphics Library) is responsible for graphical rendering, event handling, and animation effects.

Implement

The implementation of LVGL in SDK is as below.

Module

Location

LVGL 8.3

{sdk}/component/ui/LVGL/lvgl-8.3/lvgl

LVGL 8.3 driver

{sdk}/component/ui/LVGL/lvgl-8.3/lv_drivers

LVGL 9.2

{sdk}/component/ui/LVGL/lvgl-9.2/lvgl

LVGL 9.2 driver

{sdk}/component/ui/LVGL/lvgl-9.2/lv_drivers

For more details for LVGL, please refer to LVGL v8.3 and LVGL v9.2.

Configuration

In the SDK, you can enable the options of LVGL.

Enable Enable LVGL Graphics Library at CONFIG APPLICATION > Graphics Libraries Configuration > Graphics Library Selection.

../../rst_rtos/4_multimedia/figures/display_lvgl_library_enable_lvgl.png

For the supported LVGL versions, you can select it before building.

Select the version as your wish at CONFIG APPLICATION > Graphics Libraries Configuration > Graphics Library Selection > Enable LVGL Graphics Library > LVGL Version.

../../rst_rtos/4_multimedia/figures/display_lvgl_library_sel_version.png

Driver APIs

To use the LVGL core library you have to initialize it and setup required components. The order of the initialization is as below.

  • Calls lv_init().

  • Uses lv_hal_init(int32_t w, int32_t h)() to initialize the display drivers and input drivers.

  • Draw your UI app by using LVGL core library.

  • Call lv_timer_handler() every few milliseconds to handle LVGL related tasks.

Here is an example.

int your_app(void) {
   lv_init();
   lv_hal_init(480, 800);
   /* Something else ... */
   /* ...... */
   while(1) {
      lv_task_handler();
      usleep(1000);
   }
}

Peripheral Component

Descriptions of the various peripheral components provided by the framework are as follows.

Name

Library

Function

libjpeg/libpng

Image decoding library

JPEG and PNG image loading

zlib

compression library

compress or decompress files

Wi-Fi/LwIP

network protocol

Wireless connection and communication

Bluetooth

bluetooth protocol

Nearby communication and transfer

Audio

audio driver

Playback control, volume adjustment

VFS

Virtual Filesystem

Supports multiple storage media

USB

USB protocol

Peripheral connectivity

Driver

Function

The driver is primarily responsible for hardware abstraction and control, as detailed below.

Driver type

hardware

Function

Touch Driver

capacitive and resistive touch screens

Touch-coordinate acquisition and gesture recognition

Panel Driver

LCD/OLED display screen

Display-mode configuration and backlight control

Key Driver

Key

Key-state detection and interrupt handling

Implement

The implementation of driver is as below.

Driver

Location

display for v8.3

{sdk}/component/ui/LVGL/lvgl-8.3/lv_drivers/amebadplus/src/display.c

display for v9.2

{sdk}/component/ui/LVGL/lvgl-9.2/lv_drivers/amebadplus/src/display.c

Fwlib

The fwlib is primarily responsible for the low-level hardware operation libraries, as detailed below.

Library Name

Hardware Interface

Application

ameba_lcd

LCD Controller

Display initialization, pixel format setting

ameba_mipi

MIPI Interface Protocol Stack

High-speed data transmission

ameba_spi

SPI Bus

Peripheral communication

ameba_i2c

I2C Bus

Low-speed device control

ameba_ppe

Hardware Acceleration Engine

Graphics rendering acceleration, DMA transfer