1.. _renesas_glcdc:
2
3=============
4Renesas GLCDC
5=============
6
7Overview
8--------
9
10.. image:: /misc/renesas/glcdc.png
11    :alt: Architectural overview of Renesas GLCDC
12    :align: center
13
14<br/>
15
16GLCDC is a multi-stage graphics output peripheral used in Renesas MCUs.
17It is designed to automatically generate timing and data signals for different LCD panels.
18
19- Supports LCD panels with RGB interface (up to 24 bits) and sync signals (HSYNC, VSYNC and Data Enable optional)
20- Supports various color formats for input graphics planes (RGB888, ARGB8888, RGB565, ARGB1555, ARGB4444, CLUT8, CLUT4, CLUT1)
21- Supports the Color Look-Up Table (CLUT) usage for input graphics planes (ARGB8888) with 512 words (32 bits/word)
22- Supports various color formats for output (RGB888, RGB666, RGB565, Serial RGB888)
23- Can input two graphics planes on top of the background plane and blend them on the screen
24- Generates a dot clock to the panel. The clock source is selectable from internal or external (LCD_EXTCLK)
25- Supports brightness adjustment, contrast adjustment, and gamma correction
26- Supports GLCDC interrupts to handle frame-buffer switching or underflow detection
27
28
29Setting up a project and further integration with Renesas' ecosystem is described in detail on :ref:`page Renesas <renesas>`.
30Check out the following repositories for ready-to-use examples:
31
32- `EK-RA8D1 <https://github.com/lvgl/lv_port_renesas_ek-ra8d1>`__
33- `EK-RA6M3G <https://github.com/lvgl/lv_port_renesas_ek-ra6m3g>`__
34- `RX72N Envision Kit <https://github.com/lvgl/lv_port_renesas_rx72n-envision-kit>`__
35
36
37Prerequisites
38-------------
39
40- This diver relies on code generated by e² studio. Missing the step while setting up the project will cause a compilation error.
41- Activate the diver by setting :c:macro:`LV_USE_RENESAS_GLCDC` to ``1`` in your *"lv_conf.h"*.
42
43Usage
44-----
45
46There is no need to implement any platform-specific functions.
47
48The following code demonstrates using the diver in :cpp:enumerator:`LV_DISPLAY_RENDER_MODE_DIRECT` mode.
49
50.. code-block:: c
51
52    lv_display_t * disp = lv_renesas_glcdc_direct_create();
53    lv_display_set_default(disp);
54
55To use the driver in :cpp:enumerator:`LV_DISPLAY_RENDER_MODE_PARTIAL` mode, an extra buffer must be allocated,
56preferably in the fastest available memory region.
57
58Buffer swapping can be activated by passing a second buffer of same size instead of the :cpp:expr:`NULL` argument.
59
60.. code-block:: c
61
62    static lv_color_t partial_draw_buf[DISPLAY_HSIZE_INPUT0 * DISPLAY_VSIZE_INPUT0 / 10] BSP_PLACE_IN_SECTION(".sdram") BSP_ALIGN_VARIABLE(1024);
63
64    lv_display_t * disp = lv_renesas_glcdc_partial_create(partial_draw_buf, NULL, sizeof(partial_draw_buf));
65    lv_display_set_default(disp);
66
67.. note::
68
69    Partial mode can be activated via the macro in ``src/board_init.c`` file of the demo projects.
70
71
72Screen rotation
73"""""""""""""""
74
75Software based screen rotation is supported in partial mode. It uses the common API, no extra configuration is required:
76
77.. code-block:: c
78
79    lv_display_set_rotation(lv_display_get_default(), LV_DISP_ROTATION_90);
80    /* OR */
81    lv_display_set_rotation(lv_display_get_default(), LV_DISP_ROTATION_180);
82    /* OR */
83    lv_display_set_rotation(lv_display_get_default(), LV_DISP_ROTATION_270);
84
85Make sure the heap is large enough, as a buffer with the same size as the partial buffer will be allocated.
86