add the prototypes of the examples

This commit is contained in:
Gabor Kiss-Vamosi
2021-02-19 18:19:32 +01:00
parent fe20d47b6e
commit ca4f11e9f4
18 changed files with 168 additions and 26 deletions

1
examples/examples.mk Normal file
View File

@@ -0,0 +1 @@
CSRCS += $(shell find -L $(LVGL_DIR)/$(LVGL_DIR_NAME)/examples -name \*.c)

View File

@@ -3,8 +3,8 @@
* *
*/ */
#ifndef LV_EX_FLEX_H #ifndef LV_EXAMPLE_FLEX_H
#define LV_EX_FLEX_H #define LV_EXAMPLE_FLEX_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -25,6 +25,12 @@ extern "C" {
/********************** /**********************
* GLOBAL PROTOTYPES * 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 * MACROS
@@ -34,4 +40,4 @@ extern "C" {
} /* extern "C" */ } /* extern "C" */
#endif #endif
#endif /*LV_EX_FLEX_H*/ #endif /*LV_EXAMPLE_FLEX_H*/

View File

@@ -3,8 +3,8 @@
* *
*/ */
#ifndef LV_EX_GRID_H #ifndef LV_EXAMPLE_GRID_H
#define LV_EX_GRID_H #define LV_EXAMPLE_GRID_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -25,6 +25,12 @@ extern "C" {
/********************** /**********************
* GLOBAL PROTOTYPES * 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 * MACROS
@@ -34,4 +40,4 @@ extern "C" {
} /* extern "C" */ } /* extern "C" */
#endif #endif
#endif /*LV_EX_GRID_H*/ #endif /*LV_EXAMPLE_GRID_H*/

View File

@@ -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*/

41
examples/lv_examples.h Normal file
View File

@@ -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*/

View File

@@ -1,3 +1,4 @@
typedef int _keep_pedantic_happy;
//#include "../../lv_examples.h" //#include "../../lv_examples.h"
// //
///** ///**

View File

@@ -0,0 +1 @@
typedef int _keep_pedantic_happy;

View File

@@ -2,7 +2,7 @@
#if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES #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) { if(e == LV_EVENT_DRAW_PART_BEGIN) {
lv_obj_draw_hook_dsc_t * dsc = lv_event_get_param(); lv_obj_draw_hook_dsc_t * dsc = lv_event_get_param();

View File

@@ -1,11 +1,10 @@
#include "../../../lvgl.h" #include "../../../lvgl.h"
#if LV_USE_IMG && LV_BUILD_EXAMPLES #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) void lv_example_img_1(void)
{ {
LV_IMG_DECLARE(img_cogwheel_argb);
lv_obj_t * img1 = lv_img_create(lv_scr_act(), NULL); lv_obj_t * img1 = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(img1, &img_cogwheel_argb); lv_img_set_src(img1, &img_cogwheel_argb);
lv_obj_align(img1, NULL, LV_ALIGN_CENTER, 0, -20); lv_obj_align(img1, NULL, LV_ALIGN_CENTER, 0, -20);

View File

@@ -30,7 +30,7 @@ void lv_example_img_2(void)
lv_obj_align(intense_slider, blue_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0); lv_obj_align(intense_slider, blue_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0);
/* Now create the actual image */ /* 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); img1 = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(img1, &img_cogwheel_argb); lv_img_set_src(img1, &img_cogwheel_argb);
lv_obj_align(img1, NULL, LV_ALIGN_IN_RIGHT_MID, -20, 0); lv_obj_align(img1, NULL, LV_ALIGN_IN_RIGHT_MID, -20, 0);

View File

@@ -1,13 +1,14 @@
#include "../../../lvgl.h" #include "../../../lvgl.h"
#if LV_USE_IMG && LV_BUILD_EXAMPLES #if LV_USE_IMG && LV_BUILD_EXAMPLES
LV_IMG_DECLARE(img_cogwheel_argb);
/** /**
* Show transformations (zoom and rotation) using a pivot point. * Show transformations (zoom and rotation) using a pivot point.
*/ */
void lv_example_img_3(void) void lv_example_img_3(void)
{ {
LV_IMG_DECLARE(img_cogwheel_argb);
/* Now create the actual image */ /* Now create the actual image */
lv_obj_t * img = lv_img_create(lv_scr_act(), NULL); lv_obj_t * img = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(img, &img_cogwheel_argb); lv_img_set_src(img, &img_cogwheel_argb);

View File

@@ -1,13 +1,13 @@
#include "../../../lvgl.h" #include "../../../lvgl.h"
#if LV_USE_IMG && LV_BUILD_EXAMPLES #if LV_USE_IMG && LV_BUILD_EXAMPLES
LV_IMG_DECLARE(img_skew_strip);
/** /**
* Image styling and offset * Image styling and offset
*/ */
void lv_example_img_4(void) void lv_example_img_4(void)
{ {
LV_IMG_DECLARE(img_skew_strip);
static lv_style_t style; static lv_style_t style;
lv_style_init(&style); lv_style_init(&style);
lv_style_set_bg_color(&style, LV_COLOR_YELLOW); lv_style_set_bg_color(&style, LV_COLOR_YELLOW);

View File

@@ -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*/ /*Create a keyboard to use it with an of the text areas*/
lv_obj_t *kb = lv_keyboard_create(lv_scr_act()); lv_obj_t *kb = lv_keyboard_create(lv_scr_act());

View File

@@ -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)); 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*/ /*Create a list*/
lv_obj_t * list1 = lv_list_create(lv_scr_act()); lv_obj_t * list1 = lv_list_create(lv_scr_act());

View File

@@ -27,45 +27,92 @@ extern "C" {
**********************/ **********************/
void lv_example_arc_1(void); void lv_example_arc_1(void);
void lv_example_arc_2(void); void lv_example_arc_2(void);
void lv_example_bar_1(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_1(void);
void lv_example_btn_2(void); void lv_example_btn_2(void);
void lv_example_btn_3(void);
void lv_example_btnmatrix_1(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_calendar_1(void);
void lv_example_canvas_1(void); void lv_example_canvas_1(void);
void lv_example_canvas_2(void); void lv_example_canvas_2(void);
void lv_example_checkbox_1(void);
void lv_example_chart_1(void); void lv_example_chart_1(void);
void lv_example_chart_2(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_1(void);
void lv_example_dropdown_2(void); void lv_example_dropdown_2(void);
void lv_example_gauge_1(void); void lv_example_dropdown_3(void);
void lv_example_gauge_2(void);
void lv_example_img_1(void); void lv_example_img_1(void);
void lv_example_img_2(void); void lv_example_img_2(void);
void lv_example_img_3(void); void lv_example_img_3(void);
void lv_example_img_4(void);
void lv_example_imgbtn_1(void); void lv_example_imgbtn_1(void);
void lv_example_keyboard_1(void); void lv_example_keyboard_1(void);
void lv_example_label_1(void); void lv_example_label_1(void);
void lv_example_label_2(void); void lv_example_label_2(void);
void lv_example_label_3(void);
void lv_example_led_1(void); void lv_example_led_1(void);
void lv_example_line_1(void); void lv_example_line_1(void);
void lv_example_list_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_1(void);
void lv_example_msgbox_2(void);
void lv_example_obj_1(void); void lv_example_obj_1(void);
void lv_example_spinner_1(void);
void lv_example_roller_1(void); void lv_example_roller_1(void);
void lv_example_roller_2(void);
void lv_example_slider_1(void); void lv_example_slider_1(void);
void lv_example_slider_2(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_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_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 * MACROS
**********************/ **********************/

View File

@@ -1,5 +1,5 @@
#include "../../../lvgl.h" #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) static void event_handler(lv_obj_t * obj, lv_event_t event)
{ {