How to display a label on the FrameBufer with the help of LVGL

21 Views Asked by At

I am using Framebuffer to display a simple label , through LVGL . I have a 480*480 LCD screen , LVGL throws the following assertion

[Error] (3108423.513, +3108423513) lv_display_set_buffers: Asserted at expression: buf1 != NULL Null buffer lv_display.c:401 2020/09/23 04:45:49 521984

This is my code

void initialize()  
{  
     lv_init();  
     displayInit();  
     showLabel();  
}  
  
static void displayInit()  
{  
    display = lv_linux_fbdev_create();  
    lv_linux_fbdev_set_file(display, "/dev/fb0");   
}
  
void showLabel()
{
    lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);  
    lv_obj_t label = lv_label_create(lv_screen_active());  
    lv_label_set_text(label, "Hello world");  
    lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xffffff), LV_PART_MAIN);
    lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
}

Tried changing LV_DISPLAY_RENDER_MODE_PARTIAL to LV_DISPLAY_RENDER_MODE_DIRECT

0

There are 0 best solutions below