zephyr/lib/gui/lvgl/lvgl_display_16bit.c
Bartosz Golaszewski 1244a89a21 lvgl: bump version to v8.1.0
This updates the lvgl in-tree glue code to work with version v8.1.0 and
bumps the west manifest accordingly.

The following are the most significant changes:
- The logging callback has changes in lvgl and no longer provides the
  caller with an integer log level code. We now need to parse the log
  string's prefix to determine the level.
- Several Kconfig options (mostly for default values of various settings)
  have been removed because these values are no longer configurable in
  lvgl.
- The library no longer performs a deep copy of the display and input
  device driver structs, so these must no longer be allocated on the
  stack in the init func.

Other than that it's mostly about renaming of various structures and
functions and adjusting the calls if function's signatures have changed.

This patch allows all in-tree users to work correctly but it's likely
it doesn't support all new widgets and layouts added in lvgl v8. These
however can be added gradually once this is upstream.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@huawei.com>
2022-02-24 11:51:33 +01:00

36 lines
959 B
C

/*
* Copyright (c) 2019 Jan Van Winkel <jan.van_winkel@dxplore.eu>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <lvgl.h>
#include "lvgl_display.h"
void lvgl_flush_cb_16bit(lv_disp_drv_t *disp_drv,
const lv_area_t *area, lv_color_t *color_p)
{
const struct device *display_dev = (const struct device *)disp_drv->user_data;
uint16_t w = area->x2 - area->x1 + 1;
uint16_t h = area->y2 - area->y1 + 1;
struct display_buffer_descriptor desc;
desc.buf_size = w * 2U * h;
desc.width = w;
desc.pitch = w;
desc.height = h;
display_write(display_dev, area->x1, area->y1, &desc, (void *) color_p);
lv_disp_flush_ready(disp_drv);
}
#ifndef CONFIG_LVGL_COLOR_DEPTH_16
void lvgl_set_px_cb_16bit(lv_disp_drv_t *disp_drv,
uint8_t *buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
lv_color_t color, lv_opa_t opa)
{
uint16_t *buf_xy = (uint16_t *)(buf + x * 2U + y * 2U * buf_w);
*buf_xy = lv_color_to16(color);
}
#endif