<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">QUANTUM_PAINTER_LVGL_INTEGRATION = yes</span></span></code></pre></div><p>To configure the Quantum Painter Display Drivers please read the <ahref="./quantum_painter#quantum-painter-drivers">Quantum Painter Display Drivers</a> section.</p><h2id="lvgl-api"tabindex="-1">Quantum Painter LVGL API <aclass="header-anchor"href="#lvgl-api"aria-label="Permalink to "Quantum Painter LVGL API {#lvgl-api}""></a></h2><h3id="lvgl-api-init"tabindex="-1">Quantum Painter LVGL Attach <aclass="header-anchor"href="#lvgl-api-init"aria-label="Permalink to "Quantum Painter LVGL Attach {#lvgl-api-init}""></a></h3><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">bool</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> qp_lvgl_attach</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">painter_device_t</span><spanstyle="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> device</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span></code></pre></div><p>The <code>qp_lvgl_attach</code> function is used to set up LVGL with the supplied display, and requires an already configured display.</p><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">static</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> painter_device_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> display;</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">qp_lvgl_attach</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(display)) {</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Attach LVGL to the display</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ...Your code to draw</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Run LVGL specific code to draw</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>To init. the display please read the <ahref="./quantum_painter#quantum-painter-api-init">Display Initialisation</a> section.</p><divclass="warning custom-block"><pclass="custom-block-title">WARNING</p><p>Attaching LVGL to a display means LVGL subsequently "owns" the display. Using standard Quantum Painter drawing operations with the display after LVGL attachment will likely result in display artifacts.</p></div><h3id="lvgl-api-detach"tabindex="-1">Quantum Painter LVGL Detach <aclass="header-anchor"href="#lvgl-api-detach"aria-label="Permalink to "Quantum Painter LVGL Detach {#lvgl-api-detach}""></a></h3><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">void</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> qp_lvgl_detach</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">void</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div><p>The <code>qp_lvgl_detach</code> function stops the internal LVGL ticks and releases resources related to it.</p><h2id="lvgl-configuring"tabindex="-1">Enabling/Disabling LVGL features <aclass="header-anchor"href="#lvgl-configuring"aria-label="Permalink to "Enabling/Disabling LVGL features {#lvgl-configuring}""></a></h2><p>You can overwrite LVGL specific features in your <code>lv_conf.h</code> file.</p><h2id="changing-the-lvgl-task-frequency"tabindex="-1">Changing the LVGL task frequency <aclass="header-anchor"href="#changing-the-lvgl-task-frequency"aria-label="Permalink to "Changing the LVGL task frequency""></a></h2><p>When LVGL is running, your keyboard's responsiveness may decrease, causing missing keystrokes or encoder rotations, especially during the animation of dynamically-generated content. This occurs because LVGL operates as a scheduled task with a default task rate of five milliseconds. While a fast task rate is advantageous when LVGL is responsible for detecting and processing inputs, it can lead to excessive recalculations of displayed content, which may slow down QMK's matrix scanning. If you rely on QMK instead of LVGL for processing inputs, it can be beneficial to increase the time between calls to the LVGL task handler to better match your preferred display update rate. To do this, add this to your <code>config.h</code>:</p><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> QP_LVGL_TASK_PERIOD</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 40</span></span></code></pre></div></div></div></main><footerclass="VPDocFooter"data-v-39a288b8data-v-09de1c0f><!--[--><!--]--><divclass="edit-info"data-v-09de1c0f><divclass="edit-link"data-v-09de1c0f><aclass="VPLink link vp-external-link-icon no-icon edit-link-button"href="https://github.com/qmk/qmk_firmware/edit/master/docs/quantum_painter_lvgl.md"target="_blank"rel="noreferrer"data-v-09de1c0f><!--[--><spanclass="vpi-square-pen edit-link-icon"data-v-09de1c0f></span> Edit this page<!--]--></a></div><!----></div><navclass="prev-next"data-v-09de1c0f><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link prev"href="/quantum_painter"data-v-09de1c0f><!--[--><spanclass="desc"data-v-09de1c0f>Previous page</span><spanclass="title"data-v-09de1c0f>Quantum Painter</span><!--]--></a></div><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link next"href="/features/hd44780"da