Sorry, I wasn’t exact enough. I meant the values of the pixels in tft_flush
.
Sorry but How can I display the full screen in red with lvgl?
Could you give me an example?
static lv_style_t new_style;
lv_style_copy(&new_style, &lv_style_scr);
new_style.body.main_color = LV_COLOR_RED;
new_style.body.grad_color = LV_COLOR_RED;
lv_obj_set_style(lv_scr_act(), &new_style);
I tried, but the half of the screen is in red.
lv_init();
tft_init();
static lv_style_t new_style;
lv_style_copy(&new_style, &lv_style_scr);
new_style.body.main_color = LV_COLOR_RED;
new_style.body.grad_color = LV_COLOR_RED;
lv_obj_set_style(lv_scr_act(), &new_style);
while(1) {
lv_task_handler();
lv_tick_inc(1);
}
And what is in the buffer in tft_flush
?
0xC0000000 ~ 0xC003FBFF: the value is filled with 0xf800
0x3FBFF is 480 x 272 pixels. So all the buffer is filled with RED, but it’s not copyed to the framebuffer properly.
So the LVGL is OK?
I will check the LTDC of STM32 again.
Yes it seems.
In the end, the setting of LDC_Config () was incorrect. I entered width and height in reverse. I want to cry~.
There was a mismatch between the comment and the variable name, but I wasn’t aware of it. I checked it many times and I don’t know why I didn’t see it. If anyone copy the same example (STM32f429_disco) like me, please pay attention to the width and height setting.
/* Accumulated active *width* = Hsync + HBP + Active Width - 1 */
LtdcHandle.Init.Accumulated`ActiveH` = 523; //284
/* Accumulated active *height* = Vsync + VBP + Active Heigh - 1 */
LtdcHandle.Init.Accumulated`ActiveW` = 284; //523
Uhh, it’s really a painful issue. I also could have noticed it.
This part of the driver is copied from an STM example project so probably the issue comes from there.
Anyway, I’ve fixed it.
hello i want show a button in lcd 800*480 and lvgl v7.11 my code is:
static lv_disp_buf_t disp_buf;
static lv_disp_drv_t disp_drv;
static lv_color_t buf[LV_HOR_RES_MAX * LV_VER_RES_MAX / 10];
uint16_t* LCD_FB=(uint16_t*)0xC0000000; // LCD FRAME Buffer
//**********************************************************************
lv_init();
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX*10);
lv_disp_drv_init(&disp_drv);
disp_drv.flush_cb = my_disp_flush;
disp_drv.buffer = &disp_buf;
disp_drv.hor_res = LV_HOR_RES_MAX; /Set the horizontal resolution of the display/
disp_drv.ver_res = LV_VER_RES_MAX; /Set the vertical resolution of the display/
lv_disp_drv_register(&disp_drv);
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /Add a button the current screen/
lv_obj_set_pos(btn, 10, 10); /Set its position/
lv_obj_set_size(btn, 120, 50);
//*************************************************************
void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p)
{
int32_t x, y;
for(y = area->y1; y <= area->y2; y++) {
for(x = area->x1; x <= area->x2; x++) {
//set_pixel(x, y, color_p); / Put a pixel to the display.*/
LCD_FB[x+(y * LV_HOR_RES_MAX)]=(color_p->full);
color_p++;
}
}
lv_disp_flush_ready(disp); /* Indicate you are ready with the flushing*/
}
//*************************************************************
but my lcd show it :
What do you think is the problem?
Probably it’s a color format mismatch. Be sure LV_COLOR_DEPTH and your driver’s color depth is the same.
LV_COLOR_DEPTH is 16 .
What is the driver’s color depth?
I think it can not put button pixels under each other.
I mean you need to configure the LCD periphery to RGB565 format too.
I did that.
But I show it right with the 480x272 LCD.
Lvgl may not be able to create a shape for the 800*480 LCD?
There is no problem, it can.