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
1254020b
Commit
1254020b
authored
May 20, 2018
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'beta'
parents
fe30f973
7f03c17a
Show whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
380 additions
and
110 deletions
+380
-110
lv_conf_templ.h
lv_conf_templ.h
+11
-3
lv_group.c
lv_core/lv_group.c
+17
-6
lv_group.h
lv_core/lv_group.h
+6
-0
lv_indev.c
lv_core/lv_indev.c
+5
-1
lv_obj.c
lv_core/lv_obj.c
+25
-11
lv_obj.h
lv_core/lv_obj.h
+1
-1
lv_refr.c
lv_core/lv_refr.c
+1
-1
lv_style.c
lv_core/lv_style.c
+3
-0
lv_draw.c
lv_draw/lv_draw.c
+56
-8
lv_draw_rbasic.c
lv_draw/lv_draw_rbasic.c
+1
-1
lv_draw_vbasic.c
lv_draw/lv_draw_vbasic.c
+21
-9
lv_anim.c
lv_misc/lv_anim.c
+3
-1
lv_anim.h
lv_misc/lv_anim.h
+1
-1
lv_font.c
lv_misc/lv_font.c
+2
-2
lv_font.h
lv_misc/lv_font.h
+3
-3
lv_fs.c
lv_misc/lv_fs.c
+5
-5
lv_ll.c
lv_misc/lv_ll.c
+26
-0
lv_ll.h
lv_misc/lv_ll.h
+8
-0
lv_task.c
lv_misc/lv_task.c
+32
-19
lv_bar.c
lv_objx/lv_bar.c
+8
-2
lv_btnm.c
lv_objx/lv_btnm.c
+5
-4
lv_chart.c
lv_objx/lv_chart.c
+13
-0
lv_cont.c
lv_objx/lv_cont.c
+7
-1
lv_ddlist.c
lv_objx/lv_ddlist.c
+3
-1
lv_gauge.c
lv_objx/lv_gauge.c
+7
-0
lv_img.h
lv_objx/lv_img.h
+7
-7
lv_kb.c
lv_objx/lv_kb.c
+14
-4
lv_label.c
lv_objx/lv_label.c
+8
-0
lv_led.c
lv_objx/lv_led.c
+2
-0
lv_line.c
lv_objx/lv_line.c
+7
-0
lv_line.h
lv_objx/lv_line.h
+3
-3
lv_list.c
lv_objx/lv_list.c
+2
-0
lv_lmeter.c
lv_objx/lv_lmeter.c
+6
-0
lv_lmeter.h
lv_objx/lv_lmeter.h
+1
-1
lv_mbox.c
lv_objx/lv_mbox.c
+11
-1
lv_page.c
lv_objx/lv_page.c
+2
-0
lv_page.h
lv_objx/lv_page.h
+2
-2
lv_roller.c
lv_objx/lv_roller.c
+3
-0
lv_slider.c
lv_objx/lv_slider.c
+15
-3
lv_sw.c
lv_objx/lv_sw.c
+4
-0
lv_ta.c
lv_objx/lv_ta.c
+12
-3
lv_tabview.c
lv_objx/lv_tabview.c
+2
-0
lv_win.c
lv_objx/lv_win.c
+2
-0
lv_theme.h
lv_themes/lv_theme.h
+1
-0
lv_theme_alien.c
lv_themes/lv_theme_alien.c
+2
-2
lv_theme_mono.c
lv_themes/lv_theme_mono.c
+1
-1
lv_theme_zen.c
lv_themes/lv_theme_zen.c
+2
-2
lvgl.h
lvgl.h
+1
-1
No files found.
lv_conf_templ.h
View file @
1254020b
...
...
@@ -81,9 +81,10 @@
#define USE_LV_REAL_DRAW 1 /*1: Enable function which draw directly to the frame buffer instead of VDB (required if LV_VDB_SIZE = 0)*/
#define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images*/
/*Compiler attributes*/
#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to tick increment function */
#define LV_ATTRIBUTE_TASK_HANDLER
/*Compiler settings*/
#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */
#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */
#define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/
/*================
* THEME USAGE
...
...
@@ -242,6 +243,13 @@
/*Switch (dependencies: lv_slider)*/
#define USE_LV_SW 1
/*************************
* Non-user section
*************************/
#ifdef _MSC_VER /* Disable warnings for Visual Studio*/
# define _CRT_SECURE_NO_WARNINGS
#endif
#endif /*LV_CONF_H*/
...
...
lv_core/lv_group.c
View file @
1254020b
...
...
@@ -47,6 +47,7 @@ lv_group_t * lv_group_create(void)
group
->
style_mod
=
style_mod_def
;
group
->
obj_focus
=
NULL
;
group
->
frozen
=
0
;
group
->
focus_cb
=
NULL
;
return
group
;
}
...
...
@@ -57,6 +58,18 @@ lv_group_t * lv_group_create(void)
*/
void
lv_group_del
(
lv_group_t
*
group
)
{
/*Defocus the the currently focussed object*/
if
(
group
->
obj_focus
!=
NULL
)
{
(
*
group
->
obj_focus
)
->
signal_func
(
*
group
->
obj_focus
,
LV_SIGNAL_DEFOCUS
,
NULL
);
lv_obj_invalidate
(
*
group
->
obj_focus
);
}
/*Remove the objects from the group*/
lv_obj_t
**
obj
;
LL_READ
(
group
->
obj_ll
,
obj
)
{
(
*
obj
)
->
group_p
=
NULL
;
}
lv_ll_clear
(
&
(
group
->
obj_ll
));
lv_mem_free
(
group
);
}
...
...
@@ -88,6 +101,10 @@ void lv_group_remove_obj(lv_obj_t * obj)
lv_group_t
*
g
=
obj
->
group_p
;
if
(
g
==
NULL
)
return
;
if
(
*
g
->
obj_focus
==
obj
)
{
lv_group_focus_next
(
g
);
}
/*Search the object and remove it from its group */
lv_obj_t
**
i
;
LL_READ
(
g
->
obj_ll
,
i
)
{
...
...
@@ -97,11 +114,6 @@ void lv_group_remove_obj(lv_obj_t * obj)
obj
->
group_p
=
NULL
;
}
}
if
(
*
g
->
obj_focus
==
obj
)
{
g
->
obj_focus
=
NULL
;
lv_group_focus_next
(
g
);
}
}
/**
...
...
@@ -116,7 +128,6 @@ void lv_group_focus_obj(lv_obj_t * obj)
if
(
g
->
frozen
!=
0
)
return
;
lv_obj_t
**
i
;
LL_READ
(
g
->
obj_ll
,
i
)
{
if
(
*
i
==
obj
)
{
if
(
g
->
obj_focus
!=
NULL
)
{
...
...
lv_core/lv_group.h
View file @
1254020b
...
...
@@ -62,6 +62,12 @@ typedef struct _lv_group_t
lv_group_t
*
lv_group_create
(
void
);
/**
* Delete a group object
* @param group pointer to a group
*/
void
lv_group_del
(
lv_group_t
*
group
);
/**
* Add an object to a group
* @param group pointer to a group
* @param obj pointer to an object to add
...
...
lv_core/lv_indev.c
View file @
1254020b
...
...
@@ -655,10 +655,14 @@ static void indev_drag(lv_indev_proc_t * state)
lv_coord_t
act_y
=
lv_obj_get_y
(
drag_obj
);
uint16_t
inv_buf_size
=
lv_refr_get_buf_size
();
/*Get the number of currently invalidated areas*/
lv_coord_t
prev_x
=
drag_obj
->
coords
.
x1
;
lv_coord_t
prev_y
=
drag_obj
->
coords
.
y1
;
lv_obj_set_pos
(
drag_obj
,
act_x
+
state
->
vect
.
x
,
act_y
+
state
->
vect
.
y
);
/*Set the drag in progress flag if the object is really moved*/
if
(
lv_obj_get_x
(
drag_obj
)
!=
act_x
||
lv_obj_get_y
(
drag_obj
)
!=
act_y
)
{
if
(
drag_obj
->
coords
.
x1
!=
prev_x
||
drag_obj
->
coords
.
y1
!=
prev_y
)
{
if
(
state
->
drag_range_out
!=
0
)
{
/*Send the drag begin signal on first move*/
drag_obj
->
signal_func
(
drag_obj
,
LV_SIGNAL_DRAG_BEGIN
,
indev_act
);
if
(
state
->
reset_query
!=
0
)
return
;
...
...
lv_core/lv_obj.c
View file @
1254020b
...
...
@@ -284,20 +284,17 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
lv_anim_del
(
obj
,
NULL
);
#endif
/*Delete from the group*/
#if USE_LV_GROUP
if
(
obj
->
group_p
!=
NULL
)
lv_group_remove_obj
(
obj
);
#endif
/* Reset all input devices if
* the currently pressed object is deleted*/
lv_indev_t
*
indev
=
lv_indev_next
(
NULL
);
lv_obj_t
*
dpar
;
while
(
indev
)
{
dpar
=
obj
;
while
(
dpar
!=
NULL
)
{
if
(
indev
->
proc
.
act_obj
==
dpar
||
indev
->
proc
.
last_obj
==
dpar
)
{
if
(
indev
->
proc
.
act_obj
==
obj
||
indev
->
proc
.
last_obj
==
obj
)
{
lv_indev_reset
(
indev
);
break
;
}
else
{
dpar
=
lv_obj_get_parent
(
dpar
);
}
}
indev
=
lv_indev_next
(
indev
);
}
...
...
@@ -346,11 +343,14 @@ void lv_obj_clean(lv_obj_t *obj)
*/
void
lv_obj_invalidate
(
lv_obj_t
*
obj
)
{
if
(
lv_obj_get_hidden
(
obj
))
return
;
/*Invalidate the object only if it belongs to the 'act_scr'*/
lv_obj_t
*
obj_scr
=
lv_obj_get_screen
(
obj
);
if
(
obj_scr
==
lv_scr_act
()
||
obj_scr
==
lv_layer_top
()
||
obj_scr
==
lv_layer_sys
())
{
obj_scr
==
lv_layer_sys
())
{
/*Truncate recursively to the parents*/
lv_area_t
area_trunc
;
lv_obj_t
*
par
=
lv_obj_get_parent
(
obj
);
...
...
@@ -367,6 +367,7 @@ void lv_obj_invalidate(lv_obj_t * obj)
while
(
par
!=
NULL
)
{
union_ok
=
lv_area_union
(
&
area_trunc
,
&
area_trunc
,
&
par
->
coords
);
if
(
union_ok
==
false
)
break
;
/*If no common parts with parent break;*/
if
(
lv_obj_get_hidden
(
par
))
return
;
/*If the parent is hidden then the child is hidden and won't be drawn*/
par
=
lv_obj_get_parent
(
par
);
}
...
...
@@ -753,12 +754,15 @@ void lv_obj_report_style_mod(lv_style_t * style)
*/
void
lv_obj_set_hidden
(
lv_obj_t
*
obj
,
bool
en
)
{
if
(
!
obj
->
hidden
)
lv_obj_invalidate
(
obj
);
/*Invalidate when not hidden (hidden objects are ignored) */
obj
->
hidden
=
en
==
false
?
0
:
1
;
if
(
!
obj
->
hidden
)
lv_obj_invalidate
(
obj
);
/*Invalidate when not hidden (hidden objects are ignored) */
lv_obj_t
*
par
=
lv_obj_get_parent
(
obj
);
par
->
signal_func
(
par
,
LV_SIGNAL_CHILD_CHG
,
obj
);
lv_obj_invalidate
(
obj
);
}
/**
...
...
@@ -1586,6 +1590,16 @@ static void delete_children(lv_obj_t * obj)
if
(
obj
->
group_p
!=
NULL
)
lv_group_remove_obj
(
obj
);
#endif
/* Reset the input devices if
* the currently pressed object is deleted*/
lv_indev_t
*
indev
=
lv_indev_next
(
NULL
);
while
(
indev
)
{
if
(
indev
->
proc
.
act_obj
==
obj
||
indev
->
proc
.
last_obj
==
obj
)
{
lv_indev_reset
(
indev
);
}
indev
=
lv_indev_next
(
indev
);
}
/*Remove the object from parent's children list*/
lv_obj_t
*
par
=
lv_obj_get_parent
(
obj
);
lv_ll_rem
(
&
(
par
->
child_ll
),
obj
);
...
...
lv_core/lv_obj.h
View file @
1254020b
...
...
@@ -429,7 +429,7 @@ void lv_obj_set_design_func(lv_obj_t * obj, lv_design_func_t fp);
* Allocate a new ext. data for an object
* @param obj pointer to an object
* @param ext_size the size of the new ext. data
* @return
Normal
pointer to the allocated ext
* @return pointer to the allocated ext
*/
void
*
lv_obj_allocate_ext_attr
(
lv_obj_t
*
obj
,
uint16_t
ext_size
);
...
...
lv_core/lv_refr.c
View file @
1254020b
...
...
@@ -70,7 +70,7 @@ void lv_refr_init(void)
lv_task_t
*
task
;
task
=
lv_task_create
(
lv_refr_task
,
LV_REFR_PERIOD
,
LV_TASK_PRIO_MID
,
NULL
);
lv_
mem_assert
(
task
);
lv_
task_ready
(
task
);
/*Be sure the screen will be refreshed immediately on start up*/
}
/**
...
...
lv_core/lv_style.c
View file @
1254020b
...
...
@@ -272,8 +272,11 @@ static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val)
STYLE_ATTR_ANIM
(
body
.
padding
.
inner
,
val
);
STYLE_ATTR_ANIM
(
text
.
line_space
,
val
);
STYLE_ATTR_ANIM
(
text
.
letter_space
,
val
);
STYLE_ATTR_ANIM
(
text
.
opa
,
val
);
STYLE_ATTR_ANIM
(
line
.
width
,
val
);
STYLE_ATTR_ANIM
(
line
.
opa
,
val
);
STYLE_ATTR_ANIM
(
image
.
intense
,
val
);
STYLE_ATTR_ANIM
(
image
.
opa
,
val
);
lv_opa_t
opa
=
val
==
LV_STYLE_ANIM_RES
?
LV_OPA_COVER
:
val
;
...
...
lv_draw/lv_draw.c
View file @
1254020b
...
...
@@ -29,7 +29,7 @@
#define LABEL_RECOLOR_PAR_LENGTH 6
#define SHADOW_OPA_EXTRA_PRECISION
8
/*Calculate with 2^x bigger shadow opacity values to avoid rounding errors*/
#define SHADOW_OPA_EXTRA_PRECISION
0
/*Calculate with 2^x bigger shadow opacity values to avoid rounding errors*/
#define SHADOW_BOTTOM_AA_EXTRA_RADIUS 3
/*Add extra radius with LV_SHADOW_BOTTOM to cover anti-aliased corners*/
/**********************
* TYPEDEFS
...
...
@@ -448,7 +448,15 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
lv_coord_t
row
;
uint32_t
act_pos
;
#if LV_COMPILER_VLA_SUPPORTED
lv_color_t
buf
[
lv_area_get_width
(
&
mask_com
)];
#else
# if LV_HOR_RES > LV_VER_RES
lv_color_t
buf
[
LV_HOR_RES
];
# else
lv_color_t
buf
[
LV_VER_RES
];
# endif
#endif
for
(
row
=
mask_com
.
y1
;
row
<=
mask_com
.
y2
;
row
++
)
{
res
=
lv_fs_read
(
&
file
,
buf
,
useful_data
,
&
br
);
...
...
@@ -1713,8 +1721,15 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
if
(
radius
!=
0
)
radius
-=
LV_ANTIALIAS
;
swidth
+=
LV_ANTIALIAS
;
#if LV_COMPILER_VLA_SUPPORTED
lv_coord_t
curve_x
[
radius
+
swidth
+
1
];
/*Stores the 'x' coordinates of a quarter circle.*/
#else
# if LV_HOR_RES > LV_VER_RES
lv_coord_t
curve_x
[
LV_HOR_RES
];
# else
lv_coord_t
curve_x
[
LV_VER_RES
];
# endif
#endif
memset
(
curve_x
,
0
,
sizeof
(
curve_x
));
lv_point_t
circ
;
lv_coord_t
circ_tmp
;
...
...
@@ -1727,15 +1742,30 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
int16_t
line
;
int16_t
filter_width
=
2
*
swidth
+
1
;
#if LV_COMPILER_VLA_SUPPORTED
uint32_t
line_1d_blur
[
filter_width
];
#else
# if LV_HOR_RES > LV_VER_RES
uint32_t
line_1d_blur
[
LV_HOR_RES
];
# else
uint32_t
line_1d_blur
[
LV_VER_RES
];
# endif
#endif
/*1D Blur horizontally*/
for
(
line
=
0
;
line
<
filter_width
;
line
++
)
{
line_1d_blur
[
line
]
=
(
uint32_t
)((
uint32_t
)(
filter_width
-
line
)
*
(
style
->
body
.
opa
*
2
)
<<
SHADOW_OPA_EXTRA_PRECISION
)
/
(
filter_width
*
filter_width
);
}
uint16_t
col
;
#if LV_COMPILER_VLA_SUPPORTED
lv_opa_t
line_2d_blur
[
radius
+
swidth
];
#else
# if LV_HOR_RES > LV_VER_RES
lv_opa_t
line_2d_blur
[
LV_HOR_RES
];
# else
lv_opa_t
line_2d_blur
[
LV_VER_RES
];
# endif
#endif
lv_point_t
point_rt
;
lv_point_t
point_rb
;
...
...
@@ -1759,7 +1789,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
bool
line_ready
;
for
(
line
=
1
;
line
<=
radius
+
swidth
;
line
++
)
{
/*Check all rows and make the 1D blur to 2D*/
line_ready
=
false
;
for
(
col
=
1
;
col
<
radius
+
swidth
+
10
;
col
++
)
{
/*Check all pixels in a 1D blur line (from the origo to last shadow pixel (radius + swidth))*/
for
(
col
=
1
;
col
<
radius
+
swidth
;
col
++
)
{
/*Check all pixels in a 1D blur line (from the origo to last shadow pixel (radius + swidth))*/
/*Sum the opacities from the lines above and below this 'row'*/
int16_t
line_rel
;
...
...
@@ -1776,7 +1806,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
}
/*Add the value of the 1D blur on 'col_rel' position*/
if
(
col_rel
<
-
swidth
)
{
/*Outside of the burred area. */
if
(
col_rel
<
-
swidth
)
{
/*Outside of the b
l
urred area. */
if
(
line_rel
==
-
swidth
)
line_ready
=
true
;
/*If no data even on the very first line then it wont't be anything else in this line*/
break
;
/*Break anyway because only smaller 'col_rel' values will come */
}
...
...
@@ -1785,7 +1815,10 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
}
line_2d_blur
[
col
]
=
px_opa_sum
>>
SHADOW_OPA_EXTRA_PRECISION
;
if
(
line_ready
)
break
;
if
(
line_ready
)
{
col
++
;
/*To make this line to the last one ( drawing will go to '< col')*/
break
;
}
}
...
...
@@ -1803,7 +1836,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
point_lb
.
y
=
ofs_lb
.
y
+
line
;
uint16_t
d
;
for
(
d
=
1
;
d
<
=
col
;
d
++
)
{
for
(
d
=
1
;
d
<
col
;
d
++
)
{
if
(
point_rt
.
x
!=
point_lt
.
x
)
{
px_fp
(
point_lt
.
x
,
point_lt
.
y
,
mask
,
style
->
body
.
shadow
.
color
,
line_2d_blur
[
d
]);
...
...
@@ -1845,8 +1878,15 @@ static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * ma
radius
=
lv_draw_cont_radius_corr
(
radius
,
width
,
height
);
radius
+=
LV_ANTIALIAS
*
SHADOW_BOTTOM_AA_EXTRA_RADIUS
;
swidth
+=
LV_ANTIALIAS
;
#if LV_COMPILER_VLA_SUPPORTED
lv_coord_t
curve_x
[
radius
+
1
];
/*Stores the 'x' coordinates of a quarter circle.*/
#else
# if LV_HOR_RES > LV_VER_RES
lv_coord_t
curve_x
[
LV_HOR_RES
];
# else
lv_coord_t
curve_x
[
LV_VER_RES
];
# endif
#endif
lv_point_t
circ
;
lv_coord_t
circ_tmp
;
lv_circ_init
(
&
circ
,
&
circ_tmp
,
radius
);
...
...
@@ -1857,7 +1897,15 @@ static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * ma
}
int16_t
col
;
#if LV_COMPILER_VLA_SUPPORTED
lv_opa_t
line_1d_blur
[
swidth
];
#else
# if LV_HOR_RES > LV_VER_RES
lv_opa_t
line_1d_blur
[
LV_HOR_RES
];
# else
lv_opa_t
line_1d_blur
[
LV_VER_RES
];
# endif
#endif
for
(
col
=
0
;
col
<
swidth
;
col
++
)
{
line_1d_blur
[
col
]
=
(
uint32_t
)((
uint32_t
)(
swidth
-
col
)
*
style
->
body
.
opa
/
2
)
/
(
swidth
);
...
...
lv_draw/lv_draw_rbasic.c
View file @
1254020b
...
...
@@ -28,7 +28,7 @@
/**********************
* STATIC VARIABLES
**********************/
static
lv_color_t
letter_bg_color
=
LV_COLOR_WHITE
;
static
lv_color_t
letter_bg_color
;
/**********************
* MACROS
...
...
lv_draw/lv_draw_vbasic.c
View file @
1254020b
...
...
@@ -384,31 +384,43 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
for
(
row
=
masked_a
.
y1
;
row
<=
masked_a
.
y2
;
row
++
)
{
for
(
col
=
0
;
col
<
map_useful_w
;
col
++
)
{
lv_opa_t
opa_result
=
opa
;
lv_color_t
*
px_color
=
(
lv_color_t
*
)
&
map_p
[(
uint32_t
)
col
*
px_size_byte
];
/*Handle chroma key*/
if
(
chroma_key
&&
px_color
->
full
==
chroma_key_color
.
full
)
continue
;
uint8_t
*
px_color_p
=
(
uint8_t
*
)
&
map_p
[(
uint32_t
)
col
*
px_size_byte
];
lv_color_t
px_color
;
/*Calculate with the pixel level alpha*/
if
(
alpha_byte
)
{
lv_opa_t
px_opa
=
(
*
(((
uint8_t
*
)
px_color
)
+
LV_IMG_PX_SIZE_ALPHA_BYTE
-
1
));
#if LV_COLOR_DEPTH == 8
px_color
.
full
=
px_color_p
[
0
];
#elif LV_COLOR_DEPTH == 16
/*Because of Alpha byte 16 bit color can start on odd address which can cause crash*/
px_color
.
full
=
px_color_p
[
0
]
+
(
px_color_p
[
1
]
<<
8
);
#elif LV_COLOR_DEPTH == 24
px_color
=
*
((
lv_color_t
*
)
px_color_p
);
#endif
lv_opa_t
px_opa
=
*
(
px_color_p
+
LV_IMG_PX_SIZE_ALPHA_BYTE
-
1
);
if
(
px_opa
==
LV_OPA_TRANSP
)
continue
;
else
if
(
px_opa
!=
LV_OPA_COVER
)
opa_result
=
(
uint32_t
)((
uint32_t
)
px_opa
*
opa_result
)
>>
8
;
}
else
{
px_color
=
*
((
lv_color_t
*
)
px_color_p
);
}
/*Handle chroma key*/
if
(
chroma_key
&&
px_color
.
full
==
chroma_key_color
.
full
)
continue
;
/*Re-color the pixel if required*/
if
(
recolor_opa
!=
LV_OPA_TRANSP
)
{
if
(
last_img_px
.
full
!=
px_color
->
full
)
{
/*Minor acceleration: calculate only for new colors (save the last)*/
last_img_px
=
*
px_color
;
if
(
last_img_px
.
full
!=
px_color
.
full
)
{
/*Minor acceleration: calculate only for new colors (save the last)*/
last_img_px
=
px_color
;
recolored_px
=
lv_color_mix
(
recolor
,
last_img_px
,
recolor_opa
);
}
if
(
opa_result
==
LV_OPA_COVER
)
vdb_buf_tmp
[
col
].
full
=
recolored_px
.
full
;
else
vdb_buf_tmp
[
col
]
=
lv_color_mix
(
recolored_px
,
vdb_buf_tmp
[
col
],
opa_result
);
}
else
{
if
(
opa_result
==
LV_OPA_COVER
)
vdb_buf_tmp
[
col
]
.
full
=
px_color
->
full
;
else
vdb_buf_tmp
[
col
]
=
lv_color_mix
(
*
px_color
,
vdb_buf_tmp
[
col
],
opa_result
);
if
(
opa_result
==
LV_OPA_COVER
)
vdb_buf_tmp
[
col
]
=
px_color
;
else
vdb_buf_tmp
[
col
]
=
lv_color_mix
(
px_color
,
vdb_buf_tmp
[
col
],
opa_result
);
}
...
...
lv_misc/lv_anim.c
View file @
1254020b
...
...
@@ -115,7 +115,9 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp)
uint16_t
lv_anim_speed_to_time
(
uint16_t
speed
,
int32_t
start
,
int32_t
end
)
{
int32_t
d
=
LV_MATH_ABS
((
int32_t
)
start
-
end
);
uint16_t
time
=
(
int32_t
)((
int32_t
)(
d
*
1000
)
/
speed
);
uint32_t
time
=
(
int32_t
)((
int32_t
)(
d
*
1000
)
/
speed
);
if
(
time
>
UINT16_MAX
)
time
=
UINT16_MAX
;
if
(
time
==
0
)
{
time
++
;
...
...
lv_misc/lv_anim.h
View file @
1254020b
...
...
@@ -43,7 +43,7 @@ typedef struct _lv_anim_t
lv_anim_path_t
path
;
/*An array with the steps of animations*/
int32_t
start
;
/*Start value*/
int32_t
end
;
/*End value*/
int16_t
time
;
/*Animation time in ms*/
u
int16_t
time
;
/*Animation time in ms*/
int16_t
act_time
;
/*Current time in animation. Set to negative to make delay.*/
uint16_t
playback_pause
;
/*Wait before play back*/
uint16_t
repeat_pause
;
/*Wait before repeat*/
...
...
lv_misc/lv_font.c
View file @
1254020b
...
...
@@ -292,7 +292,7 @@ const uint8_t * lv_font_get_bitmap_sparse(const lv_font_t * font, uint32_t unico
* @param unicode_letter an unicode letter which width should be get
* @return width of the gylph or -1 if not found
*/
const
int16_t
lv_font_get_width_continuous
(
const
lv_font_t
*
font
,
uint32_t
unicode_letter
)
int16_t
lv_font_get_width_continuous
(
const
lv_font_t
*
font
,
uint32_t
unicode_letter
)
{
/*Check the range*/
if
(
unicode_letter
<
font
->
unicode_first
||
unicode_letter
>
font
->
unicode_last
)
{
...
...
@@ -309,7 +309,7 @@ const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unic
* @param unicode_letter an unicode letter which width should be get
* @return width of the glyph or -1 if not found
*/
const
int16_t
lv_font_get_width_sparse
(
const
lv_font_t
*
font
,
uint32_t
unicode_letter
)
int16_t
lv_font_get_width_sparse
(
const
lv_font_t
*
font
,
uint32_t
unicode_letter
)
{
/*Check the range*/
if
(
unicode_letter
<
font
->
unicode_first
||
unicode_letter
>
font
->
unicode_last
)
return
-
1
;
...
...
lv_misc/lv_font.h
View file @
1254020b
...
...
@@ -50,7 +50,7 @@ typedef struct _lv_font_struct
const
lv_font_glyph_dsc_t
*
glyph_dsc
;
const
uint32_t
*
unicode_list
;
const
uint8_t
*
(
*
get_bitmap
)(
const
struct
_lv_font_struct
*
,
uint32_t
);
/*Get a glyph's bitmap from a font*/
const
int16_t
(
*
get_width
)(
const
struct
_lv_font_struct
*
,
uint32_t
);
/*Get a glyph's with with a given font*/
int16_t
(
*
get_width
)(
const
struct
_lv_font_struct
*
,
uint32_t
);
/*Get a glyph's with with a given font*/
struct
_lv_font_struct
*
next_page
;
/*Pointer to a font extension*/
uint32_t
bpp
:
4
;
/*Bit per pixel: 1, 2 or 4*/
}
lv_font_t
;
...
...
@@ -126,7 +126,7 @@ const uint8_t * lv_font_get_bitmap_sparse(const lv_font_t * font, uint32_t unico
* @param unicode_letter an unicode letter which width should be get
* @return width of the gylph or -1 if not found
*/
const
int16_t
lv_font_get_width_continuous
(
const
lv_font_t
*
font
,
uint32_t
unicode_letter
);
int16_t
lv_font_get_width_continuous
(
const
lv_font_t
*
font
,
uint32_t
unicode_letter
);
/**
* Generic glyph width get function used in 'font->get_bitmap' when the font NOT contains all characters in the range (sparse)
...
...
@@ -134,7 +134,7 @@ const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unic
* @param unicode_letter an unicode letter which width should be get
* @return width of the glyph or -1 if not found
*/
const
int16_t
lv_font_get_width_sparse
(
const
lv_font_t
*
font
,
uint32_t
unicode_letter
);
int16_t
lv_font_get_width_sparse
(
const
lv_font_t
*
font
,
uint32_t
unicode_letter
);
/**********************
* MACROS
...
...
lv_misc/lv_fs.c
View file @
1254020b
...
...
@@ -163,7 +163,7 @@ lv_fs_res_t lv_fs_remove (const char * path)
lv_fs_res_t
lv_fs_read
(
lv_fs_file_t
*
file_p
,
void
*
buf
,
uint32_t
btr
,
uint32_t
*
br
)
{
if
(
br
!=
NULL
)
*
br
=
0
;
if
(
file_p
->
drv
==
NULL
||
file_p
->
drv
==
NULL
)
return
LV_FS_RES_INV_PARAM
;
if
(
file_p
->
drv
==
NULL
)
return
LV_FS_RES_INV_PARAM
;
if
(
file_p
->
drv
->
read
==
NULL
)
return
LV_FS_RES_NOT_IMP
;
uint32_t
br_tmp
=
0
;
...
...
@@ -185,7 +185,7 @@ lv_fs_res_t lv_fs_write (lv_fs_file_t * file_p, const void * buf, uint32_t btw,
{
if
(
bw
!=
NULL
)
*
bw
=
0
;
if
(
file_p
->
drv
==
NULL
||
file_p
->
drv
==
NULL
)
{
if
(
file_p
->
drv
==
NULL
)
{
return
LV_FS_RES_INV_PARAM
;
}
...
...
@@ -208,7 +208,7 @@ lv_fs_res_t lv_fs_write (lv_fs_file_t * file_p, const void * buf, uint32_t btw,
*/
lv_fs_res_t
lv_fs_seek
(
lv_fs_file_t
*
file_p
,
uint32_t
pos
)
{
if
(
file_p
->
drv
==
NULL
||
file_p
->
drv
==
NULL
)
{
if
(
file_p
->
drv
==
NULL
)
{
return
LV_FS_RES_INV_PARAM
;
}
...
...
@@ -229,7 +229,7 @@ lv_fs_res_t lv_fs_seek (lv_fs_file_t * file_p, uint32_t pos)
*/
lv_fs_res_t
lv_fs_tell
(
lv_fs_file_t
*
file_p
,
uint32_t
*
pos
)
{
if
(
file_p
->
drv
==
NULL
||
file_p
->
drv
==
NULL
)
{
if
(
file_p
->
drv
==
NULL
)
{
pos
=
0
;
return
LV_FS_RES_INV_PARAM
;
}
...
...
@@ -252,7 +252,7 @@ lv_fs_res_t lv_fs_tell (lv_fs_file_t * file_p, uint32_t * pos)
*/
lv_fs_res_t
lv_fs_size
(
lv_fs_file_t
*
file_p
,
uint32_t
*
size
)
{
if
(
file_p
->
drv
==
NULL
||
file_p
->
drv
==
NULL
)
{
if
(
file_p
->
drv
==
NULL
)
{
return
LV_FS_RES_INV_PARAM
;
}
...
...
lv_misc/lv_ll.c
View file @
1254020b
...
...
@@ -306,6 +306,32 @@ void lv_ll_swap(lv_ll_t * ll_p, void * n1_p, void * n2_p)
/*TODO*/
}
/**
* Move a nodw before an other node in the same linked list
* @param ll_p pointer to a linked list
* @param n_act pointer to node to move
* @param n_after pointer to a node which should be after `n_act`
*/
void
lv_ll_move_before
(
lv_ll_t
*
ll_p
,
void
*
n_act
,
void
*
n_after
)
{
if
(
n_act
==
n_after
)
return
;
/*Can't move before itself*/
if
(
n_after
==
NULL
)
{
void
*
n_before
=
lv_ll_get_tail
(
ll_p
);
node_set_next
(
ll_p
,
n_before
,
n_act
);
node_set_prev
(
ll_p
,
n_act
,
n_before
);
node_set_next
(
ll_p
,
n_act
,
NULL
);
ll_p
->
tail
=
n_act
;
}
else
{
void
*
n_before
=
lv_ll_get_prev
(
ll_p
,
n_after
);
/*Move the node between `n_before` and `n_after`*/
node_set_next
(
ll_p
,
n_before
,
n_act
);
node_set_prev
(
ll_p
,
n_act
,
n_before
);
node_set_prev
(
ll_p
,
n_after
,
n_act
);
node_set_next
(
ll_p
,
n_act
,
n_after
);
}
}
/**********************
* STATIC FUNCTIONS
**********************/
...
...
lv_misc/lv_ll.h
View file @
1254020b
...
...
@@ -122,6 +122,14 @@ void * lv_ll_get_next(lv_ll_t * ll_p, void * n_act);
*/
void
*
lv_ll_get_prev
(
lv_ll_t
*
ll_p
,
void
*
n_act
);
/**
* Move a nodw before an other node in the same linked list
* @param ll_p pointer to a linked list
* @param n_act pointer to node to move
* @param n_after pointer to a node which should be after `n_act`
*/
void
lv_ll_move_before
(
lv_ll_t
*
ll_p
,
void
*
n_act
,
void
*
n_after
);
/**********************
* MACROS
**********************/
...
...
lv_misc/lv_task.c
View file @
1254020b
...
...
@@ -69,27 +69,32 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
* If a lower priority task is executed check task again from the highest priority
* but on the priority of executed tasks don't run tasks before the executed*/
lv_task_t
*
task_interruper
=
NULL
;
lv_task_t
*
tmp
;
lv_task_t
*
next
;
bool
end_flag
;
do
{
end_flag
=
true
;
LL_READ
(
lv_task_ll
,
tmp
){
lv_task_t
*
act
=
lv_ll_get_head
(
&
lv_task_ll
);
while
(
act
){
/* The task might be deleted if it runs only once ('once = 1')
* So get next element until the current is surely valid*/
next
=
lv_ll_get_next
(
&
lv_task_ll
,
act
);
/*Here is the interrupter task. Don't execute it again.*/
if
(
tmp
==
task_interruper
)
{
if
(
act
==
task_interruper
)
{
task_interruper
=
NULL
;
/*From this point only task after the interrupter comes, so the interrupter is not interesting anymore*/
continue
;
act
=
next
;
continue
;
/*Load the next task*/
}
/*Just try to run the tasks with highest priority.*/
if
(
tmp
->
prio
==
LV_TASK_PRIO_HIGHEST
)
{
lv_task_exec
(
tmp
);
if
(
act
->
prio
==
LV_TASK_PRIO_HIGHEST
)
{
lv_task_exec
(
act
);
}
/*Tasks with higher priority then the interrupted shall be run in every case*/
else
if
(
task_interruper
)
{
if
(
tmp
->
prio
>
task_interruper
->
prio
)
{
if
(
lv_task_exec
(
tmp
))
{
task_interruper
=
tmp
;
/*Check all tasks again from the highest priority */
if
(
act
->
prio
>
task_interruper
->
prio
)
{
if
(
lv_task_exec
(
act
))
{
task_interruper
=
act
;
/*Check all tasks again from the highest priority */
end_flag
=
false
;
break
;
}
...
...
@@ -98,12 +103,13 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
/* It is no interrupter task or we already reached it earlier.
* Just run the remaining tasks*/
else
{
if
(
lv_task_exec
(
tmp
))
{
task_interruper
=
tmp
;
/*Check all tasks again from the highest priority */
if
(
lv_task_exec
(
act
))
{
task_interruper
=
act
;
/*Check all tasks again from the highest priority */
end_flag
=
false
;
break
;
}
}
act
=
next
;
/*Load the next task*/
}
}
while
(
!
end_flag
);
...
...
@@ -183,15 +189,22 @@ void lv_task_del(lv_task_t* lv_task_p)
*/
void
lv_task_set_prio
(
lv_task_t
*
lv_task_p
,
lv_task_prio_t
prio
)
{
/*It's easier to create a new task with the new priority rather then modify the linked list*/
lv_task_t
*
new_task
=
lv_task_create
(
lv_task_p
->
task
,
lv_task_p
->
period
,
prio
,
lv_task_p
->
param
);
lv_mem_assert
(
new_task
);
new_task
->
once
=
lv_task_p
->
once
;
new_task
->
last_run
=
lv_task_p
->
last_run
;
/*Find the tasks with new priority*/
lv_task_t
*
i
;
LL_READ
(
lv_task_ll
,
i
)
{
if
(
i
->
prio
<=
prio
)
{
if
(
i
!=
lv_task_p
)
lv_ll_move_before
(
&
lv_task_ll
,
lv_task_p
,
i
);
break
;
}
}
/*Delete the old task*/
lv_ll_rem
(
&
lv_task_ll
,
lv_task_p
);
lv_mem_free
(
lv_task_p
);
/*There was no such a low priority so far then add the node to the tail*/
if
(
i
==
NULL
)
{
lv_ll_move_before
(
&
lv_task_ll
,
lv_task_p
,
NULL
);
}
lv_task_p
->
prio
=
prio
;
}
/**
...
...
lv_objx/lv_bar.c
View file @
1254020b
...
...
@@ -110,6 +110,8 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
void
lv_bar_set_value
(
lv_obj_t
*
bar
,
int16_t
value
)
{
lv_bar_ext_t
*
ext
=
lv_obj_get_ext_attr
(
bar
);
if
(
ext
->
cur_value
==
value
)
return
;
ext
->
cur_value
=
value
>
ext
->
max_value
?
ext
->
max_value
:
value
;
ext
->
cur_value
=
ext
->
cur_value
<
ext
->
min_value
?
ext
->
min_value
:
ext
->
cur_value
;
lv_obj_invalidate
(
bar
);
...
...
@@ -125,6 +127,8 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value)
void
lv_bar_set_value_anim
(
lv_obj_t
*
bar
,
int16_t
value
,
uint16_t
anim_time
)
{
lv_bar_ext_t
*
ext
=
lv_obj_get_ext_attr
(
bar
);
if
(
ext
->
cur_value
==
value
)
return
;
int16_t
new_value
;
new_value
=
value
>
ext
->
max_value
?
ext
->
max_value
:
value
;
new_value
=
new_value
<
ext
->
min_value
?
ext
->
min_value
:
new_value
;
...
...
@@ -157,6 +161,8 @@ void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time)
void
lv_bar_set_range
(
lv_obj_t
*
bar
,
int16_t
min
,
int16_t
max
)
{
lv_bar_ext_t
*
ext
=
lv_obj_get_ext_attr
(
bar
);
if
(
ext
->
min_value
==
min
&&
ext
->
max_value
==
max
)
return
;
ext
->
max_value
=
max
;
ext
->
min_value
=
min
;
if
(
ext
->
cur_value
>
max
)
{
...
...
@@ -286,10 +292,10 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode
if
(
w
>=
h
)
{
indic_area
.
x2
=
(
int32_t
)
((
int32_t
)
w
*
(
ext
->
cur_value
-
ext
->
min_value
))
/
(
ext
->
max_value
-
ext
->
min_value
);
indic_area
.
x2
+=
indic_area
.
x
1
;
indic_area
.
x2
=
indic_area
.
x1
+
indic_area
.
x2
-
1
;
}
else
{
indic_area
.
y1
=
(
int32_t
)
((
int32_t
)
h
*
(
ext
->
cur_value
-
ext
->
min_value
))
/
(
ext
->
max_value
-
ext
->
min_value
);
indic_area
.
y1
=
indic_area
.
y2
-
indic_area
.
y1
;
indic_area
.
y1
=
indic_area
.
y2
-
indic_area
.
y1
+
1
;
}
/*Draw the indicator*/
...
...
lv_objx/lv_btnm.c
View file @
1254020b
...
...
@@ -602,7 +602,8 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
break
;
}
}
ext
->
btn_id_pr
=
area_below
;
if
(
area_below
<
ext
->
btn_cnt
)
ext
->
btn_id_pr
=
area_below
;
}
lv_obj_invalidate
(
btnm
);
}
else
if
(
c
==
LV_GROUP_KEY_UP
)
{
...
...
@@ -611,10 +612,10 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
if
(
ext
->
btn_id_pr
==
LV_BTNM_PR_NONE
)
{
ext
->
btn_id_pr
=
0
;
}
else
{
u
int16_t
area_above
;
int16_t
area_above
;
lv_coord_t
pr_center
=
ext
->
button_areas
[
ext
->
btn_id_pr
].
x1
+
(
lv_area_get_width
(
&
ext
->
button_areas
[
ext
->
btn_id_pr
])
>>
1
);
for
(
area_above
=
ext
->
btn_id_pr
;
area_above
>
0
;
area_above
--
)
{
for
(
area_above
=
ext
->
btn_id_pr
;
area_above
>
=
0
;
area_above
--
)
{
if
(
ext
->
button_areas
[
area_above
].
y1
<
ext
->
button_areas
[
ext
->
btn_id_pr
].
y1
&&
pr_center
>=
ext
->
button_areas
[
area_above
].
x1
-
style
->
body
.
padding
.
hor
&&
pr_center
<=
ext
->
button_areas
[
area_above
].
x2
)
...
...
@@ -622,7 +623,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
break
;
}
}
ext
->
btn_id_pr
=
area_above
;
if
(
area_above
>=
0
)
ext
->
btn_id_pr
=
area_above
;
}
lv_obj_invalidate
(
btnm
);
...
...
lv_objx/lv_chart.c
View file @
1254020b
...
...
@@ -159,6 +159,7 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color)
void
lv_chart_set_div_line_count
(
lv_obj_t
*
chart
,
uint8_t
hdiv
,
uint8_t
vdiv
)
{
lv_chart_ext_t
*
ext
=
lv_obj_get_ext_attr
(
chart
);
if
(
ext
->
hdiv_cnt
==
hdiv
&&
ext
->
vdiv_cnt
==
vdiv
)
return
;
ext
->
hdiv_cnt
=
hdiv
;
ext
->
vdiv_cnt
=
vdiv
;
...
...
@@ -175,6 +176,7 @@ void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv)
void
lv_chart_set_range
(
lv_obj_t
*
chart
,
lv_coord_t
ymin
,
lv_coord_t
ymax
)
{
lv_chart_ext_t
*
ext
=
lv_obj_get_ext_attr
(
chart
);
if
(
ext
->
ymin
==
ymin
&&
ext
->
ymax
==
ymax
)
return
;
ext
->
ymin
=
ymin
;
ext
->
ymax
=
ymax
;
...
...
@@ -190,6 +192,8 @@ void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax)
void
lv_chart_set_type
(
lv_obj_t
*
chart
,
lv_chart_type_t
type
)
{
lv_chart_ext_t
*
ext
=
lv_obj_get_ext_attr
(
chart
);
if
(
ext
->
type
==
type
)
return
;
ext
->
type
=
type
;
lv_chart_refresh
(
chart
);
...
...
@@ -203,6 +207,8 @@ void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type)
void
lv_chart_set_point_count
(
lv_obj_t
*
chart
,
uint16_t
point_cnt
)
{
lv_chart_ext_t
*
ext
=
lv_obj_get_ext_attr
(
chart
);
if
(
ext
->
point_cnt
==
point_cnt
)
return
;
lv_chart_series_t
*
ser
;
uint16_t
point_cnt_old
=
ext
->
point_cnt
;
uint16_t
i
;
...
...
@@ -233,6 +239,8 @@ void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt)
void
lv_chart_set_series_opa
(
lv_obj_t
*
chart
,
lv_opa_t
opa
)
{
lv_chart_ext_t
*
ext
=
lv_obj_get_ext_attr
(
chart
);
if
(
ext
->
series
.
opa
==
opa
)
return
;
ext
->
series
.
opa
=
opa
;
lv_obj_invalidate
(
chart
);
}
...
...
@@ -245,6 +253,8 @@ void lv_chart_set_series_opa(lv_obj_t * chart, lv_opa_t opa)
void
lv_chart_set_series_width
(
lv_obj_t
*
chart
,
lv_coord_t
width
)
{
lv_chart_ext_t
*
ext
=
lv_obj_get_ext_attr
(
chart
);
if
(
ext
->
series
.
width
==
width
)
return
;
ext
->
series
.
width
=
width
;
lv_obj_invalidate
(
chart
);
}
...
...
@@ -256,7 +266,10 @@ void lv_chart_set_series_width(lv_obj_t * chart, lv_coord_t width)
void
lv_chart_set_series_darking
(
lv_obj_t
*
chart
,
lv_opa_t
dark_eff
)
{
lv_chart_ext_t
*
ext
=
lv_obj_get_ext_attr
(
chart
);
if
(
ext
->
series
.
dark
==
dark_eff
)
return
;
ext
->
series
.
dark
=
dark_eff
;
lv_obj_invalidate
(
chart
);
}
/**
...
...
lv_objx/lv_cont.c
View file @
1254020b
...
...
@@ -113,6 +113,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
void
lv_cont_set_layout
(
lv_obj_t
*
cont
,
lv_layout_t
layout
)
{
lv_cont_ext_t
*
ext
=
lv_obj_get_ext_attr
(
cont
);
if
(
ext
->
layout
==
layout
)
return
;
ext
->
layout
=
layout
;
/*Send a signal to refresh the layout*/
...
...
@@ -131,11 +133,15 @@ void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en)
{
lv_obj_invalidate
(
cont
);
lv_cont_ext_t
*
ext
=
lv_obj_get_ext_attr
(
cont
);
if
(
ext
->
hor_fit
==
hor_en
&&
ext
->
ver_fit
==
ver_en
)
return
;
ext
->
hor_fit
=
hor_en
==
false
?
0
:
1
;
ext
->
ver_fit
=
ver_en
==
false
?
0
:
1
;
/*Send a signal to set a new size*/
cont
->
signal_func
(
cont
,
LV_SIGNAL_CORD_CHG
,
cont
);
lv_area_t
area
;
lv_obj_get_coords
(
cont
,
&
area
);
cont
->
signal_func
(
cont
,
LV_SIGNAL_CORD_CHG
,
&
area
);
}
/*=====================
...
...
lv_objx/lv_ddlist.c
View file @
1254020b
...
...
@@ -172,6 +172,7 @@ void lv_ddlist_set_options(lv_obj_t * ddlist, const char * options)
void
lv_ddlist_set_selected
(
lv_obj_t
*
ddlist
,
uint16_t
sel_opt
)
{
lv_ddlist_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ddlist
);
if
(
ext
->
sel_opt_id
==
sel_opt
)
return
;
ext
->
sel_opt_id
=
sel_opt
<
ext
->
option_cnt
?
sel_opt
:
ext
->
option_cnt
-
1
;
...
...
@@ -203,6 +204,8 @@ void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t action)
void
lv_ddlist_set_fix_height
(
lv_obj_t
*
ddlist
,
lv_coord_t
h
)
{
lv_ddlist_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ddlist
);
if
(
ext
->
fix_height
==
h
)
return
;
ext
->
fix_height
=
h
;
lv_ddlist_refr_size
(
ddlist
,
false
);
...
...
@@ -218,7 +221,6 @@ void lv_ddlist_set_hor_fit(lv_obj_t * ddlist, bool fit_en)
lv_cont_set_fit
(
ddlist
,
fit_en
,
lv_cont_get_ver_fit
(
ddlist
));
lv_page_set_scrl_fit
(
ddlist
,
fit_en
,
lv_page_get_scrl_fit_ver
(
ddlist
));
lv_ddlist_refr_size
(
ddlist
,
false
);
}
...
...
lv_objx/lv_gauge.c
View file @
1254020b
...
...
@@ -127,6 +127,8 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
void
lv_gauge_set_needle_count
(
lv_obj_t
*
gauge
,
uint8_t
needle_cnt
,
const
lv_color_t
*
colors
)
{
lv_gauge_ext_t
*
ext
=
lv_obj_get_ext_attr
(
gauge
);
if
(
ext
->
needle_count
!=
needle_cnt
)
{
if
(
ext
->
values
!=
NULL
)
{
lv_mem_free
(
ext
->
values
);
ext
->
values
=
NULL
;
...
...
@@ -141,6 +143,8 @@ void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, const lv_co
}
ext
->
needle_count
=
needle_cnt
;
}
ext
->
needle_colors
=
colors
;
lv_obj_invalidate
(
gauge
);
}
...
...
@@ -156,6 +160,8 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int16_t value)
lv_gauge_ext_t
*
ext
=
lv_obj_get_ext_attr
(
gauge
);
if
(
needle_id
>=
ext
->
needle_count
)
return
;
if
(
ext
->
values
[
needle_id
]
==
value
)
return
;
int16_t
min
=
lv_gauge_get_min_value
(
gauge
);
int16_t
max
=
lv_gauge_get_max_value
(
gauge
);
...
...
@@ -183,6 +189,7 @@ void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint
lv_gauge_ext_t
*
ext
=
lv_obj_get_ext_attr
(
gauge
);
ext
->
label_count
=
label_cnt
;
lv_obj_invalidate
(
gauge
);
}
/*=====================
...
...
lv_objx/lv_img.h
View file @
1254020b
...
...
@@ -36,8 +36,8 @@ typedef struct
/*New data for this type */
const
void
*
src
;
/*Image source: Pointer to an array or a file or a symbol*/
lv_coord_t
w
;
/*Width of the image (
doubled when upscaled) (
Handled by the library)*/
lv_coord_t
h
;
/*Height of the image (
doubled when upscaled) (
Handled by the library)*/
lv_coord_t
w
;
/*Width of the image (Handled by the library)*/
lv_coord_t
h
;
/*Height of the image (Handled by the library)*/
uint8_t
src_type
:
2
;
/*See: lv_img_src_t*/
uint8_t
auto_size
:
1
;
/*1: automatically set the object size to the image size*/
uint8_t
chroma_keyed
:
1
;
/*1: Chroma keyed image, LV_COLOR_TRANSP (lv_conf.h) pixels will be transparent (Handled by the library)*/
...
...
@@ -70,8 +70,8 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img);
/**
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0.
* Use 'lv_img_set_src()' instead.
* @param img
* @param fn
* @param img
-
* @param fn
-
*/
static
inline
void
lv_img_set_file
(
lv_obj_t
*
img
,
const
char
*
fn
)
{
...
...
@@ -98,8 +98,8 @@ static inline void lv_img_set_style(lv_obj_t *img, lv_style_t *style)
/**
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
* @param img
* @param upscale
* @param img
-
* @param upscale
-
*/
static
inline
void
lv_img_set_upscale
(
lv_obj_t
*
img
,
bool
upcale
)
{
...
...
@@ -147,7 +147,7 @@ static inline lv_style_t* lv_img_get_style(lv_obj_t *img)
/**
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
* @param img
* @param img
-
* @return false
*/
static
inline
bool
lv_img_get_upscale
(
lv_obj_t
*
img
)
...
...
lv_objx/lv_kb.c
View file @
1254020b
...
...
@@ -146,6 +146,7 @@ void lv_kb_set_ta(lv_obj_t * kb, lv_obj_t * ta)
lv_kb_ext_t
*
ext
=
lv_obj_get_ext_attr
(
kb
);
lv_cursor_type_t
cur_type
;
/*Hide the cursor of the old Text area if cursor management is enabled*/
if
(
ext
->
ta
&&
ext
->
cursor_mng
)
{
cur_type
=
lv_ta_get_cursor_type
(
ext
->
ta
);
lv_ta_set_cursor_type
(
ext
->
ta
,
cur_type
|
LV_CURSOR_HIDDEN
);
...
...
@@ -153,6 +154,7 @@ void lv_kb_set_ta(lv_obj_t * kb, lv_obj_t * ta)
ext
->
ta
=
ta
;
/*Show the cursor of the new Text area if cursor management is enabled*/
if
(
ext
->
ta
&&
ext
->
cursor_mng
)
{
cur_type
=
lv_ta_get_cursor_type
(
ext
->
ta
);
lv_ta_set_cursor_type
(
ext
->
ta
,
cur_type
&
(
~
LV_CURSOR_HIDDEN
));
...
...
@@ -167,6 +169,8 @@ void lv_kb_set_ta(lv_obj_t * kb, lv_obj_t * ta)
void
lv_kb_set_mode
(
lv_obj_t
*
kb
,
lv_kb_mode_t
mode
)
{
lv_kb_ext_t
*
ext
=
lv_obj_get_ext_attr
(
kb
);
if
(
ext
->
mode
==
mode
)
return
;
ext
->
mode
=
mode
;
if
(
mode
==
LV_KB_MODE_TEXT
)
lv_btnm_set_map
(
kb
,
kb_map_lc
);
else
if
(
mode
==
LV_KB_MODE_NUM
)
lv_btnm_set_map
(
kb
,
kb_map_num
);
...
...
@@ -181,6 +185,8 @@ void lv_kb_set_mode(lv_obj_t * kb, lv_kb_mode_t mode)
void
lv_kb_set_cursor_manage
(
lv_obj_t
*
kb
,
bool
en
)
{
lv_kb_ext_t
*
ext
=
lv_obj_get_ext_attr
(
kb
);
if
(
ext
->
cursor_mng
==
en
)
return
;
ext
->
cursor_mng
=
en
==
false
?
0
:
1
;
if
(
ext
->
ta
)
{
...
...
@@ -387,14 +393,18 @@ static lv_res_t lv_app_kb_action(lv_obj_t * kb, const char * txt)
return
LV_RES_OK
;
}
else
if
(
strcmp
(
txt
,
SYMBOL_CLOSE
)
==
0
)
{
lv_kb_set_ta
(
kb
,
NULL
);
/*De-assign the text area*/
if
(
ext
->
hide_action
)
ext
->
hide_action
(
kb
);
else
lv_obj_del
(
kb
);
else
{
lv_kb_set_ta
(
kb
,
NULL
);
/*De-assign the text area to hide it cursor if needed*/
lv_obj_del
(
kb
);
}
return
LV_RES_INV
;
}
else
if
(
strcmp
(
txt
,
SYMBOL_OK
)
==
0
)
{
lv_kb_set_ta
(
kb
,
NULL
);
/*De-assign the text area*/
if
(
ext
->
ok_action
)
ext
->
ok_action
(
kb
);
else
lv_obj_del
(
kb
);
else
{
lv_kb_set_ta
(
kb
,
NULL
);
/*De-assign the text area to hide it cursor if needed*/
lv_obj_del
(
kb
);
}
return
LV_RES_INV
;
}
...
...
lv_objx/lv_label.c
View file @
1254020b
...
...
@@ -253,6 +253,7 @@ void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode)
void
lv_label_set_align
(
lv_obj_t
*
label
,
lv_label_align_t
align
)
{
lv_label_ext_t
*
ext
=
lv_obj_get_ext_attr
(
label
);
if
(
ext
->
align
==
align
)
return
;
ext
->
align
=
align
;
...
...
@@ -268,6 +269,7 @@ void lv_label_set_align(lv_obj_t *label, lv_label_align_t align)
void
lv_label_set_recolor
(
lv_obj_t
*
label
,
bool
recolor_en
)
{
lv_label_ext_t
*
ext
=
lv_obj_get_ext_attr
(
label
);
if
(
ext
->
recolor
==
recolor_en
)
return
;
ext
->
recolor
=
recolor_en
==
false
?
0
:
1
;
...
...
@@ -282,6 +284,8 @@ void lv_label_set_recolor(lv_obj_t * label, bool recolor_en)
void
lv_label_set_no_break
(
lv_obj_t
*
label
,
bool
no_break_en
)
{
lv_label_ext_t
*
ext
=
lv_obj_get_ext_attr
(
label
);
if
(
ext
->
no_break
==
no_break_en
)
return
;
ext
->
no_break
=
no_break_en
==
false
?
0
:
1
;
lv_label_refr_text
(
label
);
...
...
@@ -295,6 +299,8 @@ void lv_label_set_no_break(lv_obj_t * label, bool no_break_en)
void
lv_label_set_body_draw
(
lv_obj_t
*
label
,
bool
body_en
)
{
lv_label_ext_t
*
ext
=
lv_obj_get_ext_attr
(
label
);
if
(
ext
->
body_draw
==
body_en
)
return
;
ext
->
body_draw
=
body_en
==
false
?
0
:
1
;
lv_obj_refresh_ext_size
(
label
);
...
...
@@ -310,6 +316,8 @@ void lv_label_set_body_draw(lv_obj_t *label, bool body_en)
void
lv_label_set_anim_speed
(
lv_obj_t
*
label
,
uint16_t
anim_speed
)
{
lv_label_ext_t
*
ext
=
lv_obj_get_ext_attr
(
label
);
if
(
ext
->
anim_speed
==
anim_speed
)
return
;
ext
->
anim_speed
=
anim_speed
;
if
(
ext
->
long_mode
==
LV_LABEL_LONG_ROLL
||
ext
->
long_mode
==
LV_LABEL_LONG_SCROLL
)
{
...
...
lv_objx/lv_led.c
View file @
1254020b
...
...
@@ -104,6 +104,8 @@ void lv_led_set_bright(lv_obj_t * led, uint8_t bright)
{
/*Set the brightness*/
lv_led_ext_t
*
ext
=
lv_obj_get_ext_attr
(
led
);
if
(
ext
->
bright
==
bright
)
return
;
ext
->
bright
=
bright
;
/*Invalidate the object there fore it will be redrawn*/
...
...
lv_objx/lv_line.c
View file @
1254020b
...
...
@@ -129,6 +129,7 @@ void lv_line_set_points(lv_obj_t * line, const lv_point_t * point_a, uint16_t po
void
lv_line_set_auto_size
(
lv_obj_t
*
line
,
bool
autosize_en
)
{
lv_line_ext_t
*
ext
=
lv_obj_get_ext_attr
(
line
);
if
(
ext
->
auto_size
==
autosize_en
)
return
;
ext
->
auto_size
=
autosize_en
==
false
?
0
:
1
;
...
...
@@ -146,6 +147,7 @@ void lv_line_set_auto_size(lv_obj_t * line, bool autosize_en)
void
lv_line_set_y_invert
(
lv_obj_t
*
line
,
bool
yinv_en
)
{
lv_line_ext_t
*
ext
=
lv_obj_get_ext_attr
(
line
);
if
(
ext
->
y_inv
==
yinv_en
)
return
;
ext
->
y_inv
=
yinv_en
==
false
?
0
:
1
;
...
...
@@ -255,6 +257,11 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param)
}
buf
->
type
[
i
]
=
"lv_line"
;
}
else
if
(
sign
==
LV_SIGNAL_REFR_EXT_SIZE
)
{
lv_style_t
*
style
=
lv_line_get_style
(
line
);
if
(
line
->
ext_size
<
style
->
line
.
width
)
line
->
ext_size
=
style
->
line
.
width
;
}
return
res
;
}
...
...
lv_objx/lv_line.h
View file @
1254020b
...
...
@@ -90,8 +90,8 @@ static inline void lv_line_set_style(lv_obj_t *line, lv_style_t *style)
/**
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
* @param line
* @param upscale
* @param line
-
* @param upscale
-
*/
static
inline
void
lv_line_set_upscale
(
lv_obj_t
*
line
,
bool
upcale
)
{
...
...
@@ -127,7 +127,7 @@ static inline lv_style_t* lv_line_get_style(lv_obj_t *line)
/**
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
* @param line
* @param line
-
* @return false
*/
static
inline
bool
lv_line_get_upscale
(
lv_obj_t
*
line
)
...
...
lv_objx/lv_list.c
View file @
1254020b
...
...
@@ -211,6 +211,8 @@ void lv_list_set_anim_time(lv_obj_t *list, uint16_t anim_time)
#if USE_LV_ANIMATION == 0
anim_time
=
0
;
#endif
if
(
ext
->
anim_time
==
anim_time
)
return
;
ext
->
anim_time
=
anim_time
;
}
...
...
lv_objx/lv_lmeter.c
View file @
1254020b
...
...
@@ -113,6 +113,8 @@ lv_obj_t * lv_lmeter_create(lv_obj_t * par, lv_obj_t * copy)
void
lv_lmeter_set_value
(
lv_obj_t
*
lmeter
,
int16_t
value
)
{
lv_lmeter_ext_t
*
ext
=
lv_obj_get_ext_attr
(
lmeter
);
if
(
ext
->
cur_value
==
value
)
return
;
ext
->
cur_value
=
value
>
ext
->
max_value
?
ext
->
max_value
:
value
;
ext
->
cur_value
=
ext
->
cur_value
<
ext
->
min_value
?
ext
->
min_value
:
ext
->
cur_value
;
lv_obj_invalidate
(
lmeter
);
...
...
@@ -127,6 +129,8 @@ void lv_lmeter_set_value(lv_obj_t *lmeter, int16_t value)
void
lv_lmeter_set_range
(
lv_obj_t
*
lmeter
,
int16_t
min
,
int16_t
max
)
{
lv_lmeter_ext_t
*
ext
=
lv_obj_get_ext_attr
(
lmeter
);
if
(
ext
->
min_value
==
min
&&
ext
->
max_value
==
max
)
return
;
ext
->
max_value
=
max
;
ext
->
min_value
=
min
;
if
(
ext
->
cur_value
>
max
)
{
...
...
@@ -149,6 +153,8 @@ void lv_lmeter_set_range(lv_obj_t *lmeter, int16_t min, int16_t max)
void
lv_lmeter_set_scale
(
lv_obj_t
*
lmeter
,
uint16_t
angle
,
uint8_t
line_cnt
)
{
lv_lmeter_ext_t
*
ext
=
lv_obj_get_ext_attr
(
lmeter
);
if
(
ext
->
scale_angle
==
angle
&&
ext
->
line_cnt
==
line_cnt
)
return
;
ext
->
scale_angle
=
angle
;
ext
->
line_cnt
=
line_cnt
;
...
...
lv_objx/lv_lmeter.h
View file @
1254020b
...
...
@@ -80,7 +80,7 @@ void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt);
* Set the styles of a line meter
* @param lmeter pointer to a line meter object
* @param bg set the style of the line meter
*
*
/
*/
static
inline
void
lv_lmeter_set_style
(
lv_obj_t
*
lmeter
,
lv_style_t
*
bg
)
{
lv_obj_set_style
(
lmeter
,
bg
);
...
...
lv_objx/lv_mbox.c
View file @
1254020b
...
...
@@ -191,6 +191,7 @@ void lv_mbox_set_anim_time(lv_obj_t * mbox, uint16_t anim_time)
#if USE_LV_ANIMATION == 0
anim_time
=
0
;
#endif
ext
->
anim_time
=
anim_time
;
}
...
...
@@ -348,6 +349,16 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
{
lv_res_t
res
;
/*Translate LV_GROUP_KEY_UP/DOWN to LV_GROUP_KEY_LEFT/RIGHT */
char
c_trans
=
0
;
if
(
sign
==
LV_SIGNAL_CONTROLL
)
{
c_trans
=
*
((
char
*
)
param
);
if
(
c_trans
==
LV_GROUP_KEY_DOWN
)
c_trans
=
LV_GROUP_KEY_LEFT
;
if
(
c_trans
==
LV_GROUP_KEY_UP
)
c_trans
=
LV_GROUP_KEY_RIGHT
;
param
=
&
c_trans
;
}
/* Include the ancient signal function */
res
=
ancestor_signal
(
mbox
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
...
...
@@ -356,7 +367,6 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
if
(
sign
==
LV_SIGNAL_CORD_CHG
)
{
if
(
lv_obj_get_width
(
mbox
)
!=
lv_area_get_width
(
param
))
{
mbox_realign
(
mbox
);
}
}
else
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
...
...
lv_objx/lv_page.c
View file @
1254020b
...
...
@@ -170,6 +170,8 @@ void lv_page_set_pr_action(lv_obj_t * page, lv_action_t pr_action)
void
lv_page_set_sb_mode
(
lv_obj_t
*
page
,
lv_sb_mode_t
sb_mode
)
{
lv_page_ext_t
*
ext
=
lv_obj_get_ext_attr
(
page
);
if
(
ext
->
sb
.
mode
==
sb_mode
)
return
;
ext
->
sb
.
mode
=
sb_mode
;
ext
->
sb
.
hor_draw
=
0
;
ext
->
sb
.
ver_draw
=
0
;
...
...
lv_objx/lv_page.h
View file @
1254020b
...
...
@@ -160,7 +160,7 @@ static inline void lv_page_set_scrl_layout(lv_obj_t * page, lv_layout_t layout)
* @param page pointer to a page object
* @param type which style should be set
* @param style pointer to a style
*
*
/
*/
void
lv_page_set_style
(
lv_obj_t
*
page
,
lv_page_style_t
type
,
lv_style_t
*
style
);
/*=====================
...
...
@@ -229,7 +229,7 @@ static inline bool lv_page_get_scrl_fit_ver(lv_obj_t * page)
* @param page pointer to page object
* @param type which style should be get
* @return style pointer to a style
*
*
/
*/
lv_style_t
*
lv_page_get_style
(
lv_obj_t
*
page
,
lv_page_style_t
type
);
/*=====================
...
...
lv_objx/lv_roller.c
View file @
1254020b
...
...
@@ -125,6 +125,9 @@ void lv_roller_set_selected(lv_obj_t *roller, uint16_t sel_opt, bool anim_en)
#if USE_LV_ANIMATION == 0
anim_en
=
false
;
#endif
if
(
lv_roller_get_selected
(
roller
)
==
sel_opt
)
return
;
lv_ddlist_set_selected
(
roller
,
sel_opt
);
refr_position
(
roller
,
anim_en
);
}
...
...
lv_objx/lv_slider.c
View file @
1254020b
...
...
@@ -127,6 +127,8 @@ void lv_slider_set_action(lv_obj_t * slider, lv_action_t action)
void
lv_slider_set_knob_in
(
lv_obj_t
*
slider
,
bool
in
)
{
lv_slider_ext_t
*
ext
=
lv_obj_get_ext_attr
(
slider
);
if
(
ext
->
knob_in
==
in
)
return
;
ext
->
knob_in
=
in
==
false
?
0
:
1
;
lv_obj_invalidate
(
slider
);
}
...
...
@@ -273,11 +275,21 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
pad_hor_bg
=
(
lv_area_get_width
(
&
area_bg
)
-
LV_SLIDER_SIZE_MIN
)
>>
1
;
}
/*Let space only in the perpendicular directions*/
if
(
ext
->
knob_in
)
{
/*Enable extra size if the knob is inside */
if
(
pad_hor_bg
<
0
)
{
area_bg
.
x1
+=
pad_hor_bg
;
area_bg
.
x2
-=
pad_hor_bg
;
}
if
(
pad_ver_bg
<
0
)
{
area_bg
.
y1
+=
pad_hor_bg
;
area_bg
.
y2
-=
pad_hor_bg
;
}
}
else
{
/*Let space only in the perpendicular directions*/
area_bg
.
x1
+=
slider_w
<
slider_h
?
pad_hor_bg
:
0
;
/*Pad only for vertical slider*/
area_bg
.
x2
-=
slider_w
<
slider_h
?
pad_hor_bg
:
0
;
/*Pad only for vertical slider*/
area_bg
.
y1
+=
slider_w
>
slider_h
?
pad_ver_bg
:
0
;
/*Pad only for horizontal slider*/
area_bg
.
y2
-=
slider_w
>
slider_h
?
pad_ver_bg
:
0
;
/*Pad only for horizontal slider*/
}
lv_draw_rect
(
&
area_bg
,
mask
,
style_bg
);
/*Draw the indicator*/
...
...
@@ -309,11 +321,11 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
if
(
slider_w
>=
slider_h
)
{
area_indic
.
x2
=
(
int32_t
)
((
int32_t
)
lv_area_get_width
(
&
area_indic
)
*
(
cur_value
-
min_value
))
/
(
max_value
-
min_value
);
area_indic
.
x2
+=
area_indic
.
x
1
;
area_indic
.
x2
=
area_indic
.
x1
+
area_indic
.
x2
-
1
;
}
else
{
area_indic
.
y1
=
(
int32_t
)
((
int32_t
)
lv_area_get_height
(
&
area_indic
)
*
(
cur_value
-
min_value
))
/
(
max_value
-
min_value
);
area_indic
.
y1
=
area_indic
.
y2
-
area_indic
.
y1
;
area_indic
.
y1
=
area_indic
.
y2
-
area_indic
.
y1
+
1
;
}
if
(
cur_value
!=
min_value
)
lv_draw_rect
(
&
area_indic
,
mask
,
style_indic
);
...
...
lv_objx/lv_sw.c
View file @
1254020b
...
...
@@ -112,6 +112,8 @@ lv_obj_t * lv_sw_create(lv_obj_t * par, lv_obj_t * copy)
*/
void
lv_sw_on
(
lv_obj_t
*
sw
)
{
if
(
lv_sw_get_state
(
sw
))
return
;
/*Do nothing is already turned on*/
lv_sw_ext_t
*
ext
=
lv_obj_get_ext_attr
(
sw
);
lv_slider_set_value
(
sw
,
1
);
lv_slider_set_style
(
sw
,
LV_SLIDER_STYLE_KNOB
,
ext
->
style_knob_on
);
...
...
@@ -123,6 +125,8 @@ void lv_sw_on(lv_obj_t *sw)
*/
void
lv_sw_off
(
lv_obj_t
*
sw
)
{
if
(
!
lv_sw_get_state
(
sw
))
return
;
/*Do nothing is already turned off*/
lv_sw_ext_t
*
ext
=
lv_obj_get_ext_attr
(
sw
);
lv_slider_set_value
(
sw
,
0
);
lv_slider_set_style
(
sw
,
LV_SLIDER_STYLE_KNOB
,
ext
->
style_knob_off
);
...
...
lv_objx/lv_ta.c
View file @
1254020b
...
...
@@ -347,6 +347,8 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt)
void
lv_ta_set_cursor_pos
(
lv_obj_t
*
ta
,
int16_t
pos
)
{
lv_ta_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ta
);
if
(
ext
->
cursor
.
pos
==
pos
)
return
;
uint16_t
len
=
lv_txt_get_length
(
lv_label_get_text
(
ext
->
label
));
if
(
pos
<
0
)
pos
=
len
+
pos
;
...
...
@@ -419,6 +421,8 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
void
lv_ta_set_cursor_type
(
lv_obj_t
*
ta
,
lv_cursor_type_t
cur_type
)
{
lv_ta_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ta
);
if
(
ext
->
cursor
.
type
==
cur_type
)
return
;
ext
->
cursor
.
type
=
cur_type
;
lv_obj_invalidate
(
ta
);
}
...
...
@@ -431,6 +435,7 @@ void lv_ta_set_cursor_type(lv_obj_t * ta, lv_cursor_type_t cur_type)
void
lv_ta_set_pwd_mode
(
lv_obj_t
*
ta
,
bool
pwd_en
)
{
lv_ta_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ta
);
if
(
ext
->
pwd_mode
==
pwd_en
)
return
;
/*Pwd mode is now enabled*/
if
(
ext
->
pwd_mode
==
0
&&
pwd_en
!=
false
)
{
...
...
@@ -464,8 +469,10 @@ void lv_ta_set_pwd_mode(lv_obj_t * ta, bool pwd_en)
*/
void
lv_ta_set_one_line
(
lv_obj_t
*
ta
,
bool
en
)
{
if
(
en
!=
false
)
{
lv_ta_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ta
);
if
(
ext
->
one_line
==
en
)
return
;
if
(
en
!=
false
)
{
lv_style_t
*
style_ta
=
lv_obj_get_style
(
ta
);
lv_style_t
*
style_scrl
=
lv_obj_get_style
(
lv_page_get_scrl
(
ta
));
lv_style_t
*
style_label
=
lv_obj_get_style
(
ext
->
label
);
...
...
@@ -478,7 +485,6 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en)
lv_label_set_no_break
(
ext
->
label
,
true
);
lv_obj_set_pos
(
lv_page_get_scrl
(
ta
),
style_ta
->
body
.
padding
.
hor
,
style_ta
->
body
.
padding
.
ver
);
}
else
{
lv_ta_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ta
);
lv_style_t
*
style_ta
=
lv_obj_get_style
(
ta
);
ext
->
one_line
=
0
;
...
...
@@ -1044,7 +1050,10 @@ static void pwd_char_hider(lv_obj_t * ta)
int16_t
len
=
lv_txt_get_length
(
txt
);
bool
refr
=
false
;
uint16_t
i
;
for
(
i
=
0
;
i
<
len
;
i
++
)
txt
[
i
]
=
'*'
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
txt
[
i
]
=
'*'
;
refr
=
true
;
}
txt
[
i
]
=
'\0'
;
...
...
lv_objx/lv_tabview.c
View file @
1254020b
...
...
@@ -241,6 +241,8 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
anim_en
=
false
;
#endif
lv_tabview_ext_t
*
ext
=
lv_obj_get_ext_attr
(
tabview
);
if
(
ext
->
tab_cur
==
id
)
return
;
lv_style_t
*
style
=
lv_obj_get_style
(
ext
->
content
);
if
(
id
>=
ext
->
tab_cnt
)
id
=
ext
->
tab_cnt
-
1
;
...
...
lv_objx/lv_win.c
View file @
1254020b
...
...
@@ -207,6 +207,8 @@ void lv_win_set_title(lv_obj_t * win, const char * title)
void
lv_win_set_btn_size
(
lv_obj_t
*
win
,
lv_coord_t
size
)
{
lv_win_ext_t
*
ext
=
lv_obj_get_ext_attr
(
win
);
if
(
ext
->
btn_size
==
size
)
return
;
ext
->
btn_size
=
size
;
lv_win_realign
(
win
);
...
...
lv_themes/lv_theme.h
View file @
1254020b
...
...
@@ -258,6 +258,7 @@ lv_theme_t * lv_theme_get_current(void);
#include "lv_theme_default.h"
#include "lv_theme_alien.h"
#include "lv_theme_night.h"
#include "lv_theme_zen.h"
#include "lv_theme_mono.h"
#ifdef __cplusplus
...
...
lv_themes/lv_theme_alien.c
View file @
1254020b
...
...
@@ -366,9 +366,9 @@ static void gauge_init(void)
lv_style_copy
(
&
gauge_bg
,
&
def
);
gauge_bg
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
10
,
70
);
gauge_bg
.
body
.
grad_color
=
gauge_bg
.
body
.
main_color
;
gauge_bg
.
body
.
padding
.
hor
=
LV_DPI
/
1
2
;
/*Scale line length*/
gauge_bg
.
body
.
padding
.
hor
=
LV_DPI
/
1
6
;
/*Scale line length*/
gauge_bg
.
body
.
padding
.
ver
=
LV_DPI
/
10
;
/*Needle center size*/
gauge_bg
.
body
.
padding
.
inner
=
LV_DPI
/
8
;
/*Label - scale distance*/
gauge_bg
.
body
.
padding
.
inner
=
LV_DPI
/
12
;
/*Label - scale distance*/
gauge_bg
.
body
.
border
.
color
=
LV_COLOR_HEX3
(
0x777
);
gauge_bg
.
line
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
80
,
75
);
gauge_bg
.
line
.
width
=
2
;
...
...
lv_themes/lv_theme_mono.c
View file @
1254020b
...
...
@@ -456,7 +456,7 @@ lv_theme_t * lv_theme_mono_init(uint16_t hue, lv_font_t *font)
* Get a pointer to the theme
* @return pointer to the theme
*/
lv_theme_t
*
lv_theme_get_
templ
(
void
)
lv_theme_t
*
lv_theme_get_
mono
(
void
)
{
return
&
theme
;
}
...
...
lv_themes/lv_theme_zen.c
View file @
1254020b
...
...
@@ -283,10 +283,10 @@ static void gauge_init(void)
lv_style_copy
(
&
gauge
,
&
def
);
gauge
.
line
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
50
,
70
);
gauge
.
line
.
width
=
2
;
gauge
.
line
.
width
=
1
;
gauge
.
body
.
main_color
=
LV_COLOR_HEX3
(
0x999
);
gauge
.
body
.
grad_color
=
gauge
.
body
.
main_color
;
gauge
.
body
.
padding
.
hor
=
LV_DPI
/
1
2
;
gauge
.
body
.
padding
.
hor
=
LV_DPI
/
1
6
;
gauge
.
body
.
border
.
color
=
LV_COLOR_HEX3
(
0x666
);
/*Needle middle color*/
theme
.
gauge
=
&
gauge
;
...
...
lvgl.h
View file @
1254020b
...
...
@@ -56,7 +56,7 @@ extern "C" {
/*Current version of LittlevGL*/
#define LVGL_VERSION_MAJOR 5
#define LVGL_VERSION_MINOR 1
#define LVGL_VERSION_PATCH
0
#define LVGL_VERSION_PATCH
1
#define LVGL_VERSION_INFO ""
/**********************
...
...
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