/** * Create a demo application */ void demo_create(void) { #if LV_DEMO_WALLPAPER lv_obj_t *wp = lv_img_create(lv_scr_act(), NULL); lv_img_set_src(wp, &img_bubble_pattern); lv_obj_set_width(wp, LV_HOR_RES * 4); lv_obj_set_protect(wp, LV_PROTECT_POS); #endif static lv_style_t style_tv_btn_bg; lv_style_copy(&style_tv_btn_bg, &lv_style_plain); style_tv_btn_bg.body.main_color = LV_COLOR_HEX(0x487fb7); style_tv_btn_bg.body.grad_color = LV_COLOR_HEX(0x487fb7); style_tv_btn_bg.body.padding.ver = 0; static lv_style_t style_tv_btn_rel; lv_style_copy(&style_tv_btn_rel, &lv_style_btn_rel); style_tv_btn_rel.body.empty = 1; style_tv_btn_rel.body.border.width = 0; static lv_style_t style_tv_btn_pr; lv_style_copy(&style_tv_btn_pr, &lv_style_btn_pr); style_tv_btn_pr.body.radius = 0; style_tv_btn_pr.body.opa = LV_OPA_50; style_tv_btn_pr.body.main_color = LV_COLOR_WHITE; style_tv_btn_pr.body.grad_color = LV_COLOR_WHITE; style_tv_btn_pr.body.border.width = 0; style_tv_btn_pr.text.color = LV_COLOR_GRAY; lv_obj_t *tv = lv_tabview_create(lv_scr_act(), NULL); #if LV_DEMO_WALLPAPER lv_obj_set_parent(wp, ((lv_tabview_ext_t *) tv->ext_attr)->content); lv_obj_set_pos(wp, 0, -5); #endif lv_obj_t *tab1 = lv_tabview_add_tab(tv, "Write"); lv_obj_t *tab2 = lv_tabview_add_tab(tv, "List"); lv_obj_t *tab3 = lv_tabview_add_tab(tv, "Chart"); #if LV_DEMO_WALLPAPER == 0 /*Blue bg instead of wallpaper*/ lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BG, &style_tv_btn_bg); #endif lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_BG, &style_tv_btn_bg); lv_tabview_set_style(tv, LV_TABVIEW_STYLE_INDIC, &lv_style_plain); lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_REL, &style_tv_btn_rel); lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_PR, &style_tv_btn_pr); lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_TGL_REL, &style_tv_btn_rel); lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_TGL_PR, &style_tv_btn_pr); write_create(tab1); list_create(tab2); chart_create(tab3); #if LV_DEMO_SLIDE_SHOW lv_task_create(tab_switcher, 3000, LV_TASK_PRIO_MID, tv); #endif }
/** * Initialize the display input device subsystem */ void lv_indev_init(void) { #if LV_INDEV_READ_PERIOD != 0 lv_task_create(indev_proc_task, LV_INDEV_READ_PERIOD, LV_TASK_PRIO_MID, NULL); #endif lv_indev_reset(NULL); /*Reset all input devices*/ }
/** * Init. the animation module */ void lv_anim_init(void) { lv_ll_init(&LV_GC_ROOT(_lv_anim_ll), sizeof(lv_anim_t)); last_task_run = lv_tick_get(); lv_task_create(anim_task, LV_REFR_PERIOD, LV_TASK_PRIO_MID, NULL); }