zephyr/modules/lvgl/lvgl_display_8bit.c
Kate Wang 52e08918ff modules: lvgl: support the frame buffer address and stride alignment
Add support for the frame buffer address and stride alignment.
If user set the CONFIG_LV_DRAW_BUF_ALIGN to not be 4, the buffers
shall be allocated aoocrdingly.
If user set the CONFIG_LV_DRAW_BUF_STRIDE_ALIGN to not be 1, the
methods of flushing the display shall set the pitch accordingly.

Signed-off-by: Kate Wang <yumeng.wang@nxp.com>
2025-06-27 08:49:44 -10:00

28 lines
644 B
C

/*
* Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <lvgl.h>
#include "lvgl_display.h"
void lvgl_flush_cb_8bit(lv_display_t *display, const lv_area_t *area, uint8_t *px_map)
{
uint16_t w = area->x2 - area->x1 + 1;
uint16_t h = area->y2 - area->y1 + 1;
struct lvgl_display_flush flush;
flush.display = display;
flush.x = area->x1;
flush.y = area->y1;
flush.desc.buf_size = w * h;
flush.desc.width = w;
flush.desc.pitch = ROUND_UP(w, LV_DRAW_BUF_STRIDE_ALIGN);
flush.desc.height = h;
flush.buf = (void *)px_map;
lvgl_flush_display(&flush);
}