Hello All,
When we write our LVGL display code, we put it into the initialize() function with a delay included. When we download to the cortex, nothing shows up. Below is a snippet of my code (keep in mind that I have already declared my button variable, I just did not include those for the sake of space).
pros::delay(50);
lv_style_copy(&RedREL, &lv_style_plain);
RedREL.body.main_color = LV_COLOR_MAKE(150, 0, 0);
RedREL.body.grad_color = LV_COLOR_MAKE(150, 0, 0);
RedREL.body.radius = 0;
RedREL.text.color = LV_COLOR_MAKE(255, 255, 255);
lv_style_copy(&RedPR, &lv_style_plain);
RedPR.body.main_color = LV_COLOR_MAKE(255, 0, 0);
RedPR.body.grad_color = LV_COLOR_MAKE(255, 0, 0);
RedPR.body.radius = 0;
RedPR.text.color = LV_COLOR_MAKE(255, 255, 255);
lv_style_copy(&BlueREL, &lv_style_plain);
BlueREL.body.main_color = LV_COLOR_MAKE(0,0,150);
BlueREL.body.grad_color = LV_COLOR_MAKE(0,0,150);
BlueREL.body.radius = 0;
BlueREL.text.color = LV_COLOR_MAKE(255,255,255);
lv_style_copy(&BluePR, &lv_style_plain);
BluePR.body.main_color = LV_COLOR_MAKE(0,0,255);
BluePR.body.grad_color = LV_COLOR_MAKE(0,0,255);
BluePR.body.radius = 0;
BluePR.text.color = LV_COLOR_MAKE(255,255,255);
myButton = lv_btn_create(lv_scr_act(), NULL); //create button, lv_scr_act() is deafult screen object
lv_obj_set_free_num(myButton, 0); //set button is to 0
lv_btn_set_action(myButton, LV_BTN_ACTION_CLICK, btn_click_action); //set function to be called on button click
lv_btn_set_style(myButton, LV_BTN_STYLE_REL, &RedREL); //set the relesed style
lv_btn_set_style(myButton, LV_BTN_STYLE_PR, &RedPR); //set the pressed style
lv_obj_set_size(myButton, 200, 50); //set the button size
lv_obj_align(myButton, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0); //set the position to top mid
myLabel = lv_label_create(lv_scr_act(), NULL); //create label and puts it on the screen
lv_label_set_text(myLabel, "Button has not been clicked yet"); //sets label text
lv_obj_align(myLabel, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0); //set the position to center