Debian Codegraph @

lvgl/docs/src/integration/chip_vendors/nxp/elcdif.rst

raw
1 .. _nxp_elcdif:
2
3 =============
4 NXP eLCDIF
5 =============
6
7 Overview
8 --------
9 eLCDIF is a peripheral that is provided on some of the NXP devices capable to drive display panels through
10 the RGB interface, it supports different color depths and, on MIPI-DSI capable devices, its output ca be
11 directed to the MIPI display physical interface. The LVGL's NXP eLCDIF driver is responsible to bind the
12 NXP MCUx SDK low-level driver to the LVGL display subsystem.
13
14
15 Prerequisites
16 -------------
17
18 - This driver relies on the presence of the MCUx SDK from NXP in the same project
19 - Activate the driver by setting :c:macro:`LV_USE_NXP_ELCDIF` to ``1`` in your *"lv_conf.h"*.
20
21 Usage
22 -----
23
24 The LVGL driver for eLCDIF assumes the platform already configured the display low-level driver,
25 set the pin-mux, clocks, etc. It also requires the base address of the peripheral and configuration
26 structure already set.
27
28 The following code demonstrates using the driver in :cpp:enumerator:`LV_DISPLAY_RENDER_MODE_DIRECT` mode,
29 please notice in this mode of operation the application is responsible to allocate the framebuffers space
30 and pass them to the display, in the example below `buffer1` and `buffer2` are the current and the next
31 buffers that will be copied to the display screen, being swapped at each flush operation (managed
32 internally by the display driver). Also observe, in direct mode, each buffer should have the space at
33 least to hold at least the size of the screen, that is it, the height times the width times the bytes
34 for a pixel (which is application dependent or display supported), on the code below this size is represented
35 by `buf_size`.
36
37 .. code-block:: c
38
39 elcdif_rgb_mode_config_t config;
40 ELCDIF_RgbModeGetDefaultConfig(&config);
41
42 lv_display_t * g_disp = lv_nxp_display_elcdif_create_direct(LCDIF, config, buffer1, buffer2, buf_size);
43 lv_display_set_default(g_disp);
44
45 To use the driver in :cpp:enumerator:`LV_DISPLAY_RENDER_MODE_PARTIAL` mode, an extra buffer must be allocated,
46 preferably in the fastest available memory region.
47
48 Buffer swapping can be activated by passing a second buffer of same size instead of the :cpp:expr:`NULL` argument.
49 please notice in this case the `BUF_SIZE` needs to have, at least, space to hold data of 1/10 of the actual
50 display dimensions.
51
52 .. code-block:: c
53
54 #define BUF_SIZE (DISPLAY_HEIGHT * DISPLAY_WIDTH / 10 * 2) /*1/10 screen size for RGB565 format*/
55 static uint8_t partial_draw_buf[BUF_SIZE];
56 lv_display_t * g_disp = lv_nxp_display_elcdif_create_partial(LCDIF, config, partial_draw_buf, NULL, BUF_SIZE);
57
58 In runtime, the event handler function from the eLCDIF driver should be called inside of the eLCDIF interrupt handler
59 This function is responsible for notify the LVGL display subsystem about a finished flush operation:
60
61 .. code-block:: c
62
63 void eLCDIF_IRQ_Handler(void)
64 {
65 lv_nxp_display_elcdif_event_handler(g_disp);
66 }