diff --git a/examples/examples.mk b/examples/examples.mk new file mode 100644 index 000000000..b8fa7eb5a --- /dev/null +++ b/examples/examples.mk @@ -0,0 +1 @@ +CSRCS += $(shell find -L $(LVGL_DIR)/$(LVGL_DIR_NAME)/examples -name \*.c) diff --git a/examples/get_started/llv_example_get_started_.h b/examples/get_started/lv_example_get_started.h similarity index 100% rename from examples/get_started/llv_example_get_started_.h rename to examples/get_started/lv_example_get_started.h diff --git a/examples/layouts/flex/lv_example_flex.h b/examples/layouts/flex/lv_example_flex.h index c9daf66d9..615461d93 100644 --- a/examples/layouts/flex/lv_example_flex.h +++ b/examples/layouts/flex/lv_example_flex.h @@ -3,8 +3,8 @@ * */ -#ifndef LV_EX_FLEX_H -#define LV_EX_FLEX_H +#ifndef LV_EXAMPLE_FLEX_H +#define LV_EXAMPLE_FLEX_H #ifdef __cplusplus extern "C" { @@ -25,6 +25,12 @@ extern "C" { /********************** * GLOBAL PROTOTYPES **********************/ +void lv_example_flex_1(void); +void lv_example_flex_2(void); +void lv_example_flex_3(void); +void lv_example_flex_4(void); +void lv_example_flex_5(void); +void lv_example_flex_6(void); /********************** * MACROS @@ -34,4 +40,4 @@ extern "C" { } /* extern "C" */ #endif -#endif /*LV_EX_FLEX_H*/ +#endif /*LV_EXAMPLE_FLEX_H*/ diff --git a/examples/layouts/grid/lv_example_grid.h b/examples/layouts/grid/lv_example_grid.h index 69d284d30..ae7decbad 100644 --- a/examples/layouts/grid/lv_example_grid.h +++ b/examples/layouts/grid/lv_example_grid.h @@ -3,8 +3,8 @@ * */ -#ifndef LV_EX_GRID_H -#define LV_EX_GRID_H +#ifndef LV_EXAMPLE_GRID_H +#define LV_EXAMPLE_GRID_H #ifdef __cplusplus extern "C" { @@ -25,6 +25,12 @@ extern "C" { /********************** * GLOBAL PROTOTYPES **********************/ +void lv_example_grid_1(void); +void lv_example_grid_2(void); +void lv_example_grid_3(void); +void lv_example_grid_4(void); +void lv_example_grid_5(void); +void lv_example_grid_6(void); /********************** * MACROS @@ -34,4 +40,4 @@ extern "C" { } /* extern "C" */ #endif -#endif /*LV_EX_GRID_H*/ +#endif /*LV_EXAMPLE_GRID_H*/ diff --git a/examples/layouts/lv_example_layout.h b/examples/layouts/lv_example_layout.h new file mode 100644 index 000000000..c1fcfdcc9 --- /dev/null +++ b/examples/layouts/lv_example_layout.h @@ -0,0 +1,39 @@ +/** + * @file lv_example_layout.h + * + */ + +#ifndef LV_EXAMPLE_LAYOUT_H +#define LV_EXAMPLE_LAYOUT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "flex/lv_example_flex.h" +#include "grid/lv_example_grid.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_EXAMPLE_LAYOUT_H*/ diff --git a/examples/lv_examples.h b/examples/lv_examples.h new file mode 100644 index 000000000..0ca3c57db --- /dev/null +++ b/examples/lv_examples.h @@ -0,0 +1,41 @@ +/** + * @file lv_examples.h + * + */ + +#ifndef LV_EXAMPLES_H +#define LV_EXAMPLES_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "styles/lv_example_style.h" +#include "get_started/lv_example_get_started.h" +#include "widgets/lv_example_widgets.h" +#include "layouts/lv_example_layout.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_EXAMPLES_H*/ diff --git a/examples/styles/lv_example_style_10.c b/examples/styles/lv_example_style_10.c index 89401cfa1..b3072cce2 100644 --- a/examples/styles/lv_example_style_10.c +++ b/examples/styles/lv_example_style_10.c @@ -1,3 +1,4 @@ +typedef int _keep_pedantic_happy; //#include "../../lv_examples.h" // ///** diff --git a/examples/styles/lv_example_style_6.c b/examples/styles/lv_example_style_6.c index e69de29bb..9f03bd30d 100644 --- a/examples/styles/lv_example_style_6.c +++ b/examples/styles/lv_example_style_6.c @@ -0,0 +1 @@ +typedef int _keep_pedantic_happy; diff --git a/examples/widgets/btn/lv_btn_example_3.c b/examples/widgets/btn/lv_example_btn_3.c similarity index 100% rename from examples/widgets/btn/lv_btn_example_3.c rename to examples/widgets/btn/lv_example_btn_3.c diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c index f54a5738f..0221ffbbc 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c @@ -2,7 +2,7 @@ #if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES -void event_cb(lv_obj_t * obj, lv_event_t e) +static void event_cb(lv_obj_t * obj, lv_event_t e) { if(e == LV_EVENT_DRAW_PART_BEGIN) { lv_obj_draw_hook_dsc_t * dsc = lv_event_get_param(); diff --git a/examples/widgets/img/lv_example_img_1.c b/examples/widgets/img/lv_example_img_1.c index 0990f270b..be47c03a5 100644 --- a/examples/widgets/img/lv_example_img_1.c +++ b/examples/widgets/img/lv_example_img_1.c @@ -1,11 +1,10 @@ #include "../../../lvgl.h" #if LV_USE_IMG && LV_BUILD_EXAMPLES -/* Find the image here: https://github.com/lvgl/lv_examples/tree/master/assets */ -LV_IMG_DECLARE(img_cogwheel_argb); void lv_example_img_1(void) { + LV_IMG_DECLARE(img_cogwheel_argb); lv_obj_t * img1 = lv_img_create(lv_scr_act(), NULL); lv_img_set_src(img1, &img_cogwheel_argb); lv_obj_align(img1, NULL, LV_ALIGN_CENTER, 0, -20); diff --git a/examples/widgets/img/lv_example_img_2.c b/examples/widgets/img/lv_example_img_2.c index 280d7d98b..d8863b35c 100644 --- a/examples/widgets/img/lv_example_img_2.c +++ b/examples/widgets/img/lv_example_img_2.c @@ -30,7 +30,7 @@ void lv_example_img_2(void) lv_obj_align(intense_slider, blue_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0); /* Now create the actual image */ - LV_IMG_DECLARE(img_cogwheel_argb); + LV_IMG_DECLARE(img_cogwheel_argb) img1 = lv_img_create(lv_scr_act(), NULL); lv_img_set_src(img1, &img_cogwheel_argb); lv_obj_align(img1, NULL, LV_ALIGN_IN_RIGHT_MID, -20, 0); diff --git a/examples/widgets/img/lv_example_img_3.c b/examples/widgets/img/lv_example_img_3.c index 4f9f8303f..77e1f9541 100644 --- a/examples/widgets/img/lv_example_img_3.c +++ b/examples/widgets/img/lv_example_img_3.c @@ -1,13 +1,14 @@ #include "../../../lvgl.h" #if LV_USE_IMG && LV_BUILD_EXAMPLES -LV_IMG_DECLARE(img_cogwheel_argb); /** * Show transformations (zoom and rotation) using a pivot point. */ void lv_example_img_3(void) { + LV_IMG_DECLARE(img_cogwheel_argb); + /* Now create the actual image */ lv_obj_t * img = lv_img_create(lv_scr_act(), NULL); lv_img_set_src(img, &img_cogwheel_argb); diff --git a/examples/widgets/img/lv_example_img_4.c b/examples/widgets/img/lv_example_img_4.c index 526fdd911..9787eb396 100644 --- a/examples/widgets/img/lv_example_img_4.c +++ b/examples/widgets/img/lv_example_img_4.c @@ -1,13 +1,13 @@ #include "../../../lvgl.h" #if LV_USE_IMG && LV_BUILD_EXAMPLES -LV_IMG_DECLARE(img_skew_strip); - /** * Image styling and offset */ void lv_example_img_4(void) { + LV_IMG_DECLARE(img_skew_strip); + static lv_style_t style; lv_style_init(&style); lv_style_set_bg_color(&style, LV_COLOR_YELLOW); diff --git a/examples/widgets/keyboard/lv_example_keyboard_1.c b/examples/widgets/keyboard/lv_example_keyboard_1.c index a6cf5e1ad..b166e9379 100644 --- a/examples/widgets/keyboard/lv_example_keyboard_1.c +++ b/examples/widgets/keyboard/lv_example_keyboard_1.c @@ -15,7 +15,7 @@ static void ta_event_cb(lv_obj_t * ta, lv_event_t e) } } -void lv_keyboard_example_1(void) +void lv_example_keyboard_1(void) { /*Create a keyboard to use it with an of the text areas*/ lv_obj_t *kb = lv_keyboard_create(lv_scr_act()); diff --git a/examples/widgets/list/lv_example_list_1.c b/examples/widgets/list/lv_example_list_1.c index ba6301262..1159a24b5 100644 --- a/examples/widgets/list/lv_example_list_1.c +++ b/examples/widgets/list/lv_example_list_1.c @@ -7,7 +7,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) LV_LOG_USER("Clicked: %s\n", lv_list_get_btn_text(obj)); } } -void lv_list_example_1(void) +void lv_example_list_1(void) { /*Create a list*/ lv_obj_t * list1 = lv_list_create(lv_scr_act()); diff --git a/examples/widgets/lv_example_widgets.h b/examples/widgets/lv_example_widgets.h index d02ab574e..50490f7c3 100644 --- a/examples/widgets/lv_example_widgets.h +++ b/examples/widgets/lv_example_widgets.h @@ -27,45 +27,92 @@ extern "C" { **********************/ void lv_example_arc_1(void); void lv_example_arc_2(void); + void lv_example_bar_1(void); +void lv_example_bar_2(void); +void lv_example_bar_3(void); +void lv_example_bar_4(void); +void lv_example_bar_5(void); +void lv_example_bar_6(void); + void lv_example_btn_1(void); void lv_example_btn_2(void); +void lv_example_btn_3(void); + void lv_example_btnmatrix_1(void); +void lv_example_btnmatrix_2(void); +void lv_example_btnmatrix_3(void); + void lv_example_calendar_1(void); + void lv_example_canvas_1(void); void lv_example_canvas_2(void); -void lv_example_checkbox_1(void); + void lv_example_chart_1(void); void lv_example_chart_2(void); +void lv_example_chart_3(void); +void lv_example_chart_4(void); + +void lv_example_checkbox_1(void); + +void lv_example_colorwheel_1(void); + void lv_example_dropdown_1(void); void lv_example_dropdown_2(void); -void lv_example_gauge_1(void); -void lv_example_gauge_2(void); +void lv_example_dropdown_3(void); + void lv_example_img_1(void); void lv_example_img_2(void); void lv_example_img_3(void); +void lv_example_img_4(void); + void lv_example_imgbtn_1(void); + void lv_example_keyboard_1(void); + void lv_example_label_1(void); void lv_example_label_2(void); -void lv_example_label_3(void); + void lv_example_led_1(void); + void lv_example_line_1(void); + void lv_example_list_1(void); -void lv_example_linemeter_1(void); + +void lv_example_meter_1(void); +void lv_example_meter_2(void); +void lv_example_meter_3(void); +void lv_example_meter_4(void); + void lv_example_msgbox_1(void); -void lv_example_msgbox_2(void); + void lv_example_obj_1(void); -void lv_example_spinner_1(void); + void lv_example_roller_1(void); +void lv_example_roller_2(void); + void lv_example_slider_1(void); void lv_example_slider_2(void); +void lv_example_slider_3(void); + +void lv_example_spinbox_1(void); + +void lv_example_spinner_1(void); + void lv_example_switch_1(void); -void lv_example_textarea_1(void); -void lv_example_objmask_1(void); -void lv_example_objmask_2(void); + void lv_example_table_1(void); +void lv_example_tabview_1(void); + +void lv_example_textarea_1(void); +void lv_example_textarea_2(void); +void lv_example_textarea_3(void); + +void lv_example_tileview_1(void); + +void lv_example_win_1(void); + /********************** * MACROS **********************/ diff --git a/examples/widgets/roller/lv_roller_example_2.c b/examples/widgets/roller/lv_example_roller_2.c similarity index 97% rename from examples/widgets/roller/lv_roller_example_2.c rename to examples/widgets/roller/lv_example_roller_2.c index d37d74091..0f0cf0ba8 100644 --- a/examples/widgets/roller/lv_roller_example_2.c +++ b/examples/widgets/roller/lv_example_roller_2.c @@ -1,5 +1,5 @@ #include "../../../lvgl.h" -#if LV_USE_ROLLER && LV_BUILD_EXAMPLES +#if LV_USE_ROLLER && LV_FONT_MONTSERRAT_22 && LV_BUILD_EXAMPLES static void event_handler(lv_obj_t * obj, lv_event_t event) {