1 /* 2 * Copyright (c) 2019 Jan Van Winkel <jan.van_winkel@dxplore.eu> 3 * Copyright 2023 NXP 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 #include <zephyr/kernel.h> 9 #include <lvgl.h> 10 #include "lvgl_display.h" 11 lvgl_flush_cb_24bit(lv_display_t * display,const lv_area_t * area,uint8_t * px_map)12void lvgl_flush_cb_24bit(lv_display_t *display, const lv_area_t *area, uint8_t *px_map) 13 { 14 uint16_t w = area->x2 - area->x1 + 1; 15 uint16_t h = area->y2 - area->y1 + 1; 16 struct lvgl_display_flush flush; 17 18 flush.display = display; 19 flush.x = area->x1; 20 flush.y = area->y1; 21 flush.desc.buf_size = w * 3U * h; 22 flush.desc.width = w; 23 flush.desc.pitch = w; 24 flush.desc.height = h; 25 flush.buf = (void *)px_map; 26 27 /* LVGL assumes BGR byte ordering, convert to RGB */ 28 for (size_t i = 0; i < flush.desc.buf_size; i += 3) { 29 uint8_t tmp = px_map[i]; 30 31 px_map[i] = px_map[i + 2]; 32 px_map[i + 2] = tmp; 33 } 34 35 lvgl_flush_display(&flush); 36 } 37