Skip to content

LittlevGL Example

The LittlevGL Example demonstrates how to use the LittlevGL library API functions to draw graphic objects on the LCD.

This sample application displays “Hello World” in the center of the screen and a counter at the bottom which increments every second.

Before you start building, the Zephyr development environment should be set up correctly:

Build the example

You can find the source code and the project file of the example in the following folder: examples/zephyr/lvgl.

Build the example by performing the following steps:

  1. Open terminal and navigate to the m2devkit directory created in the Setup the toolchain section:

    cd <sourcecode_root>/m2devkit
    
  2. Use west to build the example:

    west build -b nrf52840_m2 nrf52840-m2-devkit/examples/zephyr/lvgl
    

Tip

If a build system is present, make the build folder pristine before building:

west build -t pristine

Flash the example

After compiled successfully, the firmware is located in m2devkit/build/zephyr with the name zephyr.hex.

Connect the debugger USB port to your PC using the provided USB-C Cable. A disk drive called M2-DOCK will be automatically detected by the computer.

Run the following command to flash the board:

west flash

Testing

Test the LittlevGL Example application by performing the following steps:

  1. Connect the debugger USB port to your PC

  2. Run a terminal application like PuTTY or screen:

    screen /dev/cu.usbmodem14102 115200
    
  3. Press RESET button, and observe the output of the terminal:

  4. Observe the graphic objects on the LCD screen:

    LCD Display

Create an Issue

Interested in contributing to this project? Want to report a bug? Feel free to click here: