BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lvgl
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
lvgl
Commits
2bdfdc0e
Commit
2bdfdc0e
authored
Jul 26, 2017
by
Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hello_world example added and encoder_ctrl begun
parent
9fcb264e
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
352 additions
and
3 deletions
+352
-3
lv_conf_templ.h
lv_conf_templ.h
+2
-1
lv_hello_world.c
lv_examples/1_1_lv_hello_world/lv_hello_world.c
+67
-0
lv_hello_world.h
lv_examples/1_1_lv_hello_world/lv_hello_world.h
+42
-0
animations.c
lv_examples/1_5_animations/animations.c
+0
-0
animations.h
lv_examples/1_5_animations/animations.h
+0
-0
anti_aliasing.c
lv_examples/1_6_anti_aliasing/anti_aliasing.c
+0
-0
anti_aliasing.h
lv_examples/1_6_anti_aliasing/anti_aliasing.h
+0
-0
new_obj_type.c
lv_examples/1_8_new_obj_type/new_obj_type.c
+0
-0
new_obj_type.h
lv_examples/1_8_new_obj_type/new_obj_type.h
+0
-0
encoder_ctrl.c
lv_examples/2_2_encoder_ctrl/encoder_ctrl.c
+197
-0
encoder_ctrl.h
lv_examples/2_2_encoder_ctrl/encoder_ctrl.h
+42
-0
lv_group.h
lv_obj/lv_group.h
+0
-1
lv_cb.c
lv_objx/lv_cb.c
+2
-1
No files found.
lv_conf_templ.h
View file @
2bdfdc0e
...
...
@@ -50,7 +50,8 @@
#define LV_OBJ_GROUP 1 /*Enable object groups*/
/*Others*/
#define LV_COLOR_TRANSP COLOR_LIME
#define LV_COLOR_TRANSP COLOR_LIME /*This could mean transparent pixel*/
#define USE_LV_EXAMPLE 1 /*Enable examples (lvgl/lv_examples/). Disable to save memory*/
/*==================
* LV OBJ X USAGE
...
...
lv_examples/1_1_lv_hello_world/lv_hello_world.c
View file @
2bdfdc0e
/**
* @file lv_hello_world.c
*
*/
/*
* Greetings,
* this is the first example in the tutorial hence this is the most simple one.
* It only creates a Label, set its text, and align to the middle.
*
* Be sure in lv_conf.h LV_APP_ENEBLE is 0 (just for simplicity)
*/
/*********************
* INCLUDES
*********************/
#include "lv_hello_world.h"
#if USE_LV_EXAMPLE != 0
#include "lvgl/lvgl.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a simple 'Hello world!' label
*/
void
lv_hello_world_init
(
void
)
{
/*Create a Label on the current screen*/
lv_obj_t
*
label1
=
lv_label_create
(
lv_scr_act
(),
NULL
);
/*Modify the Label's text*/
lv_label_set_text
(
label1
,
"Hello world!"
);
/* Align the Label to the center
* NULL means align on parent (which is the screen now)
* 0, 0 at the and means an x, y offset after alignment*/
lv_obj_align_us
(
label1
,
NULL
,
LV_ALIGN_CENTER
,
0
,
0
);
}
/**********************
* STATIC FUNCTIONS
**********************/
#endif
/*USE_LV_EXAMPLE != 0*/
lv_examples/1_1_lv_hello_world/lv_hello_world.h
View file @
2bdfdc0e
/**
* @file lv_hello_world.h
*
*/
#ifndef LV_HELLO_WORLD_H
#define LV_HELLO_WORLD_H
#ifdef __cplusplus
extern
"C"
{
#endif
/*********************
* INCLUDES
*********************/
#include "lv_conf.h"
#if USE_LV_EXAMPLE != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void
lv_hello_world_init
(
void
);
/**********************
* MACROS
**********************/
#endif
/*USE_LV_EXAMPLE != 0*/
#ifdef __cplusplus
}
/* extern "C" */
#endif
#endif
/*LV_HELLO_WORLD_H*/
lv_examples/1_
4
_animations/animations.c
→
lv_examples/1_
5
_animations/animations.c
View file @
2bdfdc0e
File moved
lv_examples/1_
4
_animations/animations.h
→
lv_examples/1_
5
_animations/animations.h
View file @
2bdfdc0e
File moved
lv_examples/1_
5
_anti_aliasing/anti_aliasing.c
→
lv_examples/1_
6
_anti_aliasing/anti_aliasing.c
View file @
2bdfdc0e
File moved
lv_examples/1_
5
_anti_aliasing/anti_aliasing.h
→
lv_examples/1_
6
_anti_aliasing/anti_aliasing.h
View file @
2bdfdc0e
File moved
lv_examples/1_
6
_new_obj_type/new_obj_type.c
→
lv_examples/1_
8
_new_obj_type/new_obj_type.c
View file @
2bdfdc0e
File moved
lv_examples/1_
6
_new_obj_type/new_obj_type.h
→
lv_examples/1_
8
_new_obj_type/new_obj_type.h
View file @
2bdfdc0e
File moved
lv_examples/2_2_encoder_ctrl/encoder_ctrl.c
View file @
2bdfdc0e
/**
* @file encoder_ctrl.c
*
*/
/*********************
* INCLUDES
*********************/
#include "encoder_ctrl.h"
#if USE_LV_EXAMPLE != 0
#include "lvgl/lvgl.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static
lv_action_res_t
btn_next
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
);
static
lv_action_res_t
btn_inc
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
);
static
lv_action_res_t
btn_dec
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
);
static
lv_action_res_t
btn_sel
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
);
/**********************
* STATIC VARIABLES
**********************/
lv_group_t
*
g1
;
/*Declare an Object Group*/
lv_group_t
*
g2
;
/*Declare an Object Group*/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
*/
void
encoder_ctrl_init
(
void
)
{
/* Create a Container screen and use Pretty layout
* to make the content responsive.
* See the 'responsive' example for more information */
lv_obj_t
*
scr
=
lv_page_create
(
NULL
,
NULL
);
lv_cont_set_layout
(
lv_page_get_scrl
(
scr
),
LV_CONT_LAYOUT_PRETTY
);
lv_scr_load
(
scr
);
g1
=
lv_group_create
();
g2
=
lv_group_create
();
lv_obj_t
*
title
=
lv_label_create
(
scr
,
NULL
);
lv_label_set_text
(
title
,
"Channel 1"
);
lv_obj_set_protect
(
title
,
LV_PROTECT_FOLLOW
);
/*Make a line break in the layout*/
/*Create a holder, a subtitle and a drop down list*/
lv_obj_t
*
holder
=
lv_cont_create
(
scr
,
NULL
);
/*Create a transparent holder to group some objects*/
lv_cont_set_fit
(
holder
,
true
,
true
);
lv_cont_set_layout
(
holder
,
LV_CONT_LAYOUT_COL_L
);
lv_obj_set_style
(
holder
,
lv_style_get
(
LV_STYLE_TRANSP_TIGHT
,
NULL
));
lv_obj_t
*
subtitle
=
lv_label_create
(
holder
,
NULL
);
lv_label_set_text
(
subtitle
,
"Temperature"
);
lv_obj_t
*
ddlist
=
lv_ddlist_create
(
holder
,
NULL
);
lv_ddlist_set_options_str
(
ddlist
,
"Low
\n
Medium
\n
High"
);
lv_group_add_obj
(
g1
,
ddlist
);
/*Add the object to the first group*/
lv_ddlist_create
(
holder
,
ddlist
);
/*Copy the previous holder and subtitle and add check boxes*/
holder
=
lv_cont_create
(
scr
,
holder
);
subtitle
=
lv_label_create
(
holder
,
subtitle
);
lv_label_set_text
(
subtitle
,
"Colors"
);
lv_obj_t
*
cb
=
lv_cb_create
(
holder
,
NULL
);
lv_cb_set_text
(
cb
,
"Red"
);
lv_group_add_obj
(
g1
,
cb
);
cb
=
lv_cb_create
(
holder
,
cb
);
lv_cb_set_text
(
cb
,
"Green"
);
cb
=
lv_cb_create
(
holder
,
cb
);
lv_cb_set_text
(
cb
,
"Blue"
);
/*Copy the previous holder and subtitle and add sliders*/
holder
=
lv_cont_create
(
scr
,
holder
);
subtitle
=
lv_label_create
(
holder
,
subtitle
);
lv_label_set_text
(
subtitle
,
"Voltage"
);
lv_obj_t
*
slider
=
lv_slider_create
(
holder
,
NULL
);
lv_obj_set_size_us
(
slider
,
180
,
30
);
subtitle
=
lv_label_create
(
holder
,
subtitle
);
lv_label_set_text
(
subtitle
,
"Current"
);
slider
=
lv_slider_create
(
holder
,
slider
);
lv_obj_t
*
list
=
lv_list_create
(
lv_scr_act
(),
NULL
);
lv_list_add
(
list
,
""
,
"List1"
,
NULL
);
lv_list_add
(
list
,
""
,
"List2"
,
NULL
);
lv_list_add
(
list
,
""
,
"List3"
,
NULL
);
lv_list_add
(
list
,
""
,
"List4"
,
NULL
);
lv_list_add
(
list
,
""
,
"List5"
,
NULL
);
lv_list_add
(
list
,
""
,
"List6"
,
NULL
);
lv_list_add
(
list
,
""
,
"List7"
,
NULL
);
lv_list_add
(
list
,
""
,
"List8"
,
NULL
);
lv_group_add_obj
(
g1
,
list
);
lv_obj_t
*
btn
=
lv_btn_create
(
lv_scr_act
(),
NULL
);
lv_obj_t
*
l
=
lv_label_create
(
btn
,
NULL
);
lv_label_set_text
(
l
,
"Button1"
);
lv_group_add_obj
(
g1
,
btn
);
btn
=
lv_btn_create
(
lv_scr_act
(),
NULL
);
lv_btn_set_tgl
(
btn
,
true
);
l
=
lv_label_create
(
btn
,
NULL
);
lv_label_set_text
(
l
,
"Button
\n
Toggle"
);
lv_group_add_obj
(
g1
,
btn
);
btn
=
lv_btn_create
(
lv_scr_act
(),
btn
);
lv_btn_set_tgl
(
btn
,
true
);
l
=
lv_label_create
(
btn
,
NULL
);
lv_label_set_text
(
l
,
"Button
\n
Toggle
\n
Copy"
);
l
=
lv_label_create
(
lv_scr_act
(),
NULL
);
lv_label_set_text
(
l
,
"Single
\n
label"
);
lv_obj_set_protect
(
l
,
LV_PROTECT_FOLLOW
);
lv_group_add_obj
(
g1
,
l
);
btn
=
lv_btn_create
(
lv_scr_act
(),
NULL
);
lv_btn_set_rel_action
(
btn
,
btn_next
);
l
=
lv_label_create
(
btn
,
NULL
);
lv_label_set_text
(
l
,
"Next"
);
btn
=
lv_btn_create
(
lv_scr_act
(),
NULL
);
lv_btn_set_rel_action
(
btn
,
btn_dec
);
l
=
lv_label_create
(
btn
,
NULL
);
lv_label_set_text
(
l
,
"Dec"
);
btn
=
lv_btn_create
(
lv_scr_act
(),
NULL
);
lv_btn_set_rel_action
(
btn
,
btn_inc
);
l
=
lv_label_create
(
btn
,
NULL
);
lv_label_set_text
(
l
,
"Inc"
);
btn
=
lv_btn_create
(
lv_scr_act
(),
NULL
);
lv_btn_set_rel_action
(
btn
,
btn_sel
);
l
=
lv_label_create
(
btn
,
NULL
);
lv_label_set_text
(
l
,
"Sel"
);
}
/**********************
* STATIC FUNCTIONS
**********************/
static
lv_action_res_t
btn_next
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
)
{
lv_group_focus_next
(
g1
);
return
LV_ACTION_RES_OK
;
}
static
lv_action_res_t
btn_prev
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
)
{
lv_group_focus_prev
(
g1
);
return
LV_ACTION_RES_OK
;
}
static
lv_action_res_t
btn_inc
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
)
{
lv_group_send
(
g1
,
LV_GROUP_KEY_RIGHT
);
return
LV_ACTION_RES_OK
;
}
static
lv_action_res_t
btn_dec
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
)
{
lv_group_send
(
g1
,
LV_GROUP_KEY_LEFT
);
return
LV_ACTION_RES_OK
;
}
static
lv_action_res_t
btn_sel
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
)
{
lv_group_send
(
g1
,
LV_GROUP_KEY_ENTER
);
return
LV_ACTION_RES_OK
;
}
#endif
/*USE_LV_EXAMPLE != 0*/
lv_examples/2_2_encoder_ctrl/encoder_ctrl.h
View file @
2bdfdc0e
/**
* @file encoder_ctrl.h
*
*/
#ifndef ENCODER_CTRL_H
#define ENCODER_CTRL_H
#ifdef __cplusplus
extern
"C"
{
#endif
/*********************
* INCLUDES
*********************/
#include "lv_conf.h"
#if USE_LV_EXAMPLE != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void
encoder_ctrl_init
(
void
);
/**********************
* MACROS
**********************/
#endif
/*USE_LV_EXAMPLE != 0*/
#ifdef __cplusplus
}
/* extern "C" */
#endif
#endif
/*ENCODER_CTRL_H*/
lv_obj/lv_group.h
View file @
2bdfdc0e
...
...
@@ -14,7 +14,6 @@ extern "C" {
* INCLUDES
*********************/
#include "lv_conf.h"
#include "lv_obj.h"
/*********************
...
...
lv_objx/lv_cb.c
View file @
2bdfdc0e
...
...
@@ -77,7 +77,6 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
lv_cont_set_fit
(
new_cb
,
true
,
true
);
lv_btn_set_tgl
(
new_cb
,
true
);
lv_obj_set_design_f
(
ext
->
bullet
,
lv_bullet_design
);
lv_obj_set_click
(
ext
->
bullet
,
false
);
lv_btn_set_styles
(
ext
->
bullet
,
lv_style_get
(
LV_STYLE_PRETTY
,
NULL
),
lv_style_get
(
LV_STYLE_PRETTY_COLOR
,
NULL
),
lv_style_get
(
LV_STYLE_BTN_TREL
,
NULL
),
lv_style_get
(
LV_STYLE_BTN_TPR
,
NULL
),
...
...
@@ -94,6 +93,8 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
/*Refresh the style with new signal function*/
lv_obj_refr_style
(
new_cb
);
}
lv_obj_set_design_f
(
ext
->
bullet
,
lv_bullet_design
);
return
new_cb
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment