lv_display.h
API reference for lv_display.h
Functions
lv_display_set_default
Set a default display. The new screens will be created on it by default.
void lv_display_set_default(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display May be NULL. |
lv_display_set_resolution
Sets the resolution of a display. LV_EVENT_RESOLUTION_CHANGED event will be sent. Here the native resolution of the device should be set. If the display will be rotated later with lv_display_set_rotation LVGL will swap the hor. and ver. resolution automatically.
void lv_display_set_resolution(lv_display_t *disp, int32_t hor_res, int32_t ver_res)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
hor_res | int32_t | the new horizontal resolution |
ver_res | int32_t | the new vertical resolution |
lv_display_set_physical_resolution
It's not mandatory to use the whole display for LVGL, however in some cases physical resolution is important. For example the touchpad still sees whole resolution and the values needs to be converted to the active LVGL display area.
void lv_display_set_physical_resolution(lv_display_t *disp, int32_t hor_res, int32_t ver_res)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
hor_res | int32_t | the new physical horizontal resolution, or -1 to assume it's the same as the normal hor. res. |
ver_res | int32_t | the new physical vertical resolution, or -1 to assume it's the same as the normal hor. res. |
lv_display_set_offset
If physical resolution is not the same as the normal resolution the offset of the active display area can be set here.
void lv_display_set_offset(lv_display_t *disp, int32_t x, int32_t y)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
x | int32_t | X offset |
y | int32_t | Y offset |
lv_display_set_rotation
Set the rotation of this display. LVGL will swap the horizontal and vertical resolutions internally.
void lv_display_set_rotation(lv_display_t *disp, lv_display_rotation_t rotation)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display (NULL to use the default display) |
rotation | lv_display_rotation_t | LV_DISPLAY_ROTATION_0/90/180/270 |
lv_display_set_matrix_rotation
Use matrix rotation for the display. This function is depended on LV_DRAW_TRANSFORM_USE_MATRIX
void lv_display_set_matrix_rotation(lv_display_t *disp, bool enable)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display (NULL to use the default display) |
enable | bool | true: enable matrix rotation, false: disable |
lv_display_set_dpi
Set the DPI (dot per inch) of the display. dpi = sqrt(hor_res^2 + ver_res^2) / diagonal"
void lv_display_set_dpi(lv_display_t *disp, int32_t dpi)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
dpi | int32_t | the new DPI |
lv_display_set_buffers
Set the buffers for a display, similarly to lv_display_set_draw_buffers, but accept the raw buffer pointers. For DIRECT/FULL rending modes, the buffer size must be at least hor_res * ver_res * lv_color_format_get_size(lv_display_get_color_format(disp))
void lv_display_set_buffers(lv_display_t *disp, void *buf1, void *buf2, uint32_t buf_size, lv_display_render_mode_t render_mode)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
buf1 | void * | first buffer |
buf2 | void * | second buffer May be NULL. |
buf_size | uint32_t | buffer size in byte |
render_mode | lv_display_render_mode_t | LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL |
lv_display_set_buffers_with_stride
Set the frame buffers for a display, similarly to lv_display_set_buffers, but allow for a custom stride as required by a display controller. This allows the frame buffers to have a stride alignment different from the rest of the buffers.
void lv_display_set_buffers_with_stride(lv_display_t *disp, void *buf1, void *buf2, uint32_t buf_size, uint32_t stride, lv_display_render_mode_t render_mode)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
buf1 | void * | first buffer |
buf2 | void * | second buffer (can be NULL) |
buf_size | uint32_t | buffer size in byte |
stride | uint32_t | buffer stride in bytes |
render_mode | lv_display_render_mode_t | LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL |
lv_display_set_draw_buffers
Set the buffers for a display, accept a draw buffer pointer. Normally use lv_display_set_buffers is enough for most cases. Use this function when an existing lv_draw_buf_t is available.
void lv_display_set_draw_buffers(lv_display_t *disp, lv_draw_buf_t *buf1, lv_draw_buf_t *buf2)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
buf1 | lv_draw_buf_t * | first buffer |
buf2 | lv_draw_buf_t * | second buffer May be NULL. |
lv_display_set_3rd_draw_buffer
Set the third draw buffer for a display.
void lv_display_set_3rd_draw_buffer(lv_display_t *disp, lv_draw_buf_t *buf3)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
buf3 | lv_draw_buf_t * | third buffer May be NULL.. Use NULL to stop using triple buffering |
lv_display_set_render_mode
Set display render mode
void lv_display_set_render_mode(lv_display_t *disp, lv_display_render_mode_t render_mode)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
render_mode | lv_display_render_mode_t | LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL |
lv_display_set_flush_cb
Set the flush callback which will be called to copy the rendered image to the display.
void lv_display_set_flush_cb(lv_display_t *disp, lv_display_flush_cb_t flush_cb)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
flush_cb | lv_display_flush_cb_t | the flush callback (px_map contains the rendered image as raw pixel map and it should be copied to area on the display) |
lv_display_set_flush_wait_cb
Set a callback to be used while LVGL is waiting flushing to be finished. It can do any complex logic to wait, including semaphores, mutexes, polling flags, etc. If not set the disp->flushing flag is used which can be cleared with lv_display_flush_ready()
void lv_display_set_flush_wait_cb(lv_display_t *disp, lv_display_flush_wait_cb_t wait_cb)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
wait_cb | lv_display_flush_wait_cb_t | a callback to call while LVGL is waiting for flush ready. If NULL lv_display_flush_ready() can be used to signal that flushing is ready. |
lv_display_set_sync_cb
Set the sync callback which will be called to synchronize invalidated areas between frame buffers pre-render.
void lv_display_set_sync_cb(lv_display_t *disp, lv_display_sync_cb_t sync_cb)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
sync_cb | lv_display_sync_cb_t | the sync callback (pointer to area needing to be synchronized) |
lv_display_set_sync_wait_cb
Set a callback to be used while LVGL is waiting sync to be finished. It can do any complex logic to wait, including semaphores, mutexes, polling flags, etc. If not set the disp->syncing flag is used which can be cleared with lv_display_sync_ready()
void lv_display_set_sync_wait_cb(lv_display_t *disp, lv_display_sync_wait_cb_t wait_cb)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
wait_cb | lv_display_sync_wait_cb_t | a callback to call while LVGL is waiting for sync ready. If NULL lv_display_sync_ready() can be used to signal that syncing is ready. |
lv_display_set_color_format
Set the color format of the display.
void lv_display_set_color_format(lv_display_t *disp, lv_color_format_t color_format)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
color_format | lv_color_format_t | Possible values are - LV_COLOR_FORMAT_RGB565 - LV_COLOR_FORMAT_RGB565_SWAPPED - LV_COLOR_FORMAT_RGB888 - LV_COLOR_FORMAT_XRGB888 - LV_COLOR_FORMAT_ARGB888 |
lv_display_set_tile_cnt
Set the number of tiles for parallel rendering.
void lv_display_set_tile_cnt(lv_display_t *disp, uint32_t tile_cnt)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
tile_cnt | uint32_t | number of tiles (1 =< tile_cnt < 256) |
lv_display_set_antialiasing
Disabling anti-aliasing is not supported since v9. This function will be removed. Enable anti-aliasing for the render engine
void lv_display_set_antialiasing(lv_display_t *disp, bool en)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
en | bool | true/false |
lv_display_set_theme
Set the theme of a display.
The theme is applied to each widget when it is created, so this affects the widgets created afterwards on this display. Widgets that already exist keep their current styles.
void lv_display_set_theme(lv_display_t *disp, lv_theme_t *th)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
th | lv_theme_t * | pointer to a theme May be NULL.. With NULL no theme is applied, so widgets created later get no styles at all and it's up to the application to style them. |
If the display is still untouched (no user created screens and all screens and layers are empty) the screen created together with the display is themed as well. With NULL the layers are cleared of their styles too, leaving the whole display unstyled.
lv_display_set_user_data
Store a custom pointer on the display. LVGL never uses this value, it's free for the application to use for any purpose.
void lv_display_set_user_data(lv_display_t *disp, void *user_data)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
user_data | void * | May be NULL. custom pointer to store, can be NULL to clear it |
lv_display_set_driver_data
Store a pointer to display driver specific data on the display. Intended for the display driver implementation, the application should use lv_display_set_user_data() instead.
void lv_display_set_driver_data(lv_display_t *disp, void *driver_data)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
driver_data | void * | May be NULL. custom pointer to store, can be NULL to clear it |
lv_display_set_external_data
Attaches external user data and destructor callback to a display.
Associates custom user data with an LVGL display and specifies a destructor function that will be automatically invoked when the display is deleted to properly clean up the associated resources.
void lv_display_set_external_data(lv_display_t *disp, void *data, void(*free_cb)(void *data))| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | Pointer to a display |
data | void * | User-defined data pointer to associate with the display May be NULL. |
free_cb | void(*)(void *data) | Callback function for cleaning up data when display is deleted. Receives data as parameter. May be NULL.. Use NULL to dettach a previously attached callback |
lv_display_get_default
Get the default display
lv_display_t * lv_display_get_default(void)Returns: lv_display_t * — pointer to the default display
lv_display_get_next
Get the next display.
lv_display_t * lv_display_get_next(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to the current display. May be NULL.. When NULL it returns the first display. |
Returns: lv_display_t * — the next display or NULL if no more. Gives the first display when the parameter is NULL.
lv_display_get_horizontal_resolution
Get the horizontal resolution of a display.
int32_t lv_display_get_horizontal_resolution(const lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | const lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: int32_t — the horizontal resolution of the display.
lv_display_get_vertical_resolution
Get the vertical resolution of a display
int32_t lv_display_get_vertical_resolution(const lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | const lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: int32_t — the vertical resolution of the display
lv_display_get_original_horizontal_resolution
Get the original horizontal resolution of a display without considering rotation
int32_t lv_display_get_original_horizontal_resolution(const lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | const lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: int32_t — the horizontal resolution of the display.
lv_display_get_original_vertical_resolution
Get the original vertical resolution of a display without considering rotation
int32_t lv_display_get_original_vertical_resolution(const lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | const lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: int32_t — the vertical resolution of the display
lv_display_get_physical_horizontal_resolution
Get the physical horizontal resolution of a display
int32_t lv_display_get_physical_horizontal_resolution(const lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | const lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: int32_t — the physical horizontal resolution of the display
lv_display_get_physical_vertical_resolution
Get the physical vertical resolution of a display
int32_t lv_display_get_physical_vertical_resolution(const lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | const lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: int32_t — the physical vertical resolution of the display
lv_display_get_offset_x
Get the horizontal offset from the full / physical display
int32_t lv_display_get_offset_x(const lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | const lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: int32_t — the horizontal offset from the physical display
lv_display_get_offset_y
Get the vertical offset from the full / physical display
int32_t lv_display_get_offset_y(const lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | const lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: int32_t — the horizontal offset from the physical display
lv_display_get_rotation
Get the current rotation of this display.
lv_display_rotation_t lv_display_get_rotation(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: lv_display_rotation_t — the current rotation
lv_display_get_matrix_rotation
Get if matrix rotation is enabled for a display or not
bool lv_display_get_matrix_rotation(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: bool — true: matrix rotation is enabled; false: disabled
lv_display_get_dpi
Get the DPI of the display
int32_t lv_display_get_dpi(const lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | const lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: int32_t — dpi of the display
lv_display_get_flush_cb
Get the flush callback which will be called to copy the rendered image to the display.
lv_display_flush_cb_t lv_display_get_flush_cb(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
Returns: lv_display_flush_cb_t — the flush callback
lv_display_get_color_format
Get the color format of the display
lv_color_format_t lv_display_get_color_format(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
Returns: lv_color_format_t — the color format
lv_display_get_tile_cnt
Get the number of tiles used for parallel rendering
uint32_t lv_display_get_tile_cnt(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
Returns: uint32_t — number of tiles
lv_display_get_antialiasing
Get if anti-aliasing is enabled for a display or not
bool lv_display_get_antialiasing(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: bool — true/false
lv_display_get_render_mode
Get display render mode
lv_display_render_mode_t lv_display_get_render_mode(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
Returns: lv_display_render_mode_t — display's render mode (LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL)
lv_display_get_screen_active
Return a pointer to the active screen on a display
lv_obj_t * lv_display_get_screen_active(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to display which active screen should be get. (NULL to use the default screen) |
Returns: lv_obj_t * — pointer to the active screen object (loaded by 'lv_screen_load()')
lv_display_get_screen_prev
Return with a pointer to the previous screen. Only used during screen transitions.
lv_obj_t * lv_display_get_screen_prev(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to display which previous screen should be get. (NULL to use the default screen) |
Returns: lv_obj_t * — pointer to the previous screen object or NULL if not used now
lv_display_get_screen_loading
Return the screen that is currently being loaded by the display
lv_obj_t * lv_display_get_screen_loading(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display object (NULL to use the default screen) |
Returns: lv_obj_t * — pointer to the screen being loaded or NULL if no screen is currently being loaded
lv_display_get_layer_top
Return the top layer. The top layer is the same on all screens and it is above the normal screen layer.
lv_obj_t * lv_display_get_layer_top(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to display which top layer should be get. (NULL to use the default screen) |
Returns: lv_obj_t * — pointer to the top layer object
lv_display_get_layer_sys
Return the sys. layer. The system layer is the same on all screen and it is above the normal screen and the top layer.
lv_obj_t * lv_display_get_layer_sys(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to display which sys. layer should be retrieved. (NULL to use the default screen) |
Returns: lv_obj_t * — pointer to the sys layer object
lv_display_get_layer_bottom
Return the bottom layer. The bottom layer is the same on all screen and it is under the normal screen layer. It's visible only if the screen is transparent.
lv_obj_t * lv_display_get_layer_bottom(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to display (NULL to use the default screen) |
Returns: lv_obj_t * — pointer to the bottom layer object
lv_display_get_screen_by_name
Get screen by its name on a display. The name should be set by lv_obj_set_name() or lv_obj_set_name_static().
lv_obj_t * lv_display_get_screen_by_name(const lv_display_t *disp, const char *screen_name)| Name | Type | Description |
|---|---|---|
disp | const lv_display_t * | pointer to a display or NULL to use default display |
screen_name | const char * | name of the screen to get |
Returns: lv_obj_t * — pointer to the screen, or NULL if not found.
lv_display_get_event_count
Get the number of event attached to a display
uint32_t lv_display_get_event_count(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
Returns: uint32_t — number of events
lv_display_get_event_dsc
Get an event descriptor for an event
lv_event_dsc_t * lv_display_get_event_dsc(lv_display_t *disp, uint32_t index)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
index | uint32_t | the index of the event |
Returns: lv_event_dsc_t * — the event descriptor
lv_event_get_invalidated_area
Get the area to be invalidated. Can be used in LV_EVENT_INVALIDATE_AREA
lv_area_t * lv_event_get_invalidated_area(lv_event_t *e)| Name | Type | Description |
|---|---|---|
e | lv_event_t * | pointer to an event |
Returns: lv_area_t * — the area to invalidated (can be modified as required)
lv_display_get_theme
Get the theme of a display
lv_theme_t * lv_display_get_theme(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
Returns: lv_theme_t * — the display's theme (can be NULL)
lv_display_get_inactive_time
Get elapsed time since last user activity on a display (e.g. click)
uint32_t lv_display_get_inactive_time(const lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | const lv_display_t * | pointer to a display May be NULL.. Use NULL to get the overall smallest inactivity |
Returns: uint32_t — elapsed ticks (milliseconds) since the last activity
lv_display_get_refr_timer
Get a pointer to the screen refresher timer to modify its parameters with lv_timer_... functions.
lv_timer_t * lv_display_get_refr_timer(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
Returns: lv_timer_t * — pointer to the display refresher timer. (NULL on error)
lv_display_get_user_data
Get the custom pointer set by lv_display_set_user_data().
void * lv_display_get_user_data(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
Returns: void * — the stored user data
lv_display_get_driver_data
Get the driver specific pointer set by lv_display_set_driver_data().
void * lv_display_get_driver_data(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
Returns: void * — the stored driver data
lv_display_get_buf_active
Get the draw buffer LVGL is currently rendering into. With double buffering this alternates between the two buffers after each flush.
lv_draw_buf_t * lv_display_get_buf_active(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
Returns: lv_draw_buf_t * — pointer to the active draw buffer
lv_display_get_draw_buf_size
Get the size of the draw buffers
uint32_t lv_display_get_draw_buf_size(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
Returns: uint32_t — the size of the draw buffer in bytes for valid display, 0 otherwise
lv_display_get_invalidated_draw_buf_size
Get the size of the invalidated draw buffer. Can be used in the flush callback to get the number of bytes used in the current render buffer.
uint32_t lv_display_get_invalidated_draw_buf_size(lv_display_t *disp, uint32_t width, uint32_t height)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
width | uint32_t | the width of the invalidated area |
height | uint32_t | the height of the invalidated area |
Returns: uint32_t — the size of the invalidated draw buffer in bytes, not accounting for any preceding palette information for a valid display, 0 otherwise
lv_display_create
Create a new display with the given resolution
lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res)| Name | Type | Description |
|---|---|---|
hor_res | int32_t | horizontal resolution in pixels |
ver_res | int32_t | vertical resolution in pixels |
Returns: lv_display_t * — pointer to a display object or NULL on error
lv_display_delete
Remove a display
void lv_display_delete(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to display May be NULL. |
lv_display_flush_ready
Call from the display driver when the flushing is finished
void lv_display_flush_ready(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to display whose flush_cb was called |
lv_display_flush_is_last
Tell if it's the last area of the refreshing process. Can be called from flush_cb to execute some special display refreshing if needed when all areas are flushed.
bool lv_display_flush_is_last(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to display |
Returns: bool — true: it's the last area to flush; false: there are other areas too which will be refreshed soon
lv_display_sync_ready
Call from the display driver when the syncing is finished
void lv_display_sync_ready(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to display whose sync_cb was called |
lv_display_sync_is_last
Tell if it's the last area of the syncing process. Can be called from sync_cb to execute some special display refreshing if needed when all areas are synced.
bool lv_display_sync_is_last(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to display |
Returns: bool — true: it's the last area to sync; false: there are other areas too which will be synced soon
lv_display_is_double_buffered
Get display is double buffered.
bool lv_display_is_double_buffered(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: bool — return true if display is double buffered
lv_screen_load
Load a screen on the default display
void lv_screen_load(lv_obj_t *scr)| Name | Type | Description |
|---|---|---|
scr | lv_obj_t * | pointer to a screen |
lv_screen_load_anim
Switch screen with animation
void lv_screen_load_anim(lv_obj_t *scr, lv_screen_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del)| Name | Type | Description |
|---|---|---|
scr | lv_obj_t * | pointer to the new screen to load |
anim_type | lv_screen_load_anim_t | type of the animation from lv_screen_load_anim_t, e.g. LV_SCREEN_LOAD_ANIM_MOVE_LEFT |
time | uint32_t | time of the animation |
delay | uint32_t | delay before the transition |
auto_del | bool | true: automatically delete the old screen |
lv_screen_active
Get the active screen of the default display
lv_obj_t * lv_screen_active(void)Returns: lv_obj_t * — pointer to the active screen
lv_layer_top
Get the top layer of the default display
lv_obj_t * lv_layer_top(void)Returns: lv_obj_t * — pointer to the top layer
lv_layer_sys
Get the system layer of the default display
lv_obj_t * lv_layer_sys(void)Returns: lv_obj_t * — pointer to the sys layer
lv_layer_bottom
Get the bottom layer of the default display
lv_obj_t * lv_layer_bottom(void)Returns: lv_obj_t * — pointer to the bottom layer
lv_display_add_event_cb
Add an event handler to the display
lv_event_dsc_t * lv_display_add_event_cb(lv_display_t *disp, lv_event_cb_t event_cb, lv_event_code_t filter, void *user_data)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
event_cb | lv_event_cb_t | an event callback |
filter | lv_event_code_t | event code to react or LV_EVENT_ALL |
user_data | void * | optional user_data May be NULL. |
Returns: lv_event_dsc_t * — the event descriptor or NULL if the event couldn't be created
lv_display_remove_event
Remove an event
bool lv_display_remove_event(lv_display_t *disp, uint32_t index)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
index | uint32_t | the index of the event to remove |
Returns: bool — true: and event was removed; false: no event was removed
lv_display_remove_event_cb_with_user_data
Remove an event_cb with user_data
uint32_t lv_display_remove_event_cb_with_user_data(lv_display_t *disp, lv_event_cb_t event_cb, void *user_data)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
event_cb | lv_event_cb_t | the event_cb of the event to remove |
user_data | void * | user_data May be NULL. |
Returns: uint32_t — the count of the event removed
lv_display_send_event
Send an event to a display
lv_result_t lv_display_send_event(lv_display_t *disp, lv_event_code_t code, void *param)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
code | lv_event_code_t | an event code. LV_EVENT_... |
param | void * | optional param May be NULL. |
Returns: lv_result_t — LV_RESULT_OK: disp wasn't deleted in the event.
lv_display_trigger_activity
Manually trigger an activity on a display
void lv_display_trigger_activity(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display (NULL to use the default display) |
lv_display_enable_invalidation
Temporarily enable and disable the invalidation of the display.
void lv_display_enable_invalidation(lv_display_t *disp, bool en)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display (NULL to use the default display) |
en | bool | true: enable invalidation; false: invalidation |
lv_display_is_invalidation_enabled
Get display invalidation is enabled.
bool lv_display_is_invalidation_enabled(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display (NULL to use the default display) |
Returns: bool — return true if invalidation is enabled
lv_display_delete_refr_timer
Delete screen refresher timer
void lv_display_delete_refr_timer(lv_display_t *disp)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
lv_display_register_vsync_event
Register vsync event of a display. LV_EVENT_VSYNC event will be sent periodically. Please don't use it in display event listeners, as it may cause memory leaks and illegal access issues.
bool lv_display_register_vsync_event(lv_display_t *disp, lv_event_cb_t event_cb, void *user_data)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
event_cb | lv_event_cb_t | an event callback |
user_data | void * | optional user_data May be NULL. |
lv_display_unregister_vsync_event
Unregister vsync event of a display. LV_EVENT_VSYNC event won't be sent periodically. Please don't use it in display event listeners, as it may cause memory leaks and illegal access issues.
bool lv_display_unregister_vsync_event(lv_display_t *disp, lv_event_cb_t event_cb, void *user_data)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
event_cb | lv_event_cb_t | an event callback |
user_data | void * | optional user_data May be NULL. |
lv_display_send_vsync_event
Send an vsync event to a display
lv_result_t lv_display_send_vsync_event(lv_display_t *disp, void *param)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
param | void * | optional param May be NULL. |
Returns: lv_result_t — LV_RESULT_OK: disp wasn't deleted in the event.
lv_display_rotate_area
Rotate an area in-place according to the display's rotation
void lv_display_rotate_area(lv_display_t *disp, lv_area_t *area)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
area | lv_area_t * | pointer to an area to rotate |
lv_display_rotate_point
Rotate a point in-place according to the display's rotation
void lv_display_rotate_point(lv_display_t *disp, lv_point_t *point)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
point | lv_point_t * | pointer to a point to rotate |
lv_display_rotate_point_ccw
Rotate a point in-place opposite to the display's rotation
void lv_display_rotate_point_ccw(lv_display_t *disp, lv_point_t *point)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to a display |
point | lv_point_t * | pointer to a point to rotate |
lv_dpx
For default display, computes the number of pixels (a distance or size) as if the display had 160 DPI. This allows you to specify 1/160-th fractions of an inch to get real distance on the display that will be consistent regardless of its current DPI. It ensures lv_dpx(100), for example, will have the same physical size regardless to the DPI of the display.
int32_t lv_dpx(int32_t n)| Name | Type | Description |
|---|---|---|
n | int32_t | number of 1/160-th-inch units to compute with |
Returns: int32_t — number of pixels to use to make that distance
lv_display_dpx
For specified display, computes the number of pixels (a distance or size) as if the display had 160 DPI. This allows you to specify 1/160-th fractions of an inch to get real distance on the display that will be consistent regardless of its current DPI. It ensures lv_dpx(100), for example, will have the same physical size regardless to the DPI of the display.
int32_t lv_display_dpx(const lv_display_t *disp, int32_t n)| Name | Type | Description |
|---|---|---|
disp | const lv_display_t * | pointer to display whose dpi should be considered |
n | int32_t | number of 1/160-th-inch units to compute with |
Returns: int32_t — number of pixels to use to make that distance
Enums
lv_display_rotation_t
| Name | Value |
|---|---|
LV_DISPLAY_ROTATION_0 | 0 |
LV_DISPLAY_ROTATION_90 | |
LV_DISPLAY_ROTATION_180 | |
LV_DISPLAY_ROTATION_270 |
Used by 3 functions
lv_display_set_rotation— paramrotationlv_draw_rotate— paramrotationlv_draw_pxp_rotate— paramrotation
lv_display_render_mode_t
| Name | Description |
|---|---|
LV_DISPLAY_RENDER_MODE_PARTIAL | Use the buffer(s) to render the screen is smaller parts. This way the buffers can be smaller then the display to save RAM. At least 1/10 screen size buffer(s) are recommended. |
LV_DISPLAY_RENDER_MODE_DIRECT | The buffer(s) has to be screen sized and LVGL will render into the correct location of the buffer. This way the buffer always contain the whole image. Only the changed ares will be updated. With 2 buffers the buffers' content are kept in sync automatically and in flush_cb only address change is required. |
LV_DISPLAY_RENDER_MODE_FULL | Always redraw the whole screen even if only one pixel has been changed. With 2 buffers in flush_cb only an address change is required. |
Used by 3 functions
lv_display_set_buffers— paramrender_modelv_display_set_buffers_with_stride— paramrender_modelv_display_set_render_mode— paramrender_mode
lv_screen_load_anim_t
| Name | Value |
|---|---|
LV_SCREEN_LOAD_ANIM_NONE | |
LV_SCREEN_LOAD_ANIM_OVER_LEFT | |
LV_SCREEN_LOAD_ANIM_OVER_RIGHT | |
LV_SCREEN_LOAD_ANIM_OVER_TOP | |
LV_SCREEN_LOAD_ANIM_OVER_BOTTOM | |
LV_SCREEN_LOAD_ANIM_MOVE_LEFT | |
LV_SCREEN_LOAD_ANIM_MOVE_RIGHT | |
LV_SCREEN_LOAD_ANIM_MOVE_TOP | |
LV_SCREEN_LOAD_ANIM_MOVE_BOTTOM | |
LV_SCREEN_LOAD_ANIM_FADE_IN | |
LV_SCREEN_LOAD_ANIM_FADE_ON | LV_SCREEN_LOAD_ANIM_FADE_IN |
LV_SCREEN_LOAD_ANIM_FADE_OUT | |
LV_SCREEN_LOAD_ANIM_OUT_LEFT | |
LV_SCREEN_LOAD_ANIM_OUT_RIGHT | |
LV_SCREEN_LOAD_ANIM_OUT_TOP | |
LV_SCREEN_LOAD_ANIM_OUT_BOTTOM |
Used by 3 functions
lv_obj_add_screen_load_event— paramanim_typelv_obj_add_screen_create_event— paramanim_typelv_screen_load_anim— paramanim_type
Typedefs
lv_display_flush_cb_t
typedef void(* lv_display_flush_cb_t) (lv_display_t *disp, const lv_area_t *area, uint8_t *px_map)Used by 1 function
lv_display_set_flush_cb— paramflush_cb
lv_display_flush_wait_cb_t
typedef void(* lv_display_flush_wait_cb_t) (lv_display_t *disp)Used by 1 function
lv_display_set_flush_wait_cb— paramwait_cb
lv_display_sync_cb_t
typedef void(* lv_display_sync_cb_t) (lv_display_t *disp, const lv_area_t *area)Used by 1 function
lv_display_set_sync_cb— paramsync_cb
lv_display_sync_wait_cb_t
typedef void(* lv_display_sync_wait_cb_t) (lv_display_t *disp)Used by 1 function
lv_display_set_sync_wait_cb— paramwait_cb
Macros
LV_HOR_RES
#define LV_HOR_RES lv_display_get_horizontal_resolution(lv_display_get_default())The horizontal resolution of the currently active display.
LV_VER_RES
#define LV_VER_RES lv_display_get_vertical_resolution(lv_display_get_default())The vertical resolution of the currently active display.
LV_DPX_CALC
#define LV_DPX_CALC(dpi, n) \
((n) == 0 ? 0 :LV_MAX((( (dpi) * (n) + 80) / 160), 1)) /*+80 for rounding*/See lv_dpx() and lv_display_dpx(). Same as Android's DIP. (Different name is chosen to avoid mistype between LV_DPI and LV_DIP)
- 40 dip is 40 px on a 160 DPI screen (distance = 1/4 inch).
- 40 dip is 80 px on a 320 DPI screen (distance still = 1/4 inch).
See also: https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp
LV_DPX
#define LV_DPX(n) \
LV_DPX_CALC(lv_display_get_dpi(lv_display_get_default()), n)Dependencies
lv_api_map_v8.hlv_obj_tree.hlv_refr.hlv_draw_utils.hlv_ft81x.hlv_lcd_generic_mipi.hlv_linux_drm.hlv_linux_fbdev.hlv_lovyan_gfx.hlv_nxp_elcdif.hlv_renesas_glcdc.hlv_st_ltdc.hlv_tft_espi.hlv_nuttx_entry.hlv_nuttx_fbdev.hlv_nuttx_lcd.hlv_nuttx_libuv.hlv_opengles_texture.hlv_qnx.hlv_sdl_window.hlv_uefi_display.hlv_wayland_window.hlv_windows_display.hlv_windows_input.hlv_x11.hlvgl.hlv_theme_simple.h
Indirect dependencies
Last updated on