LVGLDriver is a helper class to initialize LVGL v9 with a TinyGPU Output driver. It sets up the display buffer and flush callback for LVGL.
More...
#include <LVGLDriver.h>
|
| static void | display (lv_display_t *disp, const lv_area_t *area, uint8_t *px_map) |
| |
| static void | setGamma (float gammaR, float gammaG, float gammaB) |
| |
|
| lv_indev_t * | setupTouch () |
| | Registers a touch driver with this LVGL display instance.
|
| |
| void | dumpBuffer (const uint8_t *data, size_t len) |
| |
template<typename RGB_T = RGB565>
class LVGLDriver< RGB_T >
LVGLDriver is a helper class to initialize LVGL v9 with a TinyGPU Output driver. It sets up the display buffer and flush callback for LVGL.
- Template Parameters
-
| RGB_T | The pixel format LVGL's rendered output is converted to before transmission. Defaults to RGB565, matching LVGL's own internal RGB565 color format (convertBuffer() below still has to undo RGB565's own byte-swapped storage - see RGB565.h - even in that default case). |
◆ LVGLDriver()
◆ begin()
◆ convertBuffer()
| static void convertBuffer |
( |
uint8_t * |
px_map, |
|
|
size_t |
pixelCount |
|
) |
| |
|
inlinestaticprotected |
Converts a buffer LVGL packed as (native-order) RGB565 into RGB_T's own byte layout, applying per-channel gamma correction (see setGamma()), in place. Each pixel is decoded with RGB565's semantics (what LVGL actually wrote), gamma corrected, and re-encoded via RGB_T::fromRGB(), so RGB_T's own compensation (if any) is genuinely applied regardless of how RGB_T's constructor happens to order its arguments.
◆ delay()
| void delay |
( |
uint32_t |
ms | ) |
|
|
inline |
◆ display()
| static void display |
( |
lv_display_t * |
disp, |
|
|
const lv_area_t * |
area, |
|
|
uint8_t * |
px_map |
|
) |
| |
|
inlinestatic |
◆ dumpBuffer()
| void dumpBuffer |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlineprotected |
◆ end()
◆ gammaB_()
◆ gammaG_()
◆ gammaR_()
◆ getDriver()
Provides a reference to the underlying DisplayDriver instance used by this LVGLDriver (an SPI panel driver on ESP32, DisplayDriverSDL on desktop, or any other DisplayDriver<RGB_T> implementation).
◆ hasTouchDriver()
| bool hasTouchDriver |
( |
| ) |
const |
|
inline |
Checks if a touch driver has been set for this LVGLDriver.
◆ my_tick()
| static uint32_t my_tick |
( |
void |
| ) |
|
|
inlinestaticprotected |
◆ setGamma()
| static void setGamma |
( |
float |
gammaR, |
|
|
float |
gammaG, |
|
|
float |
gammaB |
|
) |
| |
|
inlinestatic |
Applies independent per-channel gamma correction to every color LVGL renders, before RGB_T's own field layout/compensation is applied. gammaR=gammaG=gammaB=1.0 (the default) applies no correction.
This is deliberately per-channel rather than one shared curve: some panels show a visible color tint in near-black/grey tones even with correct field compensation, because the panel's red/green/blue subpixels have different non-linear responses at low brightness. A single gamma applied equally to R, G and B can only ever change overall brightness - if R=G=B going in, the same curve on all three still gives R=G=B going out, so it mathematically cannot fix a hue tint in grey tones. Independent per-channel curves can, by deliberately un-balancing a grey input to counteract the panel's own imbalance. There's no single correct set of values for an unknown/ undocumented panel - try values on both sides of 1.0 per channel and compare on real hardware. See GammaTable.h.
◆ setTouchDriver()
Defines the touch driver to be used with LVGL. This is optional and can be set if a touch driver is available.
◆ setupTouch()
| lv_indev_t * setupTouch |
( |
| ) |
|
|
inlineprotected |
Registers a touch driver with this LVGL display instance.
◆ touchDriver()
Provides a pointer to the touch driver, if one has been set. Returns nullptr if no touch driver is available.
◆ buf_1
◆ disp
| lv_display_t* disp = nullptr |
|
protected |
◆ disp_x
◆ disp_y
◆ dispBufferSize
| size_t dispBufferSize = 0 |
|
protected |
◆ driver
◆ touch_driver
The documentation for this class was generated from the following file: