NXP eLCDIF

eLCDIF drives display panels through the RGB interface on some NXP devices. LVGL's driver binds the MCUXpresso SDK low-level driver to the LVGL display subsystem.

Edit on GitHub

Overview

eLCDIF is a peripheral available on some NXP devices that is capable of driving display panels through the RGB interface. It supports different color depths and, on MIPI-DSI capable devices, its output can be directed to the MIPI display physical interface. LVGL's NXP eLCDIF driver binds the NXP MCUXpresso SDK low-level driver to the LVGL display subsystem.

Prerequisites

  • This driver relies on the presence of the MCUXpresso SDK from NXP in the same project.
  • Activate the driver by setting LV_USE_NXP_ELCDIF to 1 in your lv_conf.h.

Usage

The LVGL driver for eLCDIF assumes that the platform has already configured the display low-level driver, the pin mux, the clocks, and so on. It also requires the base address of the peripheral and an already initialized configuration structure.

The following code demonstrates using the driver in LV_DISPLAY_RENDER_MODE_DIRECT mode.

In this mode the application is responsible for allocating the frame buffers and passing them to the display. In the example below, buffer1 and buffer2 are the current and the next buffers that will be copied to the display screen, swapped at each flush operation (managed internally by the display driver).

Note that in direct mode each buffer must be large enough to hold a full screen, that is, the height times the width times the bytes per pixel (which depends on the application and on what the display supports). In the code below this size is represented by buf_size.

 
elcdif_rgb_mode_config_t config;
ELCDIF_RgbModeGetDefaultConfig(&config);

lv_display_t * g_disp = lv_nxp_display_elcdif_create_direct(LCDIF, config, buffer1, buffer2, buf_size);
lv_display_set_default(g_disp);

To use the driver in LV_DISPLAY_RENDER_MODE_PARTIAL mode, an extra buffer must be allocated, preferably in the fastest available memory region.

Buffer swapping can be activated by passing a second buffer of the same size instead of the NULL argument. In this case BUF_SIZE needs to hold at least 1/10 of the actual display dimensions.

 
#define BUF_SIZE (DISPLAY_HEIGHT * DISPLAY_WIDTH / 10 * 2) /*1/10 screen size for RGB565 format*/
static uint8_t partial_draw_buf[BUF_SIZE];
lv_display_t * g_disp = lv_nxp_display_elcdif_create_partial(LCDIF, config, partial_draw_buf, NULL, BUF_SIZE);

At runtime, the event handler function of the eLCDIF driver must be called inside the eLCDIF interrupt handler. This function notifies the LVGL display subsystem about a finished flush operation:

 
void eLCDIF_IRQ_Handler(void)
{
    lv_nxp_display_elcdif_event_handler(g_disp);
}

Last updated on

On this page