zephyr/lib/gui/lvgl/lvgl_display_32bit.c
Tomasz Bursztyka e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00

37 lines
969 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_32bit(struct _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 * 4U * 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_32
void lvgl_set_px_cb_32bit(struct _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)
{
uint32_t *buf_xy = (uint32_t *)(buf + x * 4U + y * 4U * buf_w);
*buf_xy = lv_color_to32(color);
}
#endif