it maybe help a lot.
i find the data is defferent from log when used below two function
TRACE(DBG_TRACE_LVL,"%02x",FrameBuffer[(y * disp_drv->hor_res)+x]);
TRACE(DBG_TRACE_LVL,"%02x",FrameBuffer[x]);
in other word,What is the pixel order in ‘working buffer’ data?
another question:
FrameBuffer[y *disp_drv->hor_res + x] = lv_color_to16(*color_p);
color_p must be convert used lv_color_to16(*color_p)?
i mean ‘working buffer’ data must to be convert by lv_color_to16(),right?
lv_color_to16 is (or can be) used for conversion,
but in your case there is no real conversion as FrameBuffer is 16-bit (I guess) and color_p is also 16-bit
(according #define LV_COLOR_DEPTH 16).
AGAIN the problem is not any color conversion, the problem is that there is a mismatch between the setup of your display controller and the setting of lvgl and that your flush function is incorrect.
LVGL is doing right! But you don’t!
when i debug my driver,i want to display a 50*50 red area.But i find the fist 8 bytes is FF FF FF FF FF FF FF FF.it’s not red color.
#define CANVAS_WIDTH 50
#define CANVAS_HEIGHT 50
void lv_ex_canvas_test(void)
{
static uint8_t cbuf[LV_CANVAS_BUF_SIZE_INDEXED_1BIT(CANVAS_WIDTH, CANVAS_HEIGHT)];
lv_obj_t* canvas = lv_canvas_create(lv_scr_act(), NULL);
lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_INDEXED_1BIT);
//lv_canvas_set_palette(canvas, 0, LV_COLOR_TRANSP);
lv_canvas_set_palette(canvas, 1, LV_COLOR_RED);
lv_obj_align(canvas, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_canvas_fill_bg(canvas, LV_COLOR_RED, LV_OPA_TRANSP);
}
red color should be 00 1F 00 1F 00 1F 00 1F