From 7fab8564d07b037fb6c4679e3b7762190c0f14cb Mon Sep 17 00:00:00 2001 From: Kiss-Vamosi Gabor Date: Sun, 9 Jul 2017 15:32:49 +0200 Subject: [PATCH] header udated with __cplusplus define --- lv_app/lv_app.c | 12 +- lv_app/lv_app.h | 10 +- lv_app/lv_app_util/lv_app_fsel.h | 10 +- lv_app/lv_app_util/lv_app_kb.h | 11 +- lv_app/lv_app_util/lv_app_notice.h | 11 +- lv_appx/lv_app_benchmark.c | 333 ++++++++++++++++++++++++----- lv_appx/lv_app_benchmark.h | 8 + lv_appx/lv_app_example.h | 9 + lv_appx/lv_app_files.h | 8 + lv_appx/lv_app_gsm.h | 8 + lv_appx/lv_app_phantom.h | 8 + lv_appx/lv_app_sysmon.h | 8 + lv_appx/lv_app_terminal.h | 8 + lv_appx/lv_app_wifi.h | 8 + lv_conf_templ.h | 14 +- lv_draw/lv_draw.h | 9 + lv_draw/lv_draw_rbasic.h | 9 + lv_draw/lv_draw_vbasic.h | 10 +- lv_obj/lv_dispi.h | 9 + lv_obj/lv_obj.c | 2 +- lv_obj/lv_obj.h | 11 +- lv_obj/lv_refr.c | 23 +- lv_obj/lv_refr.h | 16 ++ lv_obj/lv_style.c | 2 +- lv_obj/lv_style.h | 9 + lv_obj/lv_vdb.h | 10 +- lv_objx/lv_bar.h | 10 +- lv_objx/lv_btn.h | 10 +- lv_objx/lv_btnm.h | 8 + lv_objx/lv_cb.h | 10 +- lv_objx/lv_chart.h | 10 +- lv_objx/lv_cont.c | 2 + lv_objx/lv_cont.h | 10 +- lv_objx/lv_ddlist.h | 16 +- lv_objx/lv_gauge.c | 4 + lv_objx/lv_gauge.h | 11 +- lv_objx/lv_img.h | 10 +- lv_objx/lv_label.h | 10 +- lv_objx/lv_led.h | 10 +- lv_objx/lv_line.h | 10 +- lv_objx/lv_list.h | 10 +- lv_objx/lv_lmeter.h | 10 +- lv_objx/lv_mbox.h | 10 +- lv_objx/lv_objx_templ.h | 10 +- lv_objx/lv_page.h | 10 +- lv_objx/lv_slider.h | 10 +- lv_objx/lv_ta.h | 10 +- lv_objx/lv_win.h | 8 + lvgl.h | 6 +- 49 files changed, 691 insertions(+), 100 deletions(-) diff --git a/lv_app/lv_app.c b/lv_app/lv_app.c index 2a1949532..8ccde9d13 100644 --- a/lv_app/lv_app.c +++ b/lv_app/lv_app.c @@ -133,6 +133,11 @@ void lv_app_init(void) dsc = ll_ins_head(&app_dsc_ll); *dsc = lv_app_files_init(); #endif + +#if USE_LV_APP_BENCHMARK != 0 + dsc = ll_ins_head(&app_dsc_ll); + *dsc = lv_app_benchmark_init(); +#endif #if USE_LV_APP_WIFI != 0 dsc = ll_ins_head(&app_dsc_ll); @@ -144,10 +149,6 @@ void lv_app_init(void) *dsc = lv_app_gsm_init(); #endif -#if USE_LV_APP_BENCHMARK != 0 - dsc = ll_ins_head(&app_dsc_ll); - *dsc = lv_app_benchmark_init(); -#endif } /** @@ -232,6 +233,7 @@ lv_obj_t * lv_app_sc_open(lv_app_inst_t * app) lv_label_set_long_mode(app->sc_title, LV_LABEL_LONG_DOTS); lv_label_set_text(app->sc_title, app->name); lv_obj_align_us(app->sc_title, NULL, LV_ALIGN_IN_TOP_MID, 0, LV_DPI / 20); + lv_obj_set_protect(app->sc_title, LV_PROTECT_POS); } else { app->sc_title = NULL; } @@ -565,7 +567,7 @@ static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_dispi_t * d lv_app_dsc_t ** dsc; lv_obj_t * elem; - LL_READ(app_dsc_ll, dsc) { + LL_READ_BACK(app_dsc_ll, dsc) { if(((*dsc)->mode & LV_APP_MODE_NOT_LIST) == 0) { elem = lv_list_add(app_list, NULL, (*dsc)->name, lv_app_menu_elem_rel_action); lv_obj_set_free_p(elem, *dsc); diff --git a/lv_app/lv_app.h b/lv_app/lv_app.h index 7c754146b..dd3fc6939 100644 --- a/lv_app/lv_app.h +++ b/lv_app/lv_app.h @@ -6,6 +6,10 @@ #ifndef LV_APP_H #define LV_APP_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -244,6 +248,10 @@ lv_app_style_t * lv_app_style_get(void); #include "lvgl/lv_appx/lv_app_gsm.h" #include "lvgl/lv_appx/lv_app_benchmark.h" -#endif /*LV_APP_ENABLE != 0*/ +#endif /*LV_APP_ENABLE*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif #endif /*LV_APP_H*/ diff --git a/lv_app/lv_app_util/lv_app_fsel.h b/lv_app/lv_app_util/lv_app_fsel.h index efba70b88..9f4d15103 100644 --- a/lv_app/lv_app_util/lv_app_fsel.h +++ b/lv_app/lv_app_util/lv_app_fsel.h @@ -6,6 +6,10 @@ #ifndef LV_APP_FSEL_H #define LV_APP_FSEL_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -62,6 +66,10 @@ void lv_app_fsel_close(void); * MACROS **********************/ -#endif /*LV_APP_ENABLE != 0*/ +#endif /*LV_APP_ENABLE*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif #endif /*LV_APP_FSEL_H*/ diff --git a/lv_app/lv_app_util/lv_app_kb.h b/lv_app/lv_app_util/lv_app_kb.h index 46d362665..aaf29ba9b 100644 --- a/lv_app/lv_app_util/lv_app_kb.h +++ b/lv_app/lv_app_util/lv_app_kb.h @@ -6,6 +6,10 @@ #ifndef LV_APP_KB_H #define LV_APP_KB_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -57,6 +61,11 @@ void lv_app_kb_close(bool ok); /********************** * MACROS **********************/ -#endif /*LV_APP_ENABLE != 0*/ + +#endif /*LV_APP_ENABLE*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif #endif /*LV_APP_KB_H*/ diff --git a/lv_app/lv_app_util/lv_app_notice.h b/lv_app/lv_app_util/lv_app_notice.h index 7c2eaca5a..b54a87f2b 100644 --- a/lv_app/lv_app_util/lv_app_notice.h +++ b/lv_app/lv_app_util/lv_app_notice.h @@ -6,6 +6,10 @@ #ifndef LV_APP_NOTICE_H #define LV_APP_NOTICE_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -58,6 +62,11 @@ lv_obj_t * lv_app_notice_add(const char * format, ...); * MACROS **********************/ +#endif /*LV_APP_ENABLE*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /*LV_APP_NOTICE_H*/ -#endif diff --git a/lv_appx/lv_app_benchmark.c b/lv_appx/lv_app_benchmark.c index 1e9f95731..0674ad353 100644 --- a/lv_appx/lv_app_benchmark.c +++ b/lv_appx/lv_app_benchmark.c @@ -3,16 +3,6 @@ * */ -/*TODO - * Win: - Complex GUI with: bg, buttons, text, lines, few recolored images - * - Buttons: Bg ON/OFF, Alpha: ON/OFF, Start (make a scr refr), Continuous (benchmark) - * - Text: last px num, last refr_time, last px/us, avg px/us - * Shorcut: - Show last px/us - * - * Use: lv_refr_set_monitor_cb(); - * Ignore results if px_num == shortcut_label_size because not its test is the goal - */ - /********************* * INCLUDES *********************/ @@ -20,11 +10,16 @@ #if LV_APP_ENABLE != 0 && USE_LV_APP_BENCHMARK != 0 #include "../lv_app/lv_app_util/lv_app_kb.h" +#include "lvgl/lv_obj/lv_refr.h" #include /********************* * DEFINES *********************/ +#define SHADOW_WIDTH (LV_DPI / 4) +#define IMG_RECOLOR OPA_30 +#define OPACITY OPA_60 + /********************** * TYPEDEFS @@ -33,14 +28,25 @@ /*Application specific data for an instance of this application*/ typedef struct { - + uint8_t wp :1; + uint8_t recolor :1; + uint8_t upscalse :1; + uint8_t shadow :1; + uint8_t opa :1; }my_app_data_t; /*Application specific data a window of this application*/ typedef struct { + lv_obj_t * wp; lv_obj_t * value_l; - + lv_style_t style_wp; + lv_style_t style_value_l; + lv_style_t style_btn_rel; + lv_style_t style_btn_pr; + lv_style_t style_btn_trel; + lv_style_t style_btn_tpr; + lv_style_t style_btn_ina; }my_win_data_t; /*Application specific data for a shortcut of this application*/ @@ -61,8 +67,12 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win); static void my_win_close(lv_app_inst_t * app); static void refr_monitor(uint32_t time_ms, uint32_t px_num); -static lv_action_res_t run_once_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); - +static lv_action_res_t run_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); +static lv_action_res_t wp_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); +static lv_action_res_t recolor_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); +static lv_action_res_t upscale_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); +static lv_action_res_t shadow_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); +static lv_action_res_t opa_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); /********************** * STATIC VARIABLES **********************/ @@ -82,10 +92,9 @@ static lv_app_dsc_t my_app_dsc = .win_data_size = sizeof(my_win_data_t), }; -static lv_style_t style_scrl; -static lv_style_t style_btn_rel; -static lv_style_t style_btn_pr; -static lv_style_t style_opa; +static lv_style_t style_win_scrl; +static lv_style_t style_sc_btn_rel; +static lv_style_t style_sc_btn_pr; static bool caputre_next; @@ -109,10 +118,17 @@ const lv_app_dsc_t * lv_app_benchmark_init(void) lv_img_create_file("app_bm_wp", img_bg); - lv_style_get(LV_STYLE_BTN_REL, &style_btn_rel); - lv_style_get(LV_STYLE_BTN_PR, &style_btn_pr); - lv_style_get(LV_STYLE_TRANSP, &style_scrl); - style_scrl.opad = LV_DPI / 6; + lv_style_get(LV_STYLE_TRANSP, &style_win_scrl); + style_win_scrl.opad = 2 * SHADOW_WIDTH + SHADOW_WIDTH / 8 ; + style_win_scrl.hpad = SHADOW_WIDTH; + style_win_scrl.vpad = SHADOW_WIDTH; + + lv_style_get(LV_STYLE_BTN_REL, &style_sc_btn_rel); + style_sc_btn_rel.font = font_get(LV_IMG_DEF_SYMBOL_FONT); + + + lv_style_get(LV_STYLE_BTN_PR, &style_sc_btn_pr); + style_sc_btn_pr.font = font_get(LV_IMG_DEF_SYMBOL_FONT); return &my_app_dsc; } @@ -130,7 +146,6 @@ const lv_app_dsc_t * lv_app_benchmark_init(void) static void my_app_run(lv_app_inst_t * app, void * conf) { /*Initialize the application*/ - } /** @@ -174,9 +189,18 @@ static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc) { my_sc_data_t * sc_data = app->sc_data; + lv_cont_set_layout(sc, LV_CONT_LAYOUT_CENTER); + sc_data->label = lv_label_create(sc, NULL); - lv_label_set_text(sc_data->label, "Empty"); - lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0); + lv_label_set_text(sc_data->label, "N/A ms"); + + lv_obj_t * btn = lv_btn_create(sc, NULL); + lv_btn_set_rel_action(btn, run_rel_action); + lv_cont_set_fit(btn, true, true); + lv_btn_set_styles(btn, &style_sc_btn_rel, &style_sc_btn_pr, NULL, NULL, NULL); + + lv_obj_t * btn_l = lv_label_create(btn, NULL); + lv_label_set_text(btn_l, SYMBOL_PLAY); } /** @@ -198,17 +222,63 @@ static void my_sc_close(lv_app_inst_t * app) static void my_win_open(lv_app_inst_t * app, lv_obj_t * win) { my_win_data_t * wdata = app->win_data; + my_app_data_t * adata = app->app_data; - lv_obj_set_style(lv_page_get_scrl(lv_win_get_page(win)), &style_scrl); + lv_style_get(LV_STYLE_BTN_INA, &wdata->style_value_l); + wdata->style_value_l.ccolor = COLOR_BLACK; + lv_style_get(LV_STYLE_BTN_REL, &wdata->style_btn_rel); + lv_style_get(LV_STYLE_BTN_PR, &wdata->style_btn_pr); + lv_style_get(LV_STYLE_BTN_TREL, &wdata->style_btn_trel); + lv_style_get(LV_STYLE_BTN_TPR, &wdata->style_btn_tpr); + lv_style_get(LV_STYLE_BTN_INA, &wdata->style_btn_ina); + lv_style_get(LV_STYLE_PLAIN, &wdata->style_wp); + wdata->style_wp.ccolor = COLOR_RED;//MAKE(0x10, 0x20, 0x30); + if(adata->opa == 0) { + wdata->style_btn_rel.opa = OPA_COVER; + wdata->style_btn_pr.opa = OPA_COVER; + wdata->style_btn_trel.opa =OPA_COVER; + wdata->style_btn_tpr.opa = OPA_COVER; + wdata->style_btn_ina.opa = OPA_COVER; + } else { + wdata->style_btn_rel.opa = OPACITY; + wdata->style_btn_pr.opa = OPACITY; + wdata->style_btn_trel.opa =OPACITY; + wdata->style_btn_tpr.opa = OPACITY; + wdata->style_btn_ina.opa = OPACITY; + } - lv_obj_t * wp; - wp = lv_img_create(win, NULL); - lv_obj_set_protect(wp, LV_PROTECT_PARENT); - lv_obj_set_parent(wp, lv_win_get_page(win)); - lv_img_set_file(wp, "U:/app_bm_wp"); - lv_obj_set_size(wp, LV_HOR_RES, LV_VER_RES - lv_obj_get_height(lv_win_get_header(win))); - lv_obj_set_pos(wp, 0, 0); + if(adata->shadow == 0) { + wdata->style_btn_rel.swidth = 0; + wdata->style_btn_pr.swidth = 0; + wdata->style_btn_trel.swidth = 0; + wdata->style_btn_tpr.swidth = 0; + wdata->style_btn_ina.swidth = 0; + } else { + wdata->style_btn_rel.swidth = SHADOW_WIDTH; + wdata->style_btn_pr.swidth = SHADOW_WIDTH; + wdata->style_btn_trel.swidth = SHADOW_WIDTH; + wdata->style_btn_tpr.swidth = SHADOW_WIDTH; + wdata->style_btn_ina.swidth = SHADOW_WIDTH; + } + + if(adata->recolor == 0) { + wdata->style_wp.img_recolor = OPA_TRANSP; + } else { + wdata->style_wp.img_recolor = IMG_RECOLOR; + } + + lv_obj_set_style(lv_page_get_scrl(lv_win_get_page(win)), &style_win_scrl); + + wdata->wp = lv_img_create(win, NULL); + lv_obj_set_protect(wdata->wp, LV_PROTECT_PARENT); + lv_obj_set_parent(wdata->wp, lv_win_get_page(win)); + lv_img_set_file(wdata->wp, "U:/app_bm_wp"); + lv_obj_set_size(wdata->wp, LV_HOR_RES, LV_VER_RES - lv_obj_get_height(lv_win_get_header(win))); + lv_obj_set_pos(wdata->wp, 0, 0); + lv_obj_set_style(wdata->wp, &wdata->style_wp); + if(adata->wp == 0) lv_obj_set_hidden(wdata->wp, true); + if(adata->upscalse != 0) lv_img_set_upscale(wdata->wp, true); /* The order is changed because the wallpaper's parent change * Therefore add the scrollable again */ @@ -220,38 +290,64 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win) holder = lv_cont_create(win, NULL); lv_cont_set_fit(holder, true, true); - lv_obj_set_style(holder, &style_btn_rel); + lv_obj_set_style(holder, &wdata->style_btn_ina); + lv_page_glue_obj(holder, true); wdata->value_l = lv_label_create(holder, NULL); - lv_label_set_text(wdata->value_l, "2345654 px in 23 ms\n12313 px/ms"); + lv_obj_set_style(wdata->value_l, &wdata->style_value_l); + lv_label_set_text(wdata->value_l, "Screen load: N/A ms\nN/A px/ms"); lv_obj_t * btn; btn = lv_btn_create(win, NULL); + lv_obj_set_free_p(btn, app); + lv_page_glue_obj(btn, true); lv_cont_set_fit(btn, true, true); - lv_btn_set_styles(btn, &style_btn_rel, &style_btn_pr, &style_btn_rel, &style_btn_pr, NULL); - lv_btn_set_rel_action(btn, run_once_rel_action); + lv_btn_set_styles(btn, &wdata->style_btn_rel, &wdata->style_btn_pr, &wdata->style_btn_trel, &wdata->style_btn_tpr, NULL); + lv_btn_set_rel_action(btn, run_rel_action); lv_obj_t * btn_l; btn_l = lv_label_create(btn, NULL); lv_label_set_text(btn_l, "Run\ntest!"); - lv_obj_set_protect(btn, LV_PROTECT_FOLLOW); + lv_obj_set_protect(btn, LV_PROTECT_FOLLOW); - lv_obj_t * cb; - cb = lv_cb_create(win, NULL); - lv_cb_set_text(cb, "Wallpaper"); - lv_btn_set_styles(cb, &style_btn_rel, &style_btn_pr, &style_btn_rel, &style_btn_pr, NULL); + btn = lv_btn_create(win, btn); + lv_btn_set_tgl(btn, true); + lv_obj_clr_protect(btn, LV_PROTECT_FOLLOW); + if(adata->wp != 0) lv_btn_set_state(btn, LV_BTN_STATE_TREL); + else lv_btn_set_state(btn, LV_BTN_STATE_REL); + lv_btn_set_rel_action(btn, wp_rel_action); + btn_l = lv_label_create(btn, btn_l); + lv_label_set_text(btn_l, "Wallpaper"); - cb = lv_cb_create(win, cb); - lv_cb_set_text(cb, "Img. recolor"); - cb = lv_cb_create(win, cb); - lv_cb_set_text(cb, "Wp. upscale"); + btn = lv_btn_create(win, btn); + if(adata->recolor != 0) lv_btn_set_state(btn, LV_BTN_STATE_TREL); + else lv_btn_set_state(btn, LV_BTN_STATE_REL); + lv_btn_set_rel_action(btn, recolor_rel_action); + btn_l = lv_label_create(btn, btn_l); + lv_label_set_text(btn_l, "Wp. recolor!"); - cb = lv_cb_create(win, cb); - lv_cb_set_text(cb, "Shadow"); - cb = lv_cb_create(win, cb); - lv_cb_set_text(cb, "Opacity"); + btn = lv_btn_create(win, btn); + if(adata->upscalse != 0) lv_btn_set_state(btn, LV_BTN_STATE_TREL); + else lv_btn_set_state(btn, LV_BTN_STATE_REL); + lv_btn_set_rel_action(btn, upscale_rel_action); + btn_l = lv_label_create(btn, btn_l); + lv_label_set_text(btn_l, "Wp. upscalse!"); + + + btn = lv_btn_create(win, btn); + if(adata->shadow != 0) lv_btn_set_state(btn, LV_BTN_STATE_TREL); + lv_btn_set_rel_action(btn, shadow_rel_action); + btn_l = lv_label_create(btn, btn_l); + lv_label_set_text(btn_l, "Shadow"); + + btn = lv_btn_create(win, btn); + if(adata->opa != 0) lv_btn_set_state(btn, LV_BTN_STATE_TREL); + else lv_btn_set_state(btn, LV_BTN_STATE_REL); + lv_btn_set_rel_action(btn, opa_rel_action); + btn_l = lv_label_create(btn, btn_l); + lv_label_set_text(btn_l, "Opacity"); } @@ -274,13 +370,22 @@ static void refr_monitor(uint32_t time_ms, uint32_t px_num) lv_app_inst_t * app = NULL; app = lv_app_get_next(app, &my_app_dsc); - char buf[256]; - if(time_ms != 0) sprintf(buf, "%d px in %d ms\n%d px/ms", px_num, time_ms, px_num/time_ms); - else sprintf(buf, "%d px in %d ms\nN/A px/ms", px_num, time_ms); + char w_buf[256]; + if(time_ms != 0) sprintf(w_buf, "Screen load: %d ms\n%d px/ms", time_ms, px_num/time_ms); + else sprintf(w_buf, "Screen load: %d ms\nN/A px/ms", time_ms); + + char s_buf[16]; + sprintf(s_buf, "%d ms", time_ms); + while(app != NULL) { if(app->win_data != NULL) { my_win_data_t * wdata = app->win_data; - lv_label_set_text(wdata->value_l, buf); + lv_label_set_text(wdata->value_l, w_buf); + } + + if(app->sc_data != NULL) { + my_sc_data_t * sdata = app->sc_data; + lv_label_set_text(sdata->label, s_buf); } app = lv_app_get_next(app, &my_app_dsc); @@ -290,7 +395,8 @@ static void refr_monitor(uint32_t time_ms, uint32_t px_num) caputre_next = false; } } -static lv_action_res_t run_once_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) + +static lv_action_res_t run_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) { lv_obj_inv(lv_scr_act()); caputre_next = true; @@ -298,6 +404,123 @@ static lv_action_res_t run_once_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) return LV_ACTION_RES_OK; } +static lv_action_res_t wp_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +{ + + lv_app_inst_t * app = lv_obj_get_free_p(btn); + my_win_data_t * wdata = app->win_data; + my_app_data_t * adata = app->app_data; + + if(lv_btn_get_state(btn) == LV_BTN_STATE_TREL) { + adata->wp = 1; + lv_obj_set_hidden(wdata->wp, false); + } else { + adata->wp = 0; + lv_obj_set_hidden(wdata->wp, true); + } + + return LV_ACTION_RES_OK; +} + +static lv_action_res_t recolor_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(btn); + my_win_data_t * wdata = app->win_data; + my_app_data_t * adata = app->app_data; + + if(lv_btn_get_state(btn) == LV_BTN_STATE_TREL) { + adata->recolor = 1; + wdata->style_wp.img_recolor = IMG_RECOLOR; + } else { + adata->recolor = 0; + wdata->style_wp.img_recolor = OPA_TRANSP; + } + + lv_obj_refr_style(wdata->wp); + + return LV_ACTION_RES_OK; +} + +static lv_action_res_t upscale_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(btn); + my_win_data_t * wdata = app->win_data; + my_app_data_t * adata = app->app_data; + + if(lv_btn_get_state(btn) == LV_BTN_STATE_TREL) { + adata->upscalse = 1; + lv_img_set_upscale(wdata->wp, true); + } else { + adata->upscalse = 0; + lv_img_set_upscale(wdata->wp, false); + } + + lv_obj_set_size(wdata->wp, LV_HOR_RES, LV_VER_RES - lv_obj_get_height(lv_win_get_header(app->win))); + + return LV_ACTION_RES_OK; +} + +static lv_action_res_t shadow_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(btn); + my_win_data_t * wdata = app->win_data; + my_app_data_t * adata = app->app_data; + + if(lv_btn_get_state(btn) == LV_BTN_STATE_TREL) { + adata->shadow = 1; + wdata->style_btn_rel.swidth = SHADOW_WIDTH; + wdata->style_btn_pr.swidth = SHADOW_WIDTH; + wdata->style_btn_trel.swidth = SHADOW_WIDTH; + wdata->style_btn_tpr.swidth = SHADOW_WIDTH; + wdata->style_btn_ina.swidth = SHADOW_WIDTH; + } else { + adata->opa = 0; + wdata->style_btn_rel.swidth = 0; + wdata->style_btn_pr.swidth = 0; + wdata->style_btn_trel.swidth =0; + wdata->style_btn_tpr.swidth = 0; + wdata->style_btn_ina.swidth = 0; + } + + lv_style_refr_objs(&wdata->style_btn_rel); + lv_style_refr_objs(&wdata->style_btn_pr); + lv_style_refr_objs(&wdata->style_btn_trel); + lv_style_refr_objs(&wdata->style_btn_tpr); + lv_style_refr_objs(&wdata->style_btn_ina); + + return LV_ACTION_RES_OK; +} + +static lv_action_res_t opa_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(btn); + my_win_data_t * wdata = app->win_data; + my_app_data_t * adata = app->app_data; + + if(lv_btn_get_state(btn) == LV_BTN_STATE_TREL) { + adata->opa = 1; + wdata->style_btn_rel.opa = OPACITY; + wdata->style_btn_pr.opa = OPACITY; + wdata->style_btn_trel.opa =OPACITY; + wdata->style_btn_tpr.opa = OPACITY; + wdata->style_btn_ina.opa = OPACITY; + } else { + adata->opa = 0; + wdata->style_btn_rel.opa = OPA_COVER; + wdata->style_btn_pr.opa = OPA_COVER; + wdata->style_btn_trel.opa =OPA_COVER; + wdata->style_btn_tpr.opa = OPA_COVER; + wdata->style_btn_ina.opa = OPA_COVER; + } + + lv_style_refr_objs(&wdata->style_btn_rel); + lv_style_refr_objs(&wdata->style_btn_pr); + lv_style_refr_objs(&wdata->style_btn_trel); + lv_style_refr_objs(&wdata->style_btn_tpr); + lv_style_refr_objs(&wdata->style_btn_ina); + + return LV_ACTION_RES_OK; +} /*Exceptionally store the data because the big array would be bothering*/ diff --git a/lv_appx/lv_app_benchmark.h b/lv_appx/lv_app_benchmark.h index 803bfe20e..9521ae516 100644 --- a/lv_appx/lv_app_benchmark.h +++ b/lv_appx/lv_app_benchmark.h @@ -6,6 +6,10 @@ #ifndef LV_APP_BENCHMARK_H #define LV_APP_BENCHMARK_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -36,4 +40,8 @@ const lv_app_dsc_t * lv_app_benchmark_init(void); #endif /*LV_APP_ENABLE != 0 && USE_LV_APP_BENCHMARK != 0*/ +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* LV_APP_BENCHMARK_H */ diff --git a/lv_appx/lv_app_example.h b/lv_appx/lv_app_example.h index 38c9dcffc..055e845f3 100644 --- a/lv_appx/lv_app_example.h +++ b/lv_appx/lv_app_example.h @@ -6,6 +6,10 @@ #ifndef LV_APP_EXAMPLE_H #define LV_APP_EXAMPLE_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -36,4 +40,9 @@ const lv_app_dsc_t * lv_app_example_init(void); #endif /*LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* LV_APP_EXAMPLE_H */ diff --git a/lv_appx/lv_app_files.h b/lv_appx/lv_app_files.h index 1fb316b2c..6cd9973e8 100644 --- a/lv_appx/lv_app_files.h +++ b/lv_appx/lv_app_files.h @@ -6,6 +6,10 @@ #ifndef LV_APP_FILES_H #define LV_APP_FILES_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -36,4 +40,8 @@ const lv_app_dsc_t * lv_app_files_init(void); #endif /*LV_APP_ENABLE != 0 && USE_LV_APP_FILES != 0*/ +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* LV_APP_EXAMPLE_H */ diff --git a/lv_appx/lv_app_gsm.h b/lv_appx/lv_app_gsm.h index aa49b8982..5b05fbaa0 100644 --- a/lv_appx/lv_app_gsm.h +++ b/lv_appx/lv_app_gsm.h @@ -6,6 +6,10 @@ #ifndef LV_APP_GSM_H #define LV_APP_GSM_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -36,4 +40,8 @@ const lv_app_dsc_t * lv_app_gsm_init(void); #endif /*LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0*/ +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* LV_APP_EXAMPLE_H */ diff --git a/lv_appx/lv_app_phantom.h b/lv_appx/lv_app_phantom.h index bb7f729f8..2ecccd924 100644 --- a/lv_appx/lv_app_phantom.h +++ b/lv_appx/lv_app_phantom.h @@ -6,6 +6,10 @@ #ifndef LV_APP_PHANTOM_H #define LV_APP_PHANTOM_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -39,4 +43,8 @@ const lv_app_dsc_t * lv_app_phantom_init(void); #endif /*LV_APP_ENABLE != 0 && USE_LV_APP_PHANTOM != 0*/ +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* LV_APP_PHANTOM_H */ diff --git a/lv_appx/lv_app_sysmon.h b/lv_appx/lv_app_sysmon.h index 3f6a83fa2..90f319ed1 100644 --- a/lv_appx/lv_app_sysmon.h +++ b/lv_appx/lv_app_sysmon.h @@ -6,6 +6,10 @@ #ifndef LV_APP_SYSMON_H #define LV_APP_SYSMON_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -36,4 +40,8 @@ const lv_app_dsc_t * lv_app_sysmon_init(void); #endif /*LV_APP_ENABLE != 0 && USE_LV_APP_SYSMON != 0*/ +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* LV_APP_SYSMON_H */ diff --git a/lv_appx/lv_app_terminal.h b/lv_appx/lv_app_terminal.h index b2bda2f18..e8f95b025 100644 --- a/lv_appx/lv_app_terminal.h +++ b/lv_appx/lv_app_terminal.h @@ -6,6 +6,10 @@ #ifndef LV_APP_TERMINAL_H #define LV_APP_TERMINAL_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -43,4 +47,8 @@ const lv_app_dsc_t * lv_app_terminal_init(void); #endif /*LV_APP_ENABLE != 0 && USE_LV_APP_TERMINAL != 0*/ +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* LV_APP_TERMINAL_H */ diff --git a/lv_appx/lv_app_wifi.h b/lv_appx/lv_app_wifi.h index 2bbce1417..d1e0d3639 100644 --- a/lv_appx/lv_app_wifi.h +++ b/lv_appx/lv_app_wifi.h @@ -6,6 +6,10 @@ #ifndef LV_APP_WIFI_H #define LV_APP_WIFI_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -36,4 +40,8 @@ const lv_app_dsc_t * lv_app_wifi_init(void); #endif /*LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0*/ +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* LV_APP_EXAMPLE_H */ diff --git a/lv_conf_templ.h b/lv_conf_templ.h index a6f66a7ab..c7925074e 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -109,6 +109,9 @@ /*Gauge (dependencies:bar, lmeter; misc: trigo)*/ #define USE_LV_GAUGE 1 +#if USE_LV_GAUGE != 0 +#define LV_GAUGE_MAX_NEEDLE 4 /*Max number of needles. Used in the style.*/ +#endif /*Chart (dependencies: -)*/ #define USE_LV_CHART 1 @@ -149,7 +152,6 @@ /*Slider (dependencies: lv_bar)*/ #define USE_LV_SLIDER 1 - /*================== * LV APP SETTINGS * =================*/ @@ -163,8 +165,8 @@ *****************************/ #define LV_APP_DESKTOP 1 /*Create a desktop-like environment*/ -#define LV_APP_SC_WIDTH (LV_HOR_RES / 4) /*Shortcut width*/ -#define LV_APP_SC_HEIGHT (LV_VER_RES / 3) /*Shortcut height*/ +#define LV_APP_SC_WIDTH (LV_DPI * 2) /*Shortcut width*/ +#define LV_APP_SC_HEIGHT (3 * LV_DPI / 2) /*Shortcut height*/ #define LV_APP_FONT_SMALL FONT_DEJAVU_20 /*A small font*/ #define LV_APP_FONT_MEDIUM FONT_DEFAULT /*A medium font*/ #define LV_APP_FONT_LARGE FONT_DEJAVU_40 /*A large font*/ @@ -242,6 +244,12 @@ #define LV_APP_FILES_CHUNK_MAX_SIZE 1024 /*Max chunk size when the user sets it*/ #endif /*USE_LV_APP_FILES != 0*/ +/*Benchmark*/ +#define USE_LV_APP_BENCHMARK 1 +#if USE_LV_APP_BENCHMARK != 0 +/*No settings*/ +#endif + /*WiFi (requires hal/wifi)*/ #define USE_LV_APP_WIFI 0 #if USE_LV_APP_WIFI != 0 diff --git a/lv_draw/lv_draw.h b/lv_draw/lv_draw.h index 1b06a4ff9..7517da20f 100644 --- a/lv_draw/lv_draw.h +++ b/lv_draw/lv_draw.h @@ -6,6 +6,10 @@ #ifndef LV_DRAW_H #define LV_DRAW_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -81,4 +85,9 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, * MACROS **********************/ + +#ifdef __cplusplus +} /* extern "C" */ #endif + +#endif /*LV_DRAW_H*/ diff --git a/lv_draw/lv_draw_rbasic.h b/lv_draw/lv_draw_rbasic.h index 08d19e93b..f26f9aa29 100644 --- a/lv_draw/lv_draw_rbasic.h +++ b/lv_draw/lv_draw_rbasic.h @@ -6,6 +6,10 @@ #ifndef LV_DRAW_RBASIC_H #define LV_DRAW_RBASIC_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -68,4 +72,9 @@ void lv_rmap(const area_t * cords_p, const area_t * mask_p, * MACROS **********************/ + +#ifdef __cplusplus +} /* extern "C" */ #endif + +#endif /*LV_DRAW_RBASIC_H*/ diff --git a/lv_draw/lv_draw_vbasic.h b/lv_draw/lv_draw_vbasic.h index 235244d02..c347d18be 100644 --- a/lv_draw/lv_draw_vbasic.h +++ b/lv_draw/lv_draw_vbasic.h @@ -6,6 +6,10 @@ #ifndef LV_DRAW_VBASIC_H #define LV_DRAW_VBASIC_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -74,6 +78,10 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, * MACROS **********************/ +#endif /*LV_VDB_SIZE != 0*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_DRAW_RBASIC_H*/ diff --git a/lv_obj/lv_dispi.h b/lv_obj/lv_dispi.h index beb0eade4..f9efc0b0d 100644 --- a/lv_obj/lv_dispi.h +++ b/lv_obj/lv_dispi.h @@ -6,6 +6,10 @@ #ifndef LV_DISPI_H #define LV_DISPI_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -103,4 +107,9 @@ void lv_dispi_wait_release(lv_dispi_t * dispi); * MACROS **********************/ + +#ifdef __cplusplus +} /* extern "C" */ #endif + +#endif /*LV_DISPI_H*/ diff --git a/lv_obj/lv_obj.c b/lv_obj/lv_obj.c index 4ec4539e8..1818416d0 100644 --- a/lv_obj/lv_obj.c +++ b/lv_obj/lv_obj.c @@ -26,7 +26,6 @@ /********************* * DEFINES *********************/ - /********************** * TYPEDEFS **********************/ @@ -1472,6 +1471,7 @@ static void lv_style_refr_core(void * style_p, lv_obj_t * obj) lv_obj_t * i; LL_READ(obj->child_ll, i) { if(i->style_p == style_p || style_p == NULL) { + lv_obj_inv(i); i->signal_f(i, LV_SIGNAL_STYLE_CHG, NULL); lv_obj_inv(i); } diff --git a/lv_obj/lv_obj.h b/lv_obj/lv_obj.h index ecaddda2f..bcd9ecdae 100644 --- a/lv_obj/lv_obj.h +++ b/lv_obj/lv_obj.h @@ -6,6 +6,10 @@ #ifndef LV_OBJ_H #define LV_OBJ_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -127,7 +131,7 @@ typedef enum LV_PROTECT_CHILD_CHG = 0x01, /*Disable the child change signal. Used by the library*/ LV_PROTECT_PARENT = 0x02, /*Prevent automatic parent change (e.g. in lv_page)*/ LV_PROTECT_POS = 0x04, /*Prevent automatic positioning (e.g. in lv_cont layout)*/ - LV_PROTECT_FOLLOW = 0x08, /*Prevent an object follow in automatic ordering (e.g. in lv_cont PRETTY layout)*/ + LV_PROTECT_FOLLOW = 0x08, /*Prevent the object be followed in automatic ordering (e.g. in lv_cont PRETTY layout)*/ }lv_protect_t; typedef enum @@ -665,4 +669,9 @@ void * lv_obj_get_free_p(lv_obj_t * obj); * MACROS **********************/ + +#ifdef __cplusplus +} /* extern "C" */ #endif + +#endif /*LV_OBJ_H*/ diff --git a/lv_obj/lv_refr.c b/lv_obj/lv_refr.c index 5479b6085..a8fac13ee 100644 --- a/lv_obj/lv_refr.c +++ b/lv_obj/lv_refr.c @@ -49,6 +49,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p); static lv_join_t inv_buf[LV_INV_FIFO_SIZE]; static uint16_t inv_buf_p; static void (*monitor_cb)(uint32_t, uint32_t); +static uint32_t px_num; /********************** * MACROS @@ -146,12 +147,25 @@ void lv_refr_set_monitor_cb(void (*cb)(uint32_t, uint32_t)) */ static void lv_refr_task(void * param) { + + uint32_t start = systick_get(); + lv_refr_join_area(); lv_refr_areas(); + bool refr_done = false; + if(inv_buf_p != 0) refr_done = true; memset(inv_buf, 0, sizeof(inv_buf)); inv_buf_p = 0; + + /* In the callback lv_obj_inv can occur + * therefore be sure the inv_buf is cleared prior to it*/ + if(refr_done != false) { + if(monitor_cb != NULL) { + monitor_cb(systick_elaps(start), px_num); + } + } } @@ -200,9 +214,8 @@ static void lv_refr_join_area(void) */ static void lv_refr_areas(void) { + px_num = 0; uint32_t i; - uint32_t start = systick_get(); - uint32_t px_num = 0; for(i = 0; i < inv_buf_p; i++) { /*Refresh the unjoined areas*/ @@ -218,12 +231,6 @@ static void lv_refr_areas(void) } } - if(inv_buf_p != 0) { - if(monitor_cb != NULL) { - monitor_cb(systick_elaps(start), px_num); - } - } - } #if LV_VDB_SIZE == 0 diff --git a/lv_obj/lv_refr.h b/lv_obj/lv_refr.h index 9ad0f2c1b..4ce4ea748 100644 --- a/lv_obj/lv_refr.h +++ b/lv_obj/lv_refr.h @@ -3,12 +3,20 @@ * */ +#ifndef LV_REFR_H +#define LV_REFR_H + +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ #include "lv_obj.h" #include + /********************* * DEFINES *********************/ @@ -49,6 +57,14 @@ void lv_inv_area(const area_t * area_p); * @param cb pointer to a callback function (void my_refr_cb(uint32_t time_ms, uint32_t px_num)) */ void lv_refr_set_monitor_cb(void (*cb)(uint32_t, uint32_t)); + /********************** * STATIC FUNCTIONS **********************/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_REFR_H*/ diff --git a/lv_obj/lv_style.c b/lv_obj/lv_style.c index 005747cdd..a2a85f9d0 100644 --- a/lv_obj/lv_style.c +++ b/lv_obj/lv_style.c @@ -75,7 +75,7 @@ void lv_style_init (void) lv_style_scr.font = font_get(FONT_DEFAULT); lv_style_scr.letter_space = 1 * LV_DOWNSCALE; - lv_style_scr.line_space = 3 * LV_DOWNSCALE; + lv_style_scr.line_space = 2 * LV_DOWNSCALE; lv_style_scr.txt_align = LV_TXT_ALIGN_LEFT; lv_style_scr.img_recolor = OPA_TRANSP; lv_style_scr.line_width = 1 * LV_DOWNSCALE; diff --git a/lv_obj/lv_style.h b/lv_obj/lv_style.h index e5aeb40f7..bb4de2080 100644 --- a/lv_obj/lv_style.h +++ b/lv_obj/lv_style.h @@ -6,6 +6,10 @@ #ifndef LV_STYLE_H #define LV_STYLE_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -102,4 +106,9 @@ void lv_style_cpy(lv_style_t * dest, const lv_style_t * src); * MACROS **********************/ + +#ifdef __cplusplus +} /* extern "C" */ #endif + +#endif /*LV_STYLE_H*/ diff --git a/lv_obj/lv_vdb.h b/lv_obj/lv_vdb.h index 60155c79c..181cca71c 100644 --- a/lv_obj/lv_vdb.h +++ b/lv_obj/lv_vdb.h @@ -6,6 +6,10 @@ #ifndef LV_VDB_H #define LV_VDB_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -51,6 +55,10 @@ void lv_vdb_flush(void); * MACROS **********************/ +#endif /*LV_VDB_SIZE != 0*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_VDB_H*/ diff --git a/lv_objx/lv_bar.h b/lv_objx/lv_bar.h index cdb8b60df..a33cc2adf 100644 --- a/lv_objx/lv_bar.h +++ b/lv_objx/lv_bar.h @@ -6,6 +6,10 @@ #ifndef LV_BAR_H #define LV_BAR_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -118,6 +122,10 @@ lv_style_t * lv_bar_get_style_indic(lv_obj_t * bar); * MACROS **********************/ +#endif /*USE_LV_BAR*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_BAR_H*/ diff --git a/lv_objx/lv_btn.h b/lv_objx/lv_btn.h index 81bac4895..b6f7a40b5 100644 --- a/lv_objx/lv_btn.h +++ b/lv_objx/lv_btn.h @@ -6,6 +6,10 @@ #ifndef LV_BTN_H #define LV_BTN_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -156,6 +160,10 @@ lv_style_t * lv_btn_get_style(lv_obj_t * btn, lv_btn_state_t state); * MACROS **********************/ +#endif /*USE_LV_BTN*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_BTN_H*/ diff --git a/lv_objx/lv_btnm.h b/lv_objx/lv_btnm.h index f5e8de100..fe7f24628 100644 --- a/lv_objx/lv_btnm.h +++ b/lv_objx/lv_btnm.h @@ -7,6 +7,10 @@ #ifndef LV_BTNM_H #define LV_BTNM_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -120,4 +124,8 @@ lv_style_t * lv_btnm_get_style_btn(lv_obj_t * btnm, lv_btn_state_t state); #endif /*USE_LV_BTNM*/ +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /*LV_BTNM_H*/ diff --git a/lv_objx/lv_cb.h b/lv_objx/lv_cb.h index e1d169b3a..b39021e93 100644 --- a/lv_objx/lv_cb.h +++ b/lv_objx/lv_cb.h @@ -6,6 +6,10 @@ #ifndef LV_CB_H #define LV_CB_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -87,6 +91,10 @@ lv_obj_t * lv_cb_get_bullet(lv_obj_t * cb); * MACROS **********************/ +#endif /*USE_LV_CB*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_CB_H*/ diff --git a/lv_objx/lv_chart.h b/lv_objx/lv_chart.h index ab2f54762..300ed4e52 100644 --- a/lv_objx/lv_chart.h +++ b/lv_objx/lv_chart.h @@ -6,6 +6,10 @@ #ifndef LV_CHART_H #define LV_CHART_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -190,6 +194,10 @@ opa_t lv_chart_get_dl_dark(lv_obj_t * chart, opa_t dark_eff); * MACROS **********************/ +#endif /*USE_LV_CHART*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_CHART_H*/ diff --git a/lv_objx/lv_cont.c b/lv_objx/lv_cont.c index ec86e0b34..a07bce224 100644 --- a/lv_objx/lv_cont.c +++ b/lv_objx/lv_cont.c @@ -382,6 +382,8 @@ static void lv_cont_layout_center(lv_obj_t * cont) cord_t h_tot = 0; LL_READ(cont->child_ll, child) { + if(lv_obj_get_hidden(child) != false || + lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue; h_tot += lv_obj_get_height(child) + style->opad; obj_num ++; } diff --git a/lv_objx/lv_cont.h b/lv_objx/lv_cont.h index 57f205592..7bd193ff4 100644 --- a/lv_objx/lv_cont.h +++ b/lv_objx/lv_cont.h @@ -6,6 +6,10 @@ #ifndef LV_CONT_H #define LV_CONT_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -107,6 +111,10 @@ bool lv_cont_get_vfit(lv_obj_t * cont); * MACROS **********************/ +#endif /*USE_LV_CONT*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_CONT_H*/ diff --git a/lv_objx/lv_ddlist.h b/lv_objx/lv_ddlist.h index 49d0097c2..8bcc1b669 100644 --- a/lv_objx/lv_ddlist.h +++ b/lv_objx/lv_ddlist.h @@ -6,6 +6,10 @@ #ifndef LV_DDLIST_H #define LV_DDLIST_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -122,7 +126,13 @@ const char * lv_ddlist_get_options(lv_obj_t * ddlist); */ uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist); +/** + * Get the current selected option as a string + * @param ddlist pointer to ddlist object + * @param buf pointer to an array to store the string + */ void lv_ddlist_get_selected_str(lv_obj_t * ddlist, char * buf); + /** * Get the auto size attribute. * @param ddlist pointer to a drop down list object @@ -141,6 +151,10 @@ lv_style_t * lv_ddlist_get_style_select(lv_obj_t * ddlist); * MACROS **********************/ +#endif /*USE_LV_DDLIST*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_DDLIST_H*/ diff --git a/lv_objx/lv_gauge.c b/lv_objx/lv_gauge.c index 8d9e647ba..4252beb98 100644 --- a/lv_objx/lv_gauge.c +++ b/lv_objx/lv_gauge.c @@ -21,6 +21,10 @@ /********************* * DEFINES *********************/ +#ifndef LV_GAUGE_MAX_NEEDLE +#define LV_GAUGE_MAX_NEEDLE 4 /*Max number of needles. Used in the style.*/ +#endif + #define LV_GAUGE_DEF_NEEDLE_COLOR COLOR_RED /********************** diff --git a/lv_objx/lv_gauge.h b/lv_objx/lv_gauge.h index e333b961e..0881e3423 100644 --- a/lv_objx/lv_gauge.h +++ b/lv_objx/lv_gauge.h @@ -6,6 +6,10 @@ #ifndef LV_GAUGE_H #define LV_GAUGE_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -31,7 +35,6 @@ /********************* * DEFINES *********************/ -#define LV_GAUGE_MAX_NEEDLE 4 /*Max number of needles. Used in the style.*/ /********************** * TYPEDEFS @@ -133,6 +136,10 @@ lv_style_t * lv_gauge_get_style_critical(lv_obj_t * gauge); * MACROS **********************/ +#endif /*USE_LV_GAUGE*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_GAUGE_H*/ diff --git a/lv_objx/lv_img.h b/lv_objx/lv_img.h index a972c7d25..ba6f0a4be 100644 --- a/lv_objx/lv_img.h +++ b/lv_objx/lv_img.h @@ -6,6 +6,10 @@ #ifndef LV_IMG_H #define LV_IMG_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -136,6 +140,10 @@ bool lv_img_get_upscale(lv_obj_t * img); /*Use this macro to declare an image in a c file*/ #define LV_IMG_DECLARE(var_name) extern const color_int_t var_name[]; +#endif /*USE_LV_IMG*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_IMG_H*/ diff --git a/lv_objx/lv_label.h b/lv_objx/lv_label.h index 8df9c17ef..a673d34d7 100644 --- a/lv_objx/lv_label.h +++ b/lv_objx/lv_label.h @@ -6,6 +6,10 @@ #ifndef LV_LABEL_H #define LV_LABEL_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -170,6 +174,10 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos); * MACROS **********************/ +#endif /*USE_LV_LABEL*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_LABEL_H*/ diff --git a/lv_objx/lv_led.h b/lv_objx/lv_led.h index 5faa9f1d9..431dbf1bf 100644 --- a/lv_objx/lv_led.h +++ b/lv_objx/lv_led.h @@ -6,6 +6,10 @@ #ifndef LV_LED_H #define LV_LED_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -87,6 +91,10 @@ uint8_t lv_led_get_bright(lv_obj_t * led); * MACROS **********************/ +#endif /*USE_LV_LED*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_LED_H*/ diff --git a/lv_objx/lv_line.h b/lv_objx/lv_line.h index 220b16686..a1a020e67 100644 --- a/lv_objx/lv_line.h +++ b/lv_objx/lv_line.h @@ -6,6 +6,10 @@ #ifndef LV_LINE_H #define LV_LINE_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -110,6 +114,10 @@ bool lv_line_get_upscale(lv_obj_t * line); * MACROS **********************/ +#endif /*USE_LV_LINE*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_LINE_H*/ diff --git a/lv_objx/lv_list.h b/lv_objx/lv_list.h index b09409ff4..ba97dbcc4 100644 --- a/lv_objx/lv_list.h +++ b/lv_objx/lv_list.h @@ -6,6 +6,10 @@ #ifndef LV_LIST_H #define LV_LIST_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -163,6 +167,10 @@ lv_style_t * lv_list_get_style_img(lv_obj_t * list, lv_btn_state_t state); * MACROS **********************/ +#endif /*USE_LV_LIST*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_LIST_H*/ diff --git a/lv_objx/lv_lmeter.h b/lv_objx/lv_lmeter.h index da7739312..12badccdf 100644 --- a/lv_objx/lv_lmeter.h +++ b/lv_objx/lv_lmeter.h @@ -6,6 +6,10 @@ #ifndef LV_LMETER_H #define LV_LMETER_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -88,6 +92,10 @@ uint16_t lv_lmeter_get_scale_angle(lv_obj_t * lmeter); * MACROS **********************/ +#endif /*USE_LV_LMETER*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_LMETER_H*/ diff --git a/lv_objx/lv_mbox.h b/lv_objx/lv_mbox.h index df31e7eb7..69ce1b804 100644 --- a/lv_objx/lv_mbox.h +++ b/lv_objx/lv_mbox.h @@ -6,6 +6,10 @@ #ifndef LV_MBOX_H #define LV_MBOX_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -161,6 +165,10 @@ lv_style_t * lv_mbox_get_style_btn(lv_obj_t * mbox, lv_btn_state_t state); * MACROS **********************/ +#endif /*USE_LV_MBOX*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_MBOX_H*/ diff --git a/lv_objx/lv_objx_templ.h b/lv_objx/lv_objx_templ.h index 6998a6484..15d0d2110 100644 --- a/lv_objx/lv_objx_templ.h +++ b/lv_objx/lv_objx_templ.h @@ -13,6 +13,10 @@ #ifndef LV_TEMPL_H #define LV_TEMPL_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -61,6 +65,10 @@ bool lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param); * MACROS **********************/ +#endif /*USE_LV_TEMPL*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_TEMPL_H*/ diff --git a/lv_objx/lv_page.h b/lv_objx/lv_page.h index 117103afb..e8f5503cc 100644 --- a/lv_objx/lv_page.h +++ b/lv_objx/lv_page.h @@ -6,6 +6,10 @@ #ifndef LV_PAGE_H #define LV_PAGE_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -158,6 +162,10 @@ lv_style_t * lv_page_get_style_sb(lv_obj_t * page); * MACROS **********************/ +#endif /*USE_LV_PAGE*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_PAGE_H*/ diff --git a/lv_objx/lv_slider.h b/lv_objx/lv_slider.h index 7c0e61e69..b9f277980 100644 --- a/lv_objx/lv_slider.h +++ b/lv_objx/lv_slider.h @@ -6,6 +6,10 @@ #ifndef LV_SLIDER_H #define LV_SLIDER_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -91,6 +95,10 @@ lv_style_t * lv_slider_get_style_knob(lv_obj_t * slider); * MACROS **********************/ +#endif /*USE_LV_SLIDER*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_SLIDER_H*/ diff --git a/lv_objx/lv_ta.h b/lv_objx/lv_ta.h index a17ebe650..e0a230f95 100644 --- a/lv_objx/lv_ta.h +++ b/lv_objx/lv_ta.h @@ -6,6 +6,10 @@ #ifndef LV_TA_H #define LV_TA_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -182,6 +186,10 @@ bool lv_ta_get_pwd_mode(lv_obj_t * ta); * MACROS **********************/ +#endif /*USE_LV_TA_H*/ + +#ifdef __cplusplus +} /* extern "C" */ #endif -#endif +#endif /*LV_TA_H*/ diff --git a/lv_objx/lv_win.h b/lv_objx/lv_win.h index 126a72274..ec918c55b 100644 --- a/lv_objx/lv_win.h +++ b/lv_objx/lv_win.h @@ -6,6 +6,10 @@ #ifndef LV_WIN_H #define LV_WIN_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -169,4 +173,8 @@ lv_obj_t * lv_win_get_from_cbtn(lv_obj_t * ctrl_btn); #endif /*USE_LV_WIN*/ +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /*LV_WIN_H*/ diff --git a/lvgl.h b/lvgl.h index 58f1cc3a4..fb0aebe06 100644 --- a/lvgl.h +++ b/lvgl.h @@ -6,6 +6,10 @@ #ifndef LVGL_H #define LVGL_H +#ifdef __cplusplus +extern "C" { +#endif + /********************* * INCLUDES *********************/ @@ -55,7 +59,7 @@ * DEFINES *********************/ #define LVGL_VERSION_MAJOR 4 -#define LVGL_VERSION_MINOR 0 +#define LVGL_VERSION_MINOR 1 #define LVGL_VERSION_PATH 0