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
5459fc3c
Commit
5459fc3c
authored
Dec 21, 2016
by
Gabor
Browse files
Options
Browse Files
Download
Plain Diff
Eliminate some warnings
parents
727ed405
7636c5d9
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
509 additions
and
362 deletions
+509
-362
lv_app.c
lv_app/lv_app.c
+65
-23
lv_app.h
lv_app/lv_app.h
+15
-14
lv_app_sup.c
lv_app/lv_app_sup.c
+78
-58
lv_app_sup.h
lv_app/lv_app_sup.h
+2
-0
img_add.c
lv_app/lv_icon/x2/img_add.c
+1
-1
img_battery_empty.c
lv_app/lv_icon/x2/img_battery_empty.c
+1
-1
img_battery_full.c
lv_app/lv_icon/x2/img_battery_full.c
+1
-1
img_battery_half.c
lv_app/lv_icon/x2/img_battery_half.c
+1
-1
img_bubble.c
lv_app/lv_icon/x2/img_bubble.c
+1
-1
img_calendar.c
lv_app/lv_icon/x2/img_calendar.c
+1
-1
img_clock.c
lv_app/lv_icon/x2/img_clock.c
+1
-1
img_close.c
lv_app/lv_icon/x2/img_close.c
+1
-1
img_down.c
lv_app/lv_icon/x2/img_down.c
+1
-1
img_driver.c
lv_app/lv_icon/x2/img_driver.c
+1
-1
img_eject.c
lv_app/lv_icon/x2/img_eject.c
+1
-1
img_folder.c
lv_app/lv_icon/x2/img_folder.c
+1
-1
img_image.c
lv_app/lv_icon/x2/img_image.c
+1
-1
img_left.c
lv_app/lv_icon/x2/img_left.c
+1
-1
img_music.c
lv_app/lv_icon/x2/img_music.c
+1
-1
img_ok.c
lv_app/lv_icon/x2/img_ok.c
+1
-1
img_play.c
lv_app/lv_icon/x2/img_play.c
+1
-1
img_right.c
lv_app/lv_icon/x2/img_right.c
+1
-1
img_settings.c
lv_app/lv_icon/x2/img_settings.c
+1
-1
img_shut_down.c
lv_app/lv_icon/x2/img_shut_down.c
+1
-1
img_star.c
lv_app/lv_icon/x2/img_star.c
+1
-1
img_up.c
lv_app/lv_icon/x2/img_up.c
+1
-1
img_user.c
lv_app/lv_icon/x2/img_user.c
+1
-1
img_video.c
lv_app/lv_icon/x2/img_video.c
+1
-1
img_volume.c
lv_app/lv_icon/x2/img_volume.c
+1
-1
lv_app_example.c
lv_appx/lv_app_example.c
+76
-25
lv_app_example.h
lv_appx/lv_app_example.h
+8
-0
lv_draw_vbasic.c
lv_draw/lv_draw_vbasic.c
+72
-95
font.h
lv_misc/font.h
+8
-8
dejavu_20.c
lv_misc/fonts/dejavu_20.c
+1
-1
lv_dispi.c
lv_obj/lv_dispi.c
+1
-1
lv_dispi.h
lv_obj/lv_dispi.h
+2
-2
lv_obj.c
lv_obj/lv_obj.c
+47
-1
lv_refr.c
lv_obj/lv_refr.c
+51
-60
lv_btn.c
lv_objx/lv_btn.c
+2
-5
lv_btnm.c
lv_objx/lv_btnm.c
+2
-3
lv_cb.c
lv_objx/lv_cb.c
+6
-8
lv_mbox.c
lv_objx/lv_mbox.c
+1
-1
lv_page.c
lv_objx/lv_page.c
+12
-5
lv_rect.c
lv_objx/lv_rect.c
+35
-27
No files found.
lv_app/lv_app.c
View file @
5459fc3c
...
...
@@ -7,6 +7,9 @@
* INCLUDES
*********************/
#include "lv_app.h"
#if LV_APP_ENABLE != 0
#include "lv_app_sup.h"
#include "lvgl/lv_misc/anim.h"
/*********************
...
...
@@ -30,7 +33,7 @@ static lv_action_res_t lv_app_sc_rel_action(lv_obj_t * sc, lv_dispi_t * dispi);
static
lv_action_res_t
lv_app_sc_pr_action
(
lv_obj_t
*
sc
,
lv_dispi_t
*
dispi
);
static
lv_action_res_t
lv_app_win_close_action
(
lv_obj_t
*
close_btn
,
lv_dispi_t
*
dispi
);
static
lv_action_res_t
lv_app_win_minim_action
(
lv_obj_t
*
close_btn
,
lv_dispi_t
*
dispi
);
#if LV_APP_ANIM_LEVEL
== 2
&& LV_APP_ANIM_WIN != 0
#if LV_APP_ANIM_LEVEL
!= 0
&& LV_APP_ANIM_WIN != 0
static
void
lv_app_win_close_anim_cb
(
lv_obj_t
*
app_win
);
static
void
lv_app_win_minim_anim_cb
(
lv_obj_t
*
app_win
);
#endif
...
...
@@ -47,6 +50,7 @@ static lv_obj_t * app_scr;
static
lv_obj_t
*
menuh
;
/*Holder of timg_bubbleshe menu on the top*/
static
lv_obj_t
*
app_btn
;
/*The "Apps" button on the menu*/
static
lv_obj_t
*
sys_apph
;
/*Holder of the system app. buttons*/
static
lv_obj_t
*
clock
;
/*Clock on the menu bar (right top)*/
static
lv_obj_t
*
app_list
;
static
lv_obj_t
*
sc_page
;
...
...
@@ -125,9 +129,18 @@ void lv_app_init(void)
lv_btn_set_rel_action
(
app_btn
,
lv_app_menu_rel_action
);
lv_obj_t
*
app_label
=
lv_label_create
(
app_btn
,
NULL
);
lv_obj_set_style
(
app_label
,
&
app_style
.
menu_btn_label_style
);
lv_obj_set_pos
(
app_btn
,
0
,
0
);
lv_label_set_text
(
app_label
,
"Apps"
);
lv_obj_set_pos
(
app_btn
,
0
,
0
);
sys_apph
=
lv_rect_create
(
menuh
,
NULL
);
lv_rect_set_layout
(
sys_apph
,
LV_RECT_LAYOUT_ROW_M
);
lv_rect_set_fit
(
sys_apph
,
true
,
false
);
lv_obj_set_height
(
sys_apph
,
app_style
.
menu_h
);
lv_obj_set_style
(
sys_apph
,
lv_rects_get
(
LV_RECTS_TRANSP
,
NULL
));
clock
=
lv_label_create
(
sys_apph
,
NULL
);
lv_obj_set_style
(
clock
,
&
app_style
.
menu_btn_label_style
);
lv_label_set_text
(
clock
,
"20:17"
);
lv_obj_align
(
sys_apph
,
NULL
,
LV_ALIGN_IN_RIGHT_MID
,
0
,
0
);
lv_app_refr_style
();
...
...
@@ -177,13 +190,16 @@ void lv_app_close(lv_app_inst_t * app)
}
/**
* Publish an event.
* @param app pointer to an application which publishes the event
* @param event an event from 'lv_app_event_t' enum
* Send data to other applications
* @param app_send pointer to the application which is sending the message
* @param type type of data from 'lv_app_com_type_t' enum
* @param data pointer to the sent data
* @param len length of 'data' in bytes
* @return number application which were received the message
*/
void
lv_app_event_send
(
lv_app_inst_t
*
app
,
lv_app_event_t
event
)
uint16_t
lv_app_com_send
(
lv_app_inst_t
*
app_send
,
lv_app_com_type_t
type
,
void
*
data
,
uint32_t
len
)
{
return
0
;
}
/**
...
...
@@ -211,7 +227,7 @@ lv_obj_t * lv_app_sc_open(lv_app_inst_t * app)
app
->
sc_title
=
lv_label_create
(
app
->
sc
,
NULL
);
lv_obj_set_style
(
app
->
sc_title
,
&
app_style
.
sc_title_style
);
lv_label_set_long_mode
(
app
->
sc_title
,
LV_LABEL_LONG_SCROLL
);
//
lv_label_set_long_mode(app->sc_title, LV_LABEL_LONG_SCROLL);
lv_label_set_text
(
app
->
sc_title
,
app
->
name
);
lv_obj_align_us
(
app
->
sc_title
,
NULL
,
LV_ALIGN_IN_TOP_MID
,
0
,
app_style
.
sc_title_margin
);
...
...
@@ -264,6 +280,9 @@ lv_obj_t * lv_app_win_open(lv_app_inst_t * app)
lv_win_add_ctrl_btn
(
app
->
win
,
"U:/icon_down"
,
lv_app_win_minim_action
);
lv_win_add_ctrl_btn
(
app
->
win
,
"U:/icon_close"
,
lv_app_win_close_action
);
app
->
win_data
=
dm_alloc
(
app
->
dsc
->
win_data_size
);
app
->
dsc
->
win_open
(
app
,
app
->
win
);
return
app
->
win
;
}
...
...
@@ -330,6 +349,29 @@ const lv_app_dsc_t * lv_app_get_dsc(const char * name)
return
NULL
;
}
/**
* Read the list of the running applications. (Get he next element)
* @param prev the previous application (at the first call give NULL to get the first application)
* @param dsc pointer to an application descriptor to filer the applications (NULL to do not filter)
* @return pointer to the next running application or NULL if no more
*/
lv_app_inst_t
*
lv_app_get_next_app
(
lv_app_inst_t
*
prev
,
lv_app_dsc_t
*
dsc
)
{
lv_app_inst_t
*
next
;
while
(
1
)
{
if
(
prev
==
NULL
)
next
=
ll_get_head
(
&
app_inst_ll
);
else
next
=
ll_get_next
(
&
app_inst_ll
,
prev
);
if
(
next
==
NULL
)
break
;
if
(
next
->
dsc
==
dsc
||
dsc
==
NULL
)
return
next
;
};
return
NULL
;
}
lv_app_style_t
*
lv_app_get_style
(
void
)
{
return
&
app_style
;
...
...
@@ -349,6 +391,7 @@ static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_dispi_t * d
/*Create the app. list*/
else
{
app_list
=
lv_list_create
(
lv_scr_act
(),
NULL
);
lv_obj_set_hidden
(
app_list
,
true
);
lv_obj_set_style
(
app_list
,
&
app_style
.
app_list_style
);
lv_obj_set_opa
(
app_list
,
app_style
.
menu_opa
);
lv_obj_set_size
(
app_list
,
app_style
.
app_list_w
,
app_style
.
app_list_h
);
...
...
@@ -386,6 +429,7 @@ static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_dispi_t * d
lv_obj_set_opa
(
elem
,
app_style
.
menu_btn_opa
);
}
lv_obj_set_hidden
(
app_list
,
false
);
}
return
LV_ACTION_RES_OK
;
}
...
...
@@ -394,6 +438,10 @@ static lv_action_res_t lv_app_menu_elem_rel_action(lv_obj_t * app_elem_btn, lv_d
{
lv_app_dsc_t
*
dsc
=
lv_obj_get_free_p
(
app_elem_btn
);
/*Close the app list*/
lv_obj_del
(
app_list
);
app_list
=
NULL
;
lv_app_inst_t
*
app
=
lv_app_run
(
dsc
,
""
);
lv_app_sc_open
(
app
);
...
...
@@ -401,9 +449,6 @@ static lv_action_res_t lv_app_menu_elem_rel_action(lv_obj_t * app_elem_btn, lv_d
lv_obj_anim
(
app
->
sc
,
LV_ANIM_FADE
|
ANIM_IN
,
LV_APP_ANIM_SC
,
0
,
NULL
);
#endif
/*Close the app list*/
lv_obj_del
(
app_list
);
app_list
=
NULL
;
return
LV_ACTION_RES_INV
;
}
...
...
@@ -447,8 +492,6 @@ static lv_action_res_t lv_app_sc_rel_action(lv_obj_t * sc, lv_dispi_t * dispi)
lv_app_inst_t
*
app
=
lv_obj_get_free_p
(
sc
);
lv_app_win_open
(
app
);
app
->
dsc
->
win_open
(
app
,
app
->
win
);
/*Make an animation on window open*/
#if LV_APP_ANIM_WIN != 0 && LV_APP_ANIM_LEVEL != 0
...
...
@@ -521,7 +564,7 @@ static lv_action_res_t lv_app_win_close_action(lv_obj_t * close_btn, lv_dispi_t
lv_obj_t
*
win
=
lv_win_get_from_ctrl_btn
(
close_btn
);
lv_app_inst_t
*
app
=
lv_obj_get_free_p
(
win
);
lv_app_kb_close
();
lv_app_kb_close
(
false
);
#if LV_APP_ANIM_WIN != 0 && LV_APP_ANIM_LEVEL != 0
#if LV_APP_ANIM_LEVEL == 1
...
...
@@ -545,7 +588,7 @@ static lv_action_res_t lv_app_win_minim_action(lv_obj_t * close_btn, lv_dispi_t
lv_obj_t
*
win
=
lv_win_get_from_ctrl_btn
(
close_btn
);
lv_app_inst_t
*
app
=
lv_obj_get_free_p
(
win
);
lv_app_kb_close
();
lv_app_kb_close
(
false
);
/*Make an animation on window open*/
#if LV_APP_ANIM_WIN != 0 && LV_APP_ANIM_LEVEL != 0
...
...
@@ -607,6 +650,7 @@ static lv_action_res_t lv_app_win_minim_action(lv_obj_t * close_btn, lv_dispi_t
return
LV_ACTION_RES_OK
;
}
#if LV_APP_ANIM_LEVEL != 0 && LV_APP_ANIM_WIN != 0
static
void
lv_app_win_close_anim_cb
(
lv_obj_t
*
app_win
)
{
lv_app_inst_t
*
app
=
lv_obj_get_free_p
(
app_win
);
...
...
@@ -618,6 +662,7 @@ static void lv_app_win_minim_anim_cb(lv_obj_t * app_win)
lv_app_inst_t
*
app
=
lv_obj_get_free_p
(
app_win
);
lv_app_win_close
(
app
);
}
#endif
static
void
lv_app_init_icons
(
void
)
{
...
...
@@ -656,11 +701,6 @@ static void lv_app_init_style(void)
app_style
.
app_list_h
=
(
2
*
LV_VER_RES
)
/
3
;
app_style
.
sc_title_margin
=
2
*
LV_DOWNSCALE
;
/*Fonts*/
app_style
.
font_small
=
FONT_DEJAVU_20
;
app_style
.
font_medium
=
FONT_DEJAVU_30
;
app_style
.
font_large
=
FONT_DEJAVU_40
;
/*Opacity*/
app_style
.
menu_opa
=
OPA_80
;
app_style
.
menu_btn_opa
=
OPA_50
;
...
...
@@ -688,7 +728,7 @@ static void lv_app_init_style(void)
app_style
.
menu_btn_style
.
gcolor
[
LV_BTN_STATE_PR
]
=
COLOR_GRAY
;
lv_labels_get
(
LV_LABELS_BTN
,
&
app_style
.
menu_btn_label_style
);
app_style
.
menu_btn_label_style
.
font
=
app_style
.
font_large
;
app_style
.
menu_btn_label_style
.
font
=
LV_APP_FONT_LARGE
;
app_style
.
menu_btn_label_style
.
objs
.
color
=
COLOR_MAKE
(
0xd0
,
0xe0
,
0xf0
);
lv_imgs_get
(
LV_IMGS_DEF
,
&
app_style
.
menu_btn_img_style
);
...
...
@@ -736,7 +776,7 @@ static void lv_app_init_style(void)
app_style
.
sc_style
.
rects
.
bwidth
=
1
*
LV_DOWNSCALE
;
lv_labels_get
(
LV_LABELS_DEF
,
&
app_style
.
sc_title_style
);
app_style
.
sc_title_style
.
font
=
app_style
.
font_small
;
app_style
.
sc_title_style
.
font
=
LV_APP_FONT_SMALL
;
app_style
.
sc_title_style
.
objs
.
color
=
COLOR_MAKE
(
0x20
,
0x30
,
0x40
);
app_style
.
sc_title_style
.
mid
=
1
;
...
...
@@ -758,4 +798,6 @@ static void lv_app_init_style(void)
app_style
.
win_style
.
content
.
scrable_rects
.
objs
.
transp
=
1
;
}
#endif
/*LV_APP_ENABLE != 0*/
lv_app/lv_app.h
View file @
5459fc3c
...
...
@@ -11,6 +11,8 @@
*********************/
#include "lvgl/lvgl.h"
#if LV_APP_ENABLE != 0
/*********************
* DEFINES
*********************/
...
...
@@ -32,13 +34,12 @@ typedef enum
typedef
enum
{
LV_APP_EVENT_OPEN
,
LV_APP_EVENT_CLOSE
,
LV_APP_EVENT_SC_OPENED
,
LV_APP_EVENT_SC_CLOSED
,
LV_APP_EVENT_WIN_OPENED
,
LV_APP_EVENT_WIN_CLOSED
,
}
lv_app_event_t
;
LV_APP_COM_TYPE_STR
,
/*String data to process*/
LV_APP_COM_TYPE_BIN
,
/*Binary data as 'int32_t' array*/
LV_APP_COM_TYPE_SYS
,
/*System level event*/
LV_APP_COM_TYPE_LOG
,
/*String about an event to log*/
LV_APP_COM_TYPE_NOTE
,
/*String to display to the user as a notification*/
}
lv_app_com_type_t
;
struct
__LV_APP_DSC_T
;
...
...
@@ -60,7 +61,7 @@ typedef struct __LV_APP_DSC_T
lv_app_mode_t
mode
;
void
(
*
app_run
)(
lv_app_inst_t
*
,
const
char
*
);
void
(
*
app_close
)
(
lv_app_inst_t
*
);
void
(
*
event_read
)
(
lv_app_inst_t
*
,
lv_app_event
_t
);
void
(
*
com_rec
)
(
lv_app_inst_t
*
,
lv_app_inst_t
*
,
lv_app_com_type_t
,
void
*
,
uint32
_t
);
void
(
*
sc_open
)
(
lv_app_inst_t
*
,
lv_obj_t
*
);
void
(
*
sc_close
)
(
lv_app_inst_t
*
);
void
(
*
win_open
)
(
lv_app_inst_t
*
,
lv_obj_t
*
);
...
...
@@ -89,10 +90,6 @@ typedef struct {
cord_t
app_list_w
;
cord_t
app_list_h
;
cord_t
sc_title_margin
;
font_types_t
font_small
;
font_types_t
font_medium
;
font_types_t
font_large
;
}
lv_app_style_t
;
...
...
@@ -102,7 +99,7 @@ typedef struct {
void
lv_app_init
(
void
);
lv_app_inst_t
*
lv_app_run
(
const
lv_app_dsc_t
*
app_dsc
,
const
char
*
cstr
);
void
lv_app_close
(
lv_app_inst_t
*
app
);
void
lv_app_event_send
(
lv_app_inst_t
*
app
,
lv_app_event_t
event
);
uint16_t
lv_app_com_send
(
lv_app_inst_t
*
app_send
,
lv_app_com_type_t
type
,
void
*
data
,
uint32_t
len
);
lv_obj_t
*
lv_app_sc_open
(
lv_app_inst_t
*
app
);
void
lv_app_sc_close
(
lv_app_inst_t
*
app
);
lv_obj_t
*
lv_app_win_open
(
lv_app_inst_t
*
app
);
...
...
@@ -114,10 +111,14 @@ lv_app_style_t * lv_app_get_style(void);
void
lv_app_rename
(
lv_app_inst_t
*
app
,
const
char
*
name
);
void
lv_app_refr_style
(
void
);
lv_app_inst_t
*
lv_app_get_next_app
(
lv_app_inst_t
*
prev
,
lv_app_dsc_t
*
dsc
);
const
lv_app_dsc_t
*
lv_app_example_init
(
void
);
/**********************
* MACROS
**********************/
#endif
#endif
/*LV_APP_ENABLE != 0*/
#endif
/*LV_APP_H*/
lv_app/lv_app_sup.c
View file @
5459fc3c
...
...
@@ -6,7 +6,9 @@
/*********************
* INCLUDES
*********************/
#include <lvgl/lv_app/lv_app_sup.h>
#include "lv_app_sup.h"
#if LV_APP_ENABLE != 0
#include "../lv_objx/lv_btnm.h"
#include "../lv_objx/lv_ta.h"
...
...
@@ -30,14 +32,14 @@ static lv_obj_t * kb_btnm;
static
lv_obj_t
*
kb_win
;
static
lv_obj_t
*
kb_ta
;
static
const
char
*
kb_map_lc
[]
=
{
"
\00
6
1#"
,
"
\004
q"
,
"
\004
w"
,
"
\004
e"
,
"
\004
r"
,
"
\004
t"
,
"
\004
y"
,
"
\004
u"
,
"
\004
i"
,
"
\004
o"
,
"
\004
p"
,
"
\010
Del"
,
"
\n
"
,
"
\00
5
1#"
,
"
\004
q"
,
"
\004
w"
,
"
\004
e"
,
"
\004
r"
,
"
\004
t"
,
"
\004
y"
,
"
\004
u"
,
"
\004
i"
,
"
\004
o"
,
"
\004
p"
,
"
\007
Del"
,
"
\n
"
,
"
\007
ABC"
,
"
\004
a"
,
"
\004
s"
,
"
\004
d"
,
"
\004
f"
,
"
\004
g"
,
"
\004
h"
,
"
\004
j"
,
"
\004
k"
,
"
\004
l"
,
"
\010
Enter"
,
"
\n
"
,
"*"
,
"-"
,
"z"
,
"x"
,
"c"
,
"v"
,
"b"
,
"n"
,
"m"
,
"."
,
","
,
";"
,
"
\n
"
,
"
\002
Hide"
,
"
\002
Left"
,
"
\006
"
,
"
\002
Right"
,
"
\002
Ok"
,
""
};
static
const
char
*
kb_map_uc
[]
=
{
"
\00
6
1#"
,
"
\004
Q"
,
"
\004
W"
,
"
\004
E"
,
"
\004
R"
,
"
\004
T"
,
"
\004
Y"
,
"
\004
U"
,
"
\004
I"
,
"
\004
O"
,
"
\004
P"
,
"
\010
Del"
,
"
\n
"
,
"
\00
5
1#"
,
"
\004
Q"
,
"
\004
W"
,
"
\004
E"
,
"
\004
R"
,
"
\004
T"
,
"
\004
Y"
,
"
\004
U"
,
"
\004
I"
,
"
\004
O"
,
"
\004
P"
,
"
\007
Del"
,
"
\n
"
,
"
\007
abc"
,
"
\004
A"
,
"
\004
S"
,
"
\004
D"
,
"
\004
F"
,
"
\004
G"
,
"
\004
H"
,
"
\004
J"
,
"
\004
K"
,
"
\004
L"
,
"
\010
Enter"
,
"
\n
"
,
"*"
,
"/"
,
"Z"
,
"X"
,
"C"
,
"V"
,
"B"
,
"N"
,
"M"
,
"."
,
","
,
";"
,
"
\n
"
,
"
\002
Hide"
,
"
\002
Left"
,
"
\006
"
,
"
\002
Right"
,
"
\002
Ok"
,
""
...
...
@@ -79,6 +81,7 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t
kb_btnms
.
rects
.
opad
=
4
+
LV_DOWNSCALE
;
kb_btnms
.
rects
.
vpad
=
3
+
LV_DOWNSCALE
;
kb_btnms
.
rects
.
hpad
=
3
+
LV_DOWNSCALE
;
kb_btnms
.
rects
.
round
=
0
;
kb_inited
=
true
;
}
...
...
@@ -94,10 +97,16 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t
kb_btnm
=
lv_btnm_create
(
lv_scr_act
(),
NULL
);
lv_obj_set_size
(
kb_btnm
,
LV_HOR_RES
,
LV_VER_RES
/
2
);
lv_obj_align
(
kb_btnm
,
NULL
,
LV_ALIGN_IN_BOTTOM_MID
,
0
,
0
);
lv_obj_set_style
(
kb_btnm
,
&
kb_btnms
);
lv_btnm_set_cb
(
kb_btnm
,
lv_app_kb_action
);
if
(
mode
&
LV_APP_KB_MODE_TXT
)
lv_btnm_set_map
(
kb_btnm
,
kb_map_lc
);
else
if
(
mode
&
LV_APP_KB_MODE_NUM
)
lv_btnm_set_map
(
kb_btnm
,
kb_map_num
);
if
(
mode
&
LV_APP_KB_MODE_TXT
)
{
kb_btnms
.
labels
.
font
=
LV_APP_FONT_MEDIUM
;
lv_btnm_set_map
(
kb_btnm
,
kb_map_lc
);
}
else
if
(
mode
&
LV_APP_KB_MODE_NUM
)
{
kb_btnms
.
labels
.
font
=
LV_APP_FONT_LARGE
;
lv_btnm_set_map
(
kb_btnm
,
kb_map_num
);
}
lv_obj_set_style
(
kb_btnm
,
&
kb_btnms
);
kb_win
=
lv_app_get_win_from_obj
(
kb_ta
);
lv_obj_set_height
(
kb_win
,
LV_VER_RES
/
2
);
...
...
@@ -140,63 +149,74 @@ void lv_app_kb_close(bool ok)
kb_ta
=
NULL
;
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Called when a button of 'kb_btnm' is released
* @param btnm pointer to 'kb_btnm'
* @param i the index of the released button from the current btnm map
* @return LV_ACTION_RES_INV if the btnm is deleted else LV_ACTION_RES_OK
*/
static
lv_action_res_t
lv_app_kb_action
(
lv_obj_t
*
btnm
,
uint16_t
i
)
{
const
char
**
map
=
lv_btnm_get_map
(
btnm
);
const
char
*
txt
=
map
[
i
];
if
(
txt
[
0
]
<=
'\011'
)
txt
++
;
if
(
strcmp
(
txt
,
"abc"
)
==
0
)
{
lv_btnm_set_map
(
btnm
,
kb_map_lc
);
}
else
if
(
strcmp
(
txt
,
"ABC"
)
==
0
)
{
lv_btnm_set_map
(
btnm
,
kb_map_uc
);
}
else
if
(
strcmp
(
txt
,
"1#"
)
==
0
)
{
lv_btnm_set_map
(
btnm
,
kb_map_spec
);
}
else
if
(
strcmp
(
txt
,
"Enter"
)
==
0
)
{
lv_ta_add_char
(
kb_ta
,
'\n'
);
}
else
if
(
strcmp
(
txt
,
"Left"
)
==
0
)
{
lv_ta_cursor_left
(
kb_ta
);
}
else
if
(
strcmp
(
txt
,
"Right"
)
==
0
)
{
lv_ta_cursor_right
(
kb_ta
);
}
else
if
(
strcmp
(
txt
,
"Del"
)
==
0
)
{
lv_ta_del
(
kb_ta
);
}
else
if
(
strcmp
(
txt
,
"+/-"
)
==
0
)
{
uint16_t
cur
=
lv_ta_get_cursor_pos
(
kb_ta
);
const
char
*
ta_txt
=
lv_ta_get_txt
(
kb_ta
);
if
(
ta_txt
[
0
]
==
'-'
)
{
lv_ta_set_cursor_pos
(
kb_ta
,
1
);
lv_ta_del
(
kb_ta
);
lv_ta_add_char
(
kb_ta
,
'+'
);
lv_ta_set_cursor_pos
(
kb_ta
,
cur
);
}
else
if
(
ta_txt
[
0
]
==
'+'
)
{
lv_ta_set_cursor_pos
(
kb_ta
,
1
);
lv_ta_del
(
kb_ta
);
lv_ta_add_char
(
kb_ta
,
'-'
);
lv_ta_set_cursor_pos
(
kb_ta
,
cur
);
}
else
{
lv_ta_set_cursor_pos
(
kb_ta
,
0
);
lv_ta_add_char
(
kb_ta
,
'-'
);
lv_ta_set_cursor_pos
(
kb_ta
,
cur
+
1
);
}
}
else
if
(
strcmp
(
txt
,
"Hide"
)
==
0
)
{
lv_app_kb_close
(
false
);
return
LV_ACTION_RES_INV
;
}
else
if
(
strcmp
(
txt
,
"Ok"
)
==
0
)
{
lv_app_kb_close
(
true
);
return
LV_ACTION_RES_INV
;
}
else
{
lv_ta_add_text
(
kb_ta
,
txt
);
}
const
char
**
map
=
lv_btnm_get_map
(
btnm
);
const
char
*
txt
=
map
[
i
];
/*Ignore the unit size number of the text*/
if
(
txt
[
0
]
<=
'\011'
)
txt
++
;
/*Do the corresponding action according to the text of the button*/
if
(
strcmp
(
txt
,
"abc"
)
==
0
)
{
lv_btnm_set_map
(
btnm
,
kb_map_lc
);
}
else
if
(
strcmp
(
txt
,
"ABC"
)
==
0
)
{
lv_btnm_set_map
(
btnm
,
kb_map_uc
);
}
else
if
(
strcmp
(
txt
,
"1#"
)
==
0
)
{
lv_btnm_set_map
(
btnm
,
kb_map_spec
);
}
else
if
(
strcmp
(
txt
,
"Enter"
)
==
0
)
{
lv_ta_add_char
(
kb_ta
,
'\n'
);
}
else
if
(
strcmp
(
txt
,
"Left"
)
==
0
)
{
lv_ta_cursor_left
(
kb_ta
);
}
else
if
(
strcmp
(
txt
,
"Right"
)
==
0
)
{
lv_ta_cursor_right
(
kb_ta
);
}
else
if
(
strcmp
(
txt
,
"Del"
)
==
0
)
{
lv_ta_del
(
kb_ta
);
}
else
if
(
strcmp
(
txt
,
"+/-"
)
==
0
)
{
uint16_t
cur
=
lv_ta_get_cursor_pos
(
kb_ta
);
const
char
*
ta_txt
=
lv_ta_get_txt
(
kb_ta
);
if
(
ta_txt
[
0
]
==
'-'
)
{
lv_ta_set_cursor_pos
(
kb_ta
,
1
);
lv_ta_del
(
kb_ta
);
lv_ta_add_char
(
kb_ta
,
'+'
);
lv_ta_set_cursor_pos
(
kb_ta
,
cur
);
}
else
if
(
ta_txt
[
0
]
==
'+'
)
{
lv_ta_set_cursor_pos
(
kb_ta
,
1
);
lv_ta_del
(
kb_ta
);
lv_ta_add_char
(
kb_ta
,
'-'
);
lv_ta_set_cursor_pos
(
kb_ta
,
cur
);
}
else
{
lv_ta_set_cursor_pos
(
kb_ta
,
0
);
lv_ta_add_char
(
kb_ta
,
'-'
);
lv_ta_set_cursor_pos
(
kb_ta
,
cur
+
1
);
}
}
else
if
(
strcmp
(
txt
,
"Hide"
)
==
0
)
{
lv_app_kb_close
(
false
);
return
LV_ACTION_RES_INV
;
}
else
if
(
strcmp
(
txt
,
"Ok"
)
==
0
)
{
lv_app_kb_close
(
true
);
return
LV_ACTION_RES_INV
;
}
else
{
lv_ta_add_text
(
kb_ta
,
txt
);
}
#if LV_APP_ANIM_LEVEL != 0
lv_page_focus
(
lv_win_get_content
(
kb_win
),
kb_ta
,
true
);
lv_page_focus
(
lv_win_get_content
(
kb_win
),
kb_ta
,
true
);
#else
lv_page_focus
(
lv_win_get_content
(
kb_win
),
kb_ta
,
false
);
lv_page_focus
(
lv_win_get_content
(
kb_win
),
kb_ta
,
false
);
#endif
return
LV_ACTION_RES_OK
;
return
LV_ACTION_RES_OK
;
}
/**********************
* STATIC FUNCTIONS
**********************/
#endif
/*LV_APP_ENABLE != 0*/
lv_app/lv_app_sup.h
View file @
5459fc3c
...
...
@@ -10,6 +10,7 @@
* INCLUDES
*********************/
#include "lv_app.h"
#if LV_APP_ENABLE != 0
/*********************
* DEFINES
...
...
@@ -33,5 +34,6 @@ void lv_app_kb_close(bool ok);
/**********************
* MACROS
**********************/
#endif
/*LV_APP_ENABLE != 0*/
#endif
/*LV_APP_SUP_H*/
lv_app/lv_icon/x2/img_add.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_ADD != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_ADD != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_battery_empty.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_BATTERY_EMPTY != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_BATTERY_EMPTY != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_battery_full.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_BATTERY_FULL != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_BATTERY_FULL != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_battery_half.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_BATTERY_HALF != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_BATTERY_HALF != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_bubble.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_BUBBLE != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_BUBBLE != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_calendar.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_CALENDAR != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_CALENDAR != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_clock.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_CLOCK != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_CLOCK != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_close.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_CLOSE != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_CLOSE != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_down.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_DOWN != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_DOWN != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_driver.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_DRIVER != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_DRIVER != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_eject.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_EJECT != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_EJECT != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_folder.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_FOLDER != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_FOLDER != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_image.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_IMAGE != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_IMAGE != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_left.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_LEFT != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_LEFT != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_music.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_MUSIC != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_MUSIC != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_ok.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_OK != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_OK != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_play.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_PLAY != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_PLAY != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_right.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_RIGHT != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_RIGHT != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_settings.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_SETTINGS != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_SETTINGS != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_shut_down.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_SHUT_DOWN != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_SHUT_DOWN != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_star.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_STAR != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_STAR != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_up.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_UP != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_UP != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_user.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_USER != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_USER != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_video.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_VIDEO != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_VIDEO != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_app/lv_icon/x2/img_volume.c
View file @
5459fc3c
#include "img_conf.h"
#include "lv_conf.h"
#if USE_IMG_VOLUME != 0 ||
(LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
#if USE_IMG_VOLUME != 0 ||
LV_APP_USE_INTERNAL_ICONS == 2
#include <stdint.h>
#include "misc/others/color.h"
...
...
lv_appx/lv_app_example.c
View file @
5459fc3c
...
...
@@ -6,8 +6,11 @@
/*********************
* INCLUDES
*********************/
#include <lvgl/lv_app/lv_app_sup.h>
#include "lv_app_example.h"
#if LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0
#include "../lv_app/lv_app_sup.h"
#include "misc/os/ptask.h"
#include <stdio.h>
/*********************
...
...
@@ -22,31 +25,33 @@
typedef
struct
{
const
char
*
txt
;
}
app_data_t
;
}
my_
app_data_t
;
/*Application specific data a window of this application*/
typedef
struct
{
}
win_data_t
;
}
my_
win_data_t
;
/*Application specific data for a shortcut of this application*/
typedef
struct
{
}
sc_data_t
;
lv_obj_t
*
label
;
}
my_
sc_data_t
;
/**********************
* STATIC PROTOTYPES
**********************/
static
void
my_app_run
(
lv_app_inst_t
*
app
,
const
char
*
cstr
);
static
void
my_app_close
(
lv_app_inst_t
*
app
);
static
void
my_
event_read
(
lv_app_inst_t
*
app
,
lv_app_event_t
event
);
static
void
my_
com_rec
(
lv_app_inst_t
*
app_rec
,
lv_app_inst_t
*
app_sender
,
lv_app_com_type_t
type
,
void
*
data
,
uint32_t
len
);
static
void
my_sc_open
(
lv_app_inst_t
*
app
,
lv_obj_t
*
sc
);
static
void
my_sc_close
(
lv_app_inst_t
*
app
);
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
task
(
void
);
/**********************
* STATIC VARIABLES
**********************/
...
...
@@ -56,14 +61,14 @@ static lv_app_dsc_t my_app_dsc =
.
mode
=
LV_APP_MODE_NONE
,
.
app_run
=
my_app_run
,
.
app_close
=
my_app_close
,
.
event_read
=
my_event_read
,
.
com_rec
=
my_com_rec
,
.
win_open
=
my_win_open
,
.
win_close
=
my_win_close
,
.
sc_open
=
my_sc_open
,
.
sc_close
=
my_sc_close
,
.
app_data_size
=
sizeof
(
app_data_t
),
.
sc_data_size
=
sizeof
(
sc_data_t
),
.
win_data_size
=
sizeof
(
win_data_t
),
.
app_data_size
=
sizeof
(
my_
app_data_t
),
.
sc_data_size
=
sizeof
(
my_
sc_data_t
),
.
win_data_size
=
sizeof
(
my_
win_data_t
),
};
/**********************
...
...
@@ -76,6 +81,8 @@ static lv_app_dsc_t my_app_dsc =
const
lv_app_dsc_t
*
lv_app_example_init
(
void
)
{
ptask_create
(
task
,
200
,
PTASK_PRIO_MID
);
return
&
my_app_dsc
;
}
...
...
@@ -97,7 +104,7 @@ static void my_app_run(lv_app_inst_t * app, const char * cstr)
}
/*Initialize the application*/
((
app_data_t
*
)
app
->
app_data
)
->
txt
=
cstr
;
/*Save the create string*/
((
my_
app_data_t
*
)
app
->
app_data
)
->
txt
=
cstr
;
/*Save the create string*/
char
buf
[
256
];
sprintf
(
buf
,
"%s - %s"
,
my_app_dsc
.
name
,
cstr
);
lv_app_rename
(
app
,
buf
);
...
...
@@ -115,13 +122,22 @@ static void my_app_close(lv_app_inst_t * app)
}
/**
* Publish an event.
* @param app pointer to an application which publishes the event
* @param event an event from 'lv_app_event_t' enum
* Read the data have been sent to this application
* @param app_rec pointer to an application which is receiving the message
* @param app_send pointer to an application which sent the message
* @param type type of data from 'lv_app_com_type_t' enum
* @param data pointer to the sent data
* @param len length of 'data' in bytes
*/
static
void
my_event_read
(
lv_app_inst_t
*
app
,
lv_app_event_t
event
)
static
void
my_com_rec
(
lv_app_inst_t
*
app_rec
,
lv_app_inst_t
*
app_send
,
lv_app_com_type_t
type
,
void
*
data
,
uint32_t
len
)
{
if
(
type
==
LV_APP_COM_TYPE_STR
)
{
/*data: string*/
}
else
if
(
type
==
LV_APP_COM_TYPE_BIN
)
{
/*data: array of 'int32_t' */
}
}
/**
...
...
@@ -132,11 +148,12 @@ static void my_event_read(lv_app_inst_t * app, lv_app_event_t event)
*/
static
void
my_sc_open
(
lv_app_inst_t
*
app
,
lv_obj_t
*
sc
)
{
lv_obj_t
*
label
;
label
=
lv_label_create
(
sc
,
NULL
);
lv_label_set_text
(
label
,
((
app_data_t
*
)
app
->
app_data
)
->
txt
);
lv_obj_set_style
(
label
,
lv_labels_get
(
LV_LABELS_BTN
,
NULL
));
lv_obj_align
(
label
,
NULL
,
LV_ALIGN_CENTER
,
0
,
0
);
my_sc_data_t
*
sc_data
=
app
->
sc_data
;
sc_data
->
label
=
lv_label_create
(
sc
,
NULL
);
lv_label_set_text
(
sc_data
->
label
,
((
my_app_data_t
*
)
app
->
app_data
)
->
txt
);
lv_obj_set_style
(
sc_data
->
label
,
lv_labels_get
(
LV_LABELS_DEF
,
NULL
));
lv_obj_align
(
sc_data
->
label
,
NULL
,
LV_ALIGN_CENTER
,
0
,
0
);
}
/**
...
...
@@ -157,24 +174,23 @@ lv_action_res_t kb_open(lv_obj_t * ta, lv_dispi_t * dispi);
*/
static
void
my_win_open
(
lv_app_inst_t
*
app
,
lv_obj_t
*
win
)
{
my_sc_data_t
*
win_data
=
app
->
win_data
;
lv_obj_t
*
label
;
label
=
lv_label_create
(
win
,
NULL
);
lv_label_set_text
(
label
,
((
app_data_t
*
)
app
->
app_data
)
->
txt
);
win_data
->
label
=
lv_label_create
(
win
,
NULL
);
lv_label_set_text
(
win_data
->
label
,
((
my_app_data_t
*
)
app
->
app_data
)
->
txt
);
lv_obj_t
*
ta
;
ta
=
lv_ta_create
(
win
,
NULL
);
lv_obj_set_size_us
(
ta
,
200
,
100
);
lv_obj_set_pos_us
(
ta
,
20
,
200
);
// lv_rect_set_fit(ta, false, true);
lv_page_set_rel_action
(
ta
,
kb_open
);
}
lv_action_res_t
kb_open
(
lv_obj_t
*
ta
,
lv_dispi_t
*
dispi
)
{
lv_app_kb_open
(
ta
,
LV_APP_KB_MODE_
NUM
,
NULL
,
NULL
);
lv_app_kb_open
(
ta
,
LV_APP_KB_MODE_
TXT
,
NULL
,
NULL
);
return
LV_ACTION_RES_OK
;
}
...
...
@@ -188,3 +204,38 @@ static void my_win_close(lv_app_inst_t * app)
}
static
void
task
(
void
)
{
return
;
dm_defrag
();
dm_mon_t
mon
;
dm_monitor
(
&
mon
);
lv_app_inst_t
*
app
;
app
=
lv_app_get_next_app
(
NULL
,
&
my_app_dsc
);
while
(
app
!=
NULL
)
{
char
buf
[
256
];
sprintf
(
buf
,
"Mem. total: %d
\n
Mem. free: %d (%d)
\n
Frag: %d%%"
,
DM_MEM_SIZE
,
mon
.
size_free
,
mon
.
size_free
*
100
/
DM_MEM_SIZE
,
mon
.
pct_frag
);
if
(
app
->
sc_data
!=
NULL
)
{
my_sc_data_t
*
sc_data
=
app
->
sc_data
;
lv_label_set_text
(
sc_data
->
label
,
buf
);
lv_obj_align
(
sc_data
->
label
,
NULL
,
LV_ALIGN_CENTER
,
0
,
0
);
}
if
(
app
->
win_data
!=
NULL
)
{
my_sc_data_t
*
win_data
=
app
->
win_data
;
lv_label_set_text
(
win_data
->
label
,
buf
);
// lv_obj_align(win_data->label, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
}
app
=
lv_app_get_next_app
(
app
,
&
my_app_dsc
);
}
}
#endif
/*LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0*/
lv_appx/lv_app_example.h
View file @
5459fc3c
...
...
@@ -11,6 +11,8 @@
*********************/
#include "lvgl/lv_app/lv_app.h"
#if LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0
/*********************
* DEFINES
*********************/
...
...
@@ -18,6 +20,10 @@
/**********************
* TYPEDEFS
**********************/
typedef
struct
{
}
lv_app_example_conf_t
;
/**********************
* GLOBAL PROTOTYPES
...
...
@@ -27,4 +33,6 @@
* MACROS
**********************/
#endif
/*LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0*/
#endif
/* LV_APP_EXAMPLE */
lv_draw/lv_draw_vbasic.c
View file @
5459fc3c
...
...
@@ -23,10 +23,6 @@
/**********************
* STATIC PROTOTYPES
**********************/
static
void
lv_put_vpx
(
point_t
*
point_p
,
const
area_t
*
mask_p
,
color_t
color
,
opa_t
opa
);
static
bool
lv_vletter_get_px
(
const
font_t
*
font_p
,
uint8_t
letter
,
cord_t
x
,
cord_t
y
);
/**********************
* STATIC VARIABLES
...
...
@@ -113,27 +109,87 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
color_t
color
,
opa_t
opa
)
{
if
(
font_p
==
NULL
)
return
;
uint8_t
w
=
font_get_width
(
font_p
,
letter
);
uint8_t
h
=
font_get_height
(
font_p
);
uint8_t
letter_w
=
font_get_width
(
font_p
,
letter
);
uint8_t
letter_h
=
font_get_height
(
font_p
);
const
uint8_t
*
map_p
=
font_get_bitmap
(
font_p
,
letter
);
if
(
map_p
==
NULL
)
return
;
/*If the letter is completely out of mask don't draw it */
if
(
pos_p
->
x
+
w
<
mask_p
->
x1
||
pos_p
->
x
>
mask_p
->
x2
||
pos_p
->
y
+
h
<
mask_p
->
y1
||
pos_p
->
y
>
mask_p
->
y2
)
return
;
if
(
pos_p
->
x
+
letter_
w
<
mask_p
->
x1
||
pos_p
->
x
>
mask_p
->
x2
||
pos_p
->
y
+
letter_
h
<
mask_p
->
y1
||
pos_p
->
y
>
mask_p
->
y2
)
return
;
lv_vdb_t
*
vdb_p
=
lv_vdb_get
();
cord_t
vdb_width
=
area_get_width
(
&
vdb_p
->
vdb_area
);
color_t
*
vdb_buf_tmp
=
vdb_p
->
buf
;
cord_t
col
,
row
;
point_t
act_point
;
uint8_t
col_bit
;
uint8_t
col_byte_cnt
;
cord_t
col_start
=
pos_p
->
x
>=
mask_p
->
x1
?
0
:
mask_p
->
x1
-
pos_p
->
x
;
cord_t
col_end
=
pos_p
->
x
+
letter_w
<=
mask_p
->
x2
?
letter_w
:
mask_p
->
x2
-
pos_p
->
x
+
1
;
cord_t
row_start
=
pos_p
->
y
>=
mask_p
->
y1
?
0
:
mask_p
->
y1
-
pos_p
->
y
;
cord_t
row_end
=
pos_p
->
y
+
letter_h
<=
mask_p
->
y2
?
letter_h
:
mask_p
->
y2
-
pos_p
->
y
+
1
;
/*Set a pointer on VDB to the first pixel of the letter*/
vdb_buf_tmp
+=
((
pos_p
->
y
-
vdb_p
->
vdb_area
.
y1
)
*
vdb_width
)
+
pos_p
->
x
-
vdb_p
->
vdb_area
.
x1
;
/*If the letter is partially out of mask the move there on VDB*/
vdb_buf_tmp
+=
(
row_start
*
vdb_width
)
+
col_start
;
/*Move on the map too*/
#if LV_UPSCALE_FONT == 0 || LV_DOWNSCALE == 1
map_p
+=
(
row_start
*
font_p
->
width_byte
)
+
(
col_start
>>
3
);
#elif LV_DOWNSCALE == 2
map_p
+=
((
row_start
>>
1
)
*
font_p
->
width_byte
)
+
((
col_start
>>
1
)
>>
3
);
#elif LV_DOWNSCALE == 4
map_p
+=
((
row_start
>>
2
)
*
font_p
->
width_byte
)
+
((
col_start
>>
2
)
>>
3
);
#endif
for
(
row
=
0
;
row
<
h
;
row
++
)
{
for
(
col
=
0
;
col
<
w
;
col
++
)
{
act_point
.
x
=
pos_p
->
x
+
col
;
act_point
.
y
=
pos_p
->
y
+
row
;
for
(
row
=
row_start
;
row
<
row_end
;
row
++
)
{
col_byte_cnt
=
0
;
col_bit
=
7
-
((
col_start
/
2
)
%
8
)
;
for
(
col
=
col_start
;
col
<
col_end
;
col
++
)
{
if
(
lv_vletter_get_px
(
font_p
,
letter
,
col
,
row
))
{
lv_put_vpx
(
&
act_point
,
mask_p
,
color
,
opa
);
if
((
*
map_p
&
(
1
<<
col_bit
))
!=
0
)
{
if
(
opa
==
OPA_COVER
)
*
vdb_buf_tmp
=
color
;
else
*
vdb_buf_tmp
=
color_mix
(
color
,
*
vdb_buf_tmp
,
opa
);
}
vdb_buf_tmp
++
;
/*Use a col. more times depending on LV_UPSCALE_FONT*/
#if LV_UPSCALE_FONT == 0 || LV_DOWNSCALE == 1
/*Use all cols.*/
#elif LV_DOWNSCALE == 2
if
((
col
&
0x01
)
==
0
)
#elif LV_DOWNSCALE == 4
if
((
col
&
0x03
)
==
0
)
#endif
{
if
(
col_bit
!=
0
)
col_bit
--
;
else
{
col_bit
=
7
;
col_byte_cnt
++
;
map_p
++
;
}
}
}
/*Use a row more times depending on LV_UPSCALE_FONT*/
#if LV_UPSCALE_FONT == 0 || LV_DOWNSCALE == 1
map_p
+=
font_p
->
width_byte
-
col_byte_cnt
;
#elif LV_DOWNSCALE == 2
if
((
row
&
0x01
)
==
0
)
map_p
+=
font_p
->
width_byte
-
col_byte_cnt
;
/*Next row in the map*/
else
map_p
-=
col_byte_cnt
;
/*Reset the row*/
#elif LV_DOWNSCALE == 4
if
((
row
&
0x03
)
==
0
)
map_p
+=
font_p
->
width_byte
-
col_byte_cnt
;
/*Next row in the map*/
else
map_p
-=
col_byte_cnt
;
/*Reset the row*/
#endif
vdb_buf_tmp
+=
vdb_width
-
(
col_end
-
col_start
);
/*Next row in VDB*/
}
}
...
...
@@ -312,85 +368,6 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
* STATIC FUNCTIONS
**********************/
/**
* Put a pixel into the Virtual Dispaly Buffer
* @param x x coordinate of the pixel
* @param y y coordinate of the pixel
* @param mask_p the pixel will be drawn on this area
* @param color color of the pixel
* @param opa opacity of the pixel
*/
static
void
lv_put_vpx
(
point_t
*
point_p
,
const
area_t
*
mask_p
,
color_t
color
,
opa_t
opa
)
{
if
(
opa
==
OPA_TRANSP
)
return
;
bool
point_ok
;
lv_vdb_t
*
vdb_p
=
lv_vdb_get
();
/*The point is on vdb?*/
point_ok
=
area_is_point_on
(
mask_p
,
point_p
);
/*If there are common part of the three area then draw to the vdb*/
if
(
point_ok
==
false
)
return
;
point_t
vdb_rel_point
;
/*Stores relative coordinates on vdb*/
vdb_rel_point
.
x
=
point_p
->
x
-
vdb_p
->
vdb_area
.
x1
;
vdb_rel_point
.
y
=
point_p
->
y
-
vdb_p
->
vdb_area
.
y1
;
color_t
*
vdb_buf_tmp
=
vdb_p
->
buf
;
uint32_t
vdb_width
=
vdb_p
->
vdb_area
.
x2
-
vdb_p
->
vdb_area
.
x1
+
1
;
/*Move the vdb_tmp to the point*/
vdb_buf_tmp
+=
vdb_width
*
vdb_rel_point
.
y
+
vdb_rel_point
.
x
;
if
(
opa
==
OPA_COVER
)
*
vdb_buf_tmp
=
color
;
else
*
vdb_buf_tmp
=
color_mix
(
color
,
*
vdb_buf_tmp
,
opa
);
}
/**
* Get a pixel from a letter
* @param font_p pointer to a font
* @param letter a letter
* @param x x coordinate of the pixel to get
* @param y y coordinate of the pixel to get
* @return true: pixel is set, false: pixel is clear
*/
static
bool
lv_vletter_get_px
(
const
font_t
*
font_p
,
uint8_t
letter
,
cord_t
x
,
cord_t
y
)
{
uint8_t
w
=
font_get_width
(
font_p
,
letter
);
uint8_t
h
=
font_get_height
(
font_p
);
const
uint8_t
*
map_p
=
font_get_bitmap
(
font_p
,
letter
);
if
(
map_p
==
NULL
)
return
NULL
;
if
(
x
<
0
)
x
=
0
;
if
(
y
<
0
)
x
=
0
;
if
(
x
>=
w
)
x
=
w
-
1
;
if
(
y
>=
h
)
y
=
h
-
1
;
#if LV_UPSCALE_FONT != 0
#if LV_DOWNSCALE == 1
/*Do nothing*/
#elif LV_DOWNSCALE == 2
x
=
x
>>
1
;
y
=
y
>>
1
;
#elif LV_DOWNSCALE == 4
x
=
x
>>
2
;
y
=
y
>>
2
;
#else
#error "LV: not supported LV_DOWNSCALE value"
#endif
#endif
/*LV_UPSCALE_FONT == 0*/
map_p
+=
(
uint32_t
)
y
*
font_p
->
width_byte
;
/*Go to the corresponding row of the map*/
map_p
+=
(
x
>>
3
);
/*Go to he corresponding col of the map*/
/*Get the corresponding col within a byte*/
uint8_t
map_byte
=
*
map_p
;
uint8_t
col_sub
=
7
-
(
x
%
8
);
if
((
map_byte
&
(
1
<<
col_sub
))
==
0
)
return
false
;
else
return
true
;
}
#endif
...
...
lv_misc/font.h
View file @
5459fc3c
...
...
@@ -22,28 +22,28 @@
typedef
enum
{
#if USE_FONT_DEJAVU_8
#if USE_FONT_DEJAVU_8
!= 0
FONT_DEJAVU_8
,
#endif
#if USE_FONT_DEJAVU_10
#if USE_FONT_DEJAVU_10
!= 0
FONT_DEJAVU_10
,
#endif
#if USE_FONT_DEJAVU_14
#if USE_FONT_DEJAVU_14
!= 0
FONT_DEJAVU_14
,
#endif
#if USE_FONT_DEJAVU_20
#if USE_FONT_DEJAVU_20
!= 0
FONT_DEJAVU_20
,
#endif
#if USE_FONT_DEJAVU_30
#if USE_FONT_DEJAVU_30
!= 0
FONT_DEJAVU_30
,
#endif
#if USE_FONT_DEJAVU_40
#if USE_FONT_DEJAVU_40
!= 0
FONT_DEJAVU_40
,
#endif
#if USE_FONT_DEJAVU_60
#if USE_FONT_DEJAVU_60
!= 0
FONT_DEJAVU_60
,
#endif
#if USE_FONT_DEJAVU_80
#if USE_FONT_DEJAVU_80
!= 0
FONT_DEJAVU_80
,
#endif
FONT_TYPE_NUM
,
...
...
lv_misc/fonts/dejavu_20.c
View file @
5459fc3c
...
...
@@ -1958,7 +1958,7 @@ static const uint8_t dejavu_20_bitmaps[8960] =
0x36
,
0x00
,
// --OO-OO--.......
0x22
,
0x00
,
// --O---O--.......
0x63
,
0x00
,
// -OO---OO-.......
0x
1
0
,
0x10
,
// O-------O.......
0x
8
0
,
0x10
,
// O-------O.......
0x00
,
0x00
,
// ---------.......
0x00
,
0x00
,
// ---------.......
0x00
,
0x00
,
// ---------.......
...
...
lv_obj/lv_dispi.c
View file @
5459fc3c
...
...
@@ -259,7 +259,7 @@ static void dispi_proc_press(lv_dispi_t * dispi_p)
/*If there is active object and it can be dragged run the drag*/
if
(
dispi_p
->
act_obj
!=
NULL
)
{
dispi_p
->
act_obj
->
signal_f
(
dispi_p
->
act_obj
,
LV_SIGNAL_PRESSING
,
dispi_p
);
dispi_drag
(
dispi_p
);
/*If there is no drag then check for long press time*/
...
...
lv_obj/lv_dispi.h
View file @
5459fc3c
...
...
@@ -38,8 +38,8 @@ typedef struct
typedef
enum
{
LV_ACTION_RES_OK
=
0
,
LV_ACTION_RES_
INV
=
0
,
LV_ACTION_RES_INV
=
0
,
LV_ACTION_RES_
OK
,
}
lv_action_res_t
;
typedef
lv_action_res_t
(
*
lv_action_t
)
(
struct
__LV_OBJ_T
*
obj
,
lv_dispi_t
*
dispi
);
...
...
lv_obj/lv_obj.c
View file @
5459fc3c
...
...
@@ -35,6 +35,7 @@
**********************/
static
void
lv_obj_pos_child_refr
(
lv_obj_t
*
obj
,
cord_t
x_diff
,
cord_t
y_diff
);
static
void
lv_style_refr_core
(
void
*
style_p
,
lv_obj_t
*
obj
);
static
void
lv_obj_del_child
(
lv_obj_t
*
obj
);
static
bool
lv_obj_design
(
lv_obj_t
*
obj
,
const
area_t
*
mask_p
,
lv_design_mode_t
mode
);
/**********************
...
...
@@ -95,6 +96,12 @@ void lv_init(void)
/*Init the display input handling*/
lv_dispi_init
();
#endif
/*Initialize the application level*/
#if LV_APP_ENABLE != 0
lv_app_init
();
#endif
}
/**
...
...
@@ -290,7 +297,7 @@ void lv_obj_del(lv_obj_t * obj)
i_next
=
ll_get_next
(
&
(
obj
->
child_ll
),
i
);
/*Call the recursive del to the child too*/
lv_obj_del
(
i
);
lv_obj_del
_child
(
i
);
/*Set i to the next node*/
i
=
i_next
;
...
...
@@ -1481,4 +1488,43 @@ static void lv_style_refr_core(void * style_p, lv_obj_t * obj)
}
}
/**
* Called by 'lv_obj_del' to delete the children objects
* @param obj pointer to an object (all of its children will be deleted)
*/
static
void
lv_obj_del_child
(
lv_obj_t
*
obj
)
{
lv_obj_t
*
i
;
lv_obj_t
*
i_next
;
i
=
ll_get_head
(
&
(
obj
->
child_ll
));
while
(
i
!=
NULL
)
{
/*Get the next object before delete this*/
i_next
=
ll_get_next
(
&
(
obj
->
child_ll
),
i
);
/*Call the recursive del to the child too*/
lv_obj_del_child
(
i
);
/*Set i to the next node*/
i
=
i_next
;
}
/*Remove the animations from this object*/
anim_del
(
obj
,
NULL
);
/*Remove the object from parent's children list*/
lv_obj_t
*
par
=
lv_obj_get_parent
(
obj
);
ll_rem
(
&
(
par
->
child_ll
),
obj
);
/* All children deleted.
* Now clean up the object specific data*/
obj
->
signal_f
(
obj
,
LV_SIGNAL_CLEANUP
,
NULL
);
/*Delete the base objects*/
if
(
obj
->
ext
!=
NULL
)
dm_free
(
obj
->
ext
);
if
(
obj
->
style_iso
!=
0
)
dm_free
(
obj
->
style_p
);
dm_free
(
obj
);
/*Free the object itself*/
}
lv_obj/lv_refr.c
View file @
5459fc3c
...
...
@@ -30,8 +30,8 @@ typedef struct
* STATIC PROTOTYPES
**********************/
static
void
lv_refr_task
(
void
);
static
void
lv_refr_join_area
(
lv_join_t
*
area_a
,
uint32_t
inv_num
);
static
void
lv_refr_areas
(
lv_join_t
*
area_a
,
uint32_t
area_num
);
static
void
lv_refr_join_area
(
void
);
static
void
lv_refr_areas
(
void
);
#if LV_VDB_SIZE == 0
static
void
lv_refr_area_no_vdb
(
const
area_t
*
area_p
);
#else
...
...
@@ -45,8 +45,8 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p);
/**********************
* STATIC VARIABLES
**********************/
fifo_t
fifo_inv
;
area_t
fifo_inv_buf
[
LV_INV_FIFO_SIZE
]
;
lv_join_t
inv_buf
[
LV_INV_FIFO_SIZE
]
;
uint16_t
inv_buf_p
;
/**********************
* MACROS
...
...
@@ -61,8 +61,9 @@ area_t fifo_inv_buf[LV_INV_FIFO_SIZE];
*/
void
lv_refr_init
(
void
)
{
fifo_init
(
&
fifo_inv
,
fifo_inv_buf
,
sizeof
(
area_t
),
LV_INV_FIFO_SIZE
);
inv_buf_p
=
0
;
memset
(
inv_buf
,
0
,
sizeof
(
inv_buf
));
ptask_t
*
task
;
task
=
ptask_create
(
lv_refr_task
,
LV_REFR_PERIOD
,
PTASK_PRIO_MID
);
dm_assert
(
task
);
...
...
@@ -101,16 +102,22 @@ void lv_inv_area(const area_t * area_p)
com_area
.
x2
=
com_area
.
x2
|
0x3
;
com_area
.
y2
=
com_area
.
y2
|
0x3
;
#endif
/*Save only if this area is not in one of the saved areas*/
uint16_t
i
;
for
(
i
=
0
;
i
<
inv_buf_p
;
i
++
)
{
if
(
area_is_in
(
&
com_area
,
&
inv_buf
[
i
].
area
)
!=
false
)
return
;
}
/*Save the area*/
suc
=
fifo_push
(
&
fifo_inv
,
&
com_area
);
/* There is no place for the new area
* clear the fifo and add the whole screen*/
if
(
suc
==
false
)
{
fifo_clear
(
&
fifo_inv
);
fifo_push
(
&
fifo_inv
,
&
scr_area
);
if
(
inv_buf_p
<
LV_INV_FIFO_SIZE
)
{
area_cpy
(
&
inv_buf
[
inv_buf_p
].
area
,
&
com_area
);
}
else
{
/*If no place for the area add the screen*/
inv_buf_p
=
0
;
area_cpy
(
&
inv_buf
[
inv_buf_p
].
area
,
&
scr_area
);
}
inv_buf_p
++
;
}
}
...
...
@@ -123,66 +130,50 @@ void lv_inv_area(const area_t * area_p)
*/
static
void
lv_refr_task
(
void
)
{
lv_join_t
area_tmp
[
LV_INV_FIFO_SIZE
];
memset
(
area_tmp
,
0
,
sizeof
(
area_tmp
));
lv_refr_join_area
();
/*Read all data from the fifo_inv*/
uint32_t
inv_num
;
bool
suc
;
for
(
inv_num
=
0
;
inv_num
<
LV_INV_FIFO_SIZE
;
inv_num
++
)
{
suc
=
fifo_pop
(
&
fifo_inv
,
&
area_tmp
[
inv_num
].
area
);
if
(
suc
==
false
)
/*Break id the fifo is empty*/
{
break
;
}
}
lv_refr_join_area
(
area_tmp
,
inv_num
);
lv_refr_areas
(
area_tmp
,
inv_num
);
lv_refr_areas
();
memset
(
inv_buf
,
0
,
sizeof
(
inv_buf
));
inv_buf_p
=
0
;
}
/**
* Join the areas which has got common parts
* @param join_a an array of areas to join
* @param inv_num item number of the array
*/
static
void
lv_refr_join_area
(
lv_join_t
*
area_a
,
uint32_t
area_num
)
static
void
lv_refr_join_area
(
void
)
{
uint32_t
join_from
;
uint32_t
join_in
;
area_t
joined_area
;
for
(
join_in
=
0
;
join_in
<
area_num
;
join_in
++
)
{
if
(
area_a
[
join_in
].
joined
!=
0
)
continue
;
for
(
join_in
=
0
;
join_in
<
inv_buf_p
;
join_in
++
)
{
if
(
inv_buf
[
join_in
].
joined
!=
0
)
continue
;
/*Check all areas to join them in 'join_in'*/
for
(
join_from
=
0
;
join_from
<
area_num
;
join_from
++
)
{
for
(
join_from
=
0
;
join_from
<
inv_buf_p
;
join_from
++
)
{
/*Handle only unjoined areas and ignore itself*/
if
(
area_a
[
join_from
].
joined
!=
0
||
join_in
==
join_from
)
{
if
(
inv_buf
[
join_from
].
joined
!=
0
||
join_in
==
join_from
)
{
continue
;
}
/*Check if the areas are on each other*/
if
(
area_is_on
(
&
area_a
[
join_in
].
area
,
&
area_a
[
join_from
].
area
)
==
false
)
if
(
area_is_on
(
&
inv_buf
[
join_in
].
area
,
&
inv_buf
[
join_from
].
area
)
==
false
)
{
continue
;
}
area_join
(
&
joined_area
,
&
area_a
[
join_in
].
area
,
&
area_a
[
join_from
].
area
);
area_join
(
&
joined_area
,
&
inv_buf
[
join_in
].
area
,
&
inv_buf
[
join_from
].
area
);
/*Join two area only if the joined area size is smaller*/
if
(
area_get_size
(
&
joined_area
)
<
(
area_get_size
(
&
area_a
[
join_in
].
area
)
+
area_get_size
(
&
area_a
[
join_from
].
area
)))
{
area_cpy
(
&
area_a
[
join_in
].
area
,
&
joined_area
);
(
area_get_size
(
&
inv_buf
[
join_in
].
area
)
+
area_get_size
(
&
inv_buf
[
join_from
].
area
)))
{
area_cpy
(
&
inv_buf
[
join_in
].
area
,
&
joined_area
);
/*Mark 'join_form' is joined into 'join_in'*/
area_a
[
join_from
].
joined
=
1
;
inv_buf
[
join_from
].
joined
=
1
;
}
}
}
...
...
@@ -190,22 +181,20 @@ static void lv_refr_join_area(lv_join_t * area_a, uint32_t area_num)
/**
* Refresh the joined areas
* @param area_a array of joined invalid areas
* @param area_num item number of the array
*/
static
void
lv_refr_areas
(
lv_join_t
*
area_a
,
uint32_t
area_num
)
static
void
lv_refr_areas
(
void
)
{
uint32_t
i
;
for
(
i
=
0
;
i
<
area_num
;
i
++
)
{
for
(
i
=
0
;
i
<
inv_buf_p
;
i
++
)
{
/*Refresh the unjoined areas*/
if
(
area_a
[
i
].
joined
==
0
)
{
if
(
inv_buf
[
i
].
joined
==
0
)
{
/*If there is no VDB do simple drawing*/
#if LV_VDB_SIZE == 0
lv_refr_area_no_vdb
(
&
area_a
[
i
].
area
);
lv_refr_area_no_vdb
(
&
inv_buf
[
i
].
area
);
#else
/*If VDB is used...*/
lv_refr_area_with_vdb
(
&
area_a
[
i
].
area
);
lv_refr_area_with_vdb
(
&
inv_buf
[
i
].
area
);
#endif
}
...
...
@@ -314,10 +303,7 @@ static lv_obj_t * lv_refr_get_top_obj(const area_t * area_p, lv_obj_t * obj)
lv_obj_t
*
found_p
=
NULL
;
/*If this object is fully cover the draw area check the children too */
if
(
obj
->
opa
==
OPA_COVER
&&
obj
->
hidden
==
0
&&
LV_SA
(
obj
,
lv_objs_t
)
->
transp
==
0
&&
obj
->
design_f
(
obj
,
area_p
,
LV_DESIGN_COVER_CHK
)
!=
false
)
if
(
area_is_in
(
area_p
,
&
obj
->
cords
)
&&
obj
->
hidden
==
0
)
{
LL_READ
(
obj
->
child_ll
,
i
)
{
found_p
=
lv_refr_get_top_obj
(
area_p
,
i
);
...
...
@@ -328,9 +314,13 @@ static lv_obj_t * lv_refr_get_top_obj(const area_t * area_p, lv_obj_t * obj)
}
}
/*If
there is no better children use
this object*/
/*If
no better children check
this object*/
if
(
found_p
==
NULL
)
{
found_p
=
obj
;
if
(
obj
->
opa
==
OPA_COVER
&&
LV_SA
(
obj
,
lv_objs_t
)
->
transp
==
0
&&
obj
->
design_f
(
obj
,
area_p
,
LV_DESIGN_COVER_CHK
)
!=
false
)
{
found_p
=
obj
;
}
}
}
...
...
@@ -408,6 +398,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p)
/* Redraw the object */
if
(
obj
->
opa
!=
OPA_TRANSP
&&
LV_SA
(
obj
,
lv_objs_t
)
->
transp
==
0
)
{
obj
->
design_f
(
obj
,
&
obj_ext_mask
,
LV_DESIGN_DRAW_MAIN
);
/* tick_wait_ms(100); */
/*DEBUG: Wait after every object draw to see the order of drawing*/
}
/*Create a new 'obj_mask' without 'ext_size' because the children can't be visible there*/
...
...
lv_objx/lv_btn.c
View file @
5459fc3c
...
...
@@ -128,7 +128,6 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void* param)
}
else
if
(
ext
->
state
==
LV_BTN_STATE_TGL_REL
)
{
lv_btn_set_state
(
btn
,
LV_BTN_STATE_TGL_PR
);
}
lv_obj_inv
(
btn
);
ext
->
lpr_exec
=
0
;
/*Call the press action, here 'param' is the caller dispi*/
...
...
@@ -143,8 +142,7 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void* param)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_REL
);
}
else
if
(
ext
->
state
==
LV_BTN_STATE_TGL_PR
)
{
lv_btn_set_state
(
btn
,
LV_BTN_STATE_TGL_REL
);
}
lv_obj_inv
(
btn
);
}
lv_obj_inv
(
btn
);
break
;
case
LV_SIGNAL_RELEASED
:
...
...
@@ -161,7 +159,6 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void* param)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_REL
);
}
if
(
ext
->
rel_action
!=
NULL
&&
state
!=
LV_BTN_STATE_INA
)
{
valid
=
ext
->
rel_action
(
btn
,
param
);
}
...
...
@@ -171,9 +168,9 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void* param)
}
else
if
(
ext
->
state
==
LV_BTN_STATE_TGL_PR
)
{
lv_btn_set_state
(
btn
,
LV_BTN_STATE_TGL_REL
);
}
lv_obj_inv
(
btn
);
}
lv_obj_inv
(
btn
);
break
;
case
LV_SIGNAL_LONG_PRESS
:
/*Call the long press action, here 'param' is the caller dispi*/
...
...
lv_objx/lv_btnm.c
View file @
5459fc3c
...
...
@@ -344,9 +344,8 @@ lv_btnms_t * lv_btnms_get(lv_btnms_builtin_t style, lv_btnms_t * copy)
static
bool
lv_btnm_design
(
lv_obj_t
*
btnm
,
const
area_t
*
mask
,
lv_design_mode_t
mode
)
{
if
(
mode
==
LV_DESIGN_COVER_CHK
)
{
ancestor_design_f
(
btnm
,
mask
,
mode
);
return
ancestor_design_f
(
btnm
,
mask
,
mode
);
/*Return false if the object is not covers the mask_p area*/
return
false
;
}
/*Draw the object*/
else
if
(
mode
==
LV_DESIGN_DRAW_MAIN
)
{
...
...
@@ -405,7 +404,7 @@ static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_
area_tmp
.
x2
=
area_tmp
.
x1
+
txt_size
.
x
;
area_tmp
.
y2
=
area_tmp
.
y1
+
txt_size
.
y
;
lv_draw_label
(
&
area_tmp
,
mask
,
lv_labels_get
(
LV_LABELS_BTN
,
NULL
)
,
OPA_COVER
,
ext
->
map_p
[
txt_i
]);
lv_draw_label
(
&
area_tmp
,
mask
,
&
style
->
labels
,
OPA_COVER
,
ext
->
map_p
[
txt_i
]);
txt_i
++
;
}
}
...
...
lv_objx/lv_cb.c
View file @
5459fc3c
...
...
@@ -30,9 +30,7 @@ static void lv_cbs_init(void);
/**********************
* STATIC VARIABLES
**********************/
static
lv_cbs_t
lv_cbs_def
=
{
};
static
lv_cbs_t
lv_cbs_def
;
/**********************
* MACROS
...
...
@@ -243,27 +241,27 @@ static void lv_cbs_init(void)
lv_cbs_def
.
bullet
.
mcolor
[
LV_BTN_STATE_REL
]
=
COLOR_WHITE
;
lv_cbs_def
.
bullet
.
gcolor
[
LV_BTN_STATE_REL
]
=
COLOR_SILVER
;
lv_cbs_def
.
bullet
.
bcolor
[
LV_BTN_STATE_REL
]
=
COLOR_BLACK
;
lv_cbs_def
.
bullet
.
light_en
[
LV_BTN_STATE_REL
]
=
0
;
lv_cbs_def
.
bullet
.
flags
[
LV_BTN_STATE_REL
].
light_en
=
0
;
lv_cbs_def
.
bullet
.
mcolor
[
LV_BTN_STATE_PR
]
=
COLOR_SILVER
;
lv_cbs_def
.
bullet
.
gcolor
[
LV_BTN_STATE_PR
]
=
COLOR_GRAY
;
lv_cbs_def
.
bullet
.
bcolor
[
LV_BTN_STATE_PR
]
=
COLOR_BLACK
;
lv_cbs_def
.
bullet
.
light_en
[
LV_BTN_STATE_PR
]
=
0
;
lv_cbs_def
.
bullet
.
flags
[
LV_BTN_STATE_PR
].
light_en
=
0
;
lv_cbs_def
.
bullet
.
mcolor
[
LV_BTN_STATE_TGL_REL
]
=
COLOR_MAKE
(
0x20
,
0x30
,
0x40
);
lv_cbs_def
.
bullet
.
gcolor
[
LV_BTN_STATE_TGL_REL
]
=
COLOR_MAKE
(
0x10
,
0x20
,
0x30
);
lv_cbs_def
.
bullet
.
bcolor
[
LV_BTN_STATE_TGL_REL
]
=
COLOR_WHITE
;
lv_cbs_def
.
bullet
.
light_en
[
LV_BTN_STATE_TGL_REL
]
=
0
;
lv_cbs_def
.
bullet
.
flags
[
LV_BTN_STATE_TGL_REL
].
light_en
=
0
;
lv_cbs_def
.
bullet
.
mcolor
[
LV_BTN_STATE_TGL_PR
]
=
COLOR_MAKE
(
0x50
,
0x70
,
0x90
);
lv_cbs_def
.
bullet
.
gcolor
[
LV_BTN_STATE_TGL_PR
]
=
COLOR_MAKE
(
0x20
,
0x30
,
0x40
);
lv_cbs_def
.
bullet
.
bcolor
[
LV_BTN_STATE_TGL_PR
]
=
COLOR_WHITE
;
lv_cbs_def
.
bullet
.
light_en
[
LV_BTN_STATE_TGL_PR
]
=
0
;
lv_cbs_def
.
bullet
.
flags
[
LV_BTN_STATE_TGL_PR
].
light_en
=
0
;
lv_cbs_def
.
bullet
.
mcolor
[
LV_BTN_STATE_INA
]
=
COLOR_SILVER
;
lv_cbs_def
.
bullet
.
gcolor
[
LV_BTN_STATE_INA
]
=
COLOR_GRAY
;
lv_cbs_def
.
bullet
.
bcolor
[
LV_BTN_STATE_INA
]
=
COLOR_WHITE
;
lv_cbs_def
.
bullet
.
light_en
[
LV_BTN_STATE_INA
]
=
0
;
lv_cbs_def
.
bullet
.
flags
[
LV_BTN_STATE_INA
].
light_en
=
0
;
lv_cbs_def
.
bullet
.
rects
.
bwidth
=
2
*
LV_DOWNSCALE
;
lv_cbs_def
.
bullet
.
rects
.
bopa
=
70
;
...
...
lv_objx/lv_mbox.c
View file @
5459fc3c
...
...
@@ -90,7 +90,7 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy)
}
/*Copy an existing message box*/
else
{
lv_mbox_ext_t
*
copy_ext
=
lv_obj_get_ext
(
copy
);
//
lv_mbox_ext_t * copy_ext = lv_obj_get_ext(copy);
/*TODO*/
}
...
...
lv_objx/lv_page.c
View file @
5459fc3c
...
...
@@ -491,6 +491,8 @@ static bool lv_page_design(lv_obj_t * page, const area_t * mask, lv_design_mode_
*/
static
void
lv_page_sb_refresh
(
lv_obj_t
*
page
)
{
lv_page_ext_t
*
page_ext
=
lv_obj_get_ext
(
page
);
lv_pages_t
*
pages
=
lv_obj_get_style
(
page
);
lv_obj_t
*
scrolling
=
page_ext
->
scrolling
;
...
...
@@ -504,8 +506,12 @@ static void lv_page_sb_refresh(lv_obj_t * page)
cord_t
page_x0
=
page
->
cords
.
x1
;
cord_t
page_y0
=
page
->
cords
.
y1
;
lv_inv_area
(
&
page_ext
->
sbh
);
lv_inv_area
(
&
page_ext
->
sbv
);
if
(
pages
->
sb_mode
==
LV_PAGE_SB_MODE_OFF
)
return
;
/*Invalidate the current (old) scrollbar areas*/
if
(
page_ext
->
sbh_draw
!=
0
)
lv_inv_area
(
&
page_ext
->
sbh
);
if
(
page_ext
->
sbv_draw
!=
0
)
lv_inv_area
(
&
page_ext
->
sbv
);
/*Horizontal scrollbar*/
if
(
scrolling_w
<=
obj_w
-
2
*
hpad
)
{
/*Full sized scroll bar*/
...
...
@@ -540,9 +546,10 @@ static void lv_page_sb_refresh(lv_obj_t * page)
(
-
(
lv_obj_get_y
(
scrolling
)
-
vpad
)
*
(
obj_h
-
size_tmp
-
pages
->
sb_width
))
/
(
scrolling_h
-
obj_h
+
2
*
vpad
));
}
lv_inv_area
(
&
page_ext
->
sbh
);
lv_inv_area
(
&
page_ext
->
sbv
);
/*Invalidate the new scrollbar areas*/
if
(
page_ext
->
sbh_draw
!=
0
)
lv_inv_area
(
&
page_ext
->
sbh
);
if
(
page_ext
->
sbv_draw
!=
0
)
lv_inv_area
(
&
page_ext
->
sbv
);
}
/**
...
...
lv_objx/lv_rect.c
View file @
5459fc3c
...
...
@@ -411,6 +411,7 @@ static void lv_rect_layout_col(lv_obj_t * rect)
align
=
LV_ALIGN_IN_TOP_RIGHT
;
break
;
default:
hpad_corr
=
0
;
align
=
LV_ALIGN_IN_TOP_LEFT
;
break
;
}
...
...
@@ -654,7 +655,7 @@ void lv_rect_refr_autofit(lv_obj_t * rect)
return
;
}
area_t
rect
_cords
;
area_t
new
_cords
;
area_t
ori
;
lv_rects_t
*
style
=
lv_obj_get_style
(
rect
);
lv_obj_t
*
i
;
...
...
@@ -663,48 +664,55 @@ void lv_rect_refr_autofit(lv_obj_t * rect)
/*Search the side coordinates of the children*/
lv_obj_get_cords
(
rect
,
&
ori
);
lv_obj_get_cords
(
rect
,
&
rect
_cords
);
lv_obj_get_cords
(
rect
,
&
new
_cords
);
rect
_cords
.
x1
=
LV_CORD_MAX
;
rect
_cords
.
y1
=
LV_CORD_MAX
;
rect
_cords
.
x2
=
LV_CORD_MIN
;
rect
_cords
.
y2
=
LV_CORD_MIN
;
new
_cords
.
x1
=
LV_CORD_MAX
;
new
_cords
.
y1
=
LV_CORD_MAX
;
new
_cords
.
x2
=
LV_CORD_MIN
;
new
_cords
.
y2
=
LV_CORD_MIN
;
LL_READ
(
rect
->
child_ll
,
i
)
{
if
(
lv_obj_get_hidden
(
i
)
!=
false
)
continue
;
rect_cords
.
x1
=
min
(
rect
_cords
.
x1
,
i
->
cords
.
x1
);
rect_cords
.
y1
=
min
(
rect
_cords
.
y1
,
i
->
cords
.
y1
);
rect_cords
.
x2
=
max
(
rect
_cords
.
x2
,
i
->
cords
.
x2
);
rect_cords
.
y2
=
max
(
rect
_cords
.
y2
,
i
->
cords
.
y2
);
new_cords
.
x1
=
min
(
new
_cords
.
x1
,
i
->
cords
.
x1
);
new_cords
.
y1
=
min
(
new
_cords
.
y1
,
i
->
cords
.
y1
);
new_cords
.
x2
=
max
(
new
_cords
.
x2
,
i
->
cords
.
x2
);
new_cords
.
y2
=
max
(
new
_cords
.
y2
,
i
->
cords
.
y2
);
}
/*If the value is not the init value then the page has >=1 child.*/
if
(
rect
_cords
.
x1
!=
LV_CORD_MAX
)
{
if
(
new
_cords
.
x1
!=
LV_CORD_MAX
)
{
if
(
ext
->
hfit_en
!=
0
)
{
rect
_cords
.
x1
-=
hpad
;
rect
_cords
.
x2
+=
hpad
;
new
_cords
.
x1
-=
hpad
;
new
_cords
.
x2
+=
hpad
;
}
else
{
rect
_cords
.
x1
=
rect
->
cords
.
x1
;
rect
_cords
.
x2
=
rect
->
cords
.
x2
;
new
_cords
.
x1
=
rect
->
cords
.
x1
;
new
_cords
.
x2
=
rect
->
cords
.
x2
;
}
if
(
ext
->
vfit_en
!=
0
)
{
rect
_cords
.
y1
-=
vpad
;
rect
_cords
.
y2
+=
vpad
;
new
_cords
.
y1
-=
vpad
;
new
_cords
.
y2
+=
vpad
;
}
else
{
rect
_cords
.
y1
=
rect
->
cords
.
y1
;
rect
_cords
.
y2
=
rect
->
cords
.
y2
;
new
_cords
.
y1
=
rect
->
cords
.
y1
;
new
_cords
.
y2
=
rect
->
cords
.
y2
;
}
lv_obj_inv
(
rect
);
area_cpy
(
&
rect
->
cords
,
&
rect_cords
);
lv_obj_inv
(
rect
);
/*Do nothing if the coordinates are not changed*/
if
(
rect
->
cords
.
x1
!=
new_cords
.
x1
||
rect
->
cords
.
y1
!=
new_cords
.
y1
||
rect
->
cords
.
x2
!=
new_cords
.
x2
||
rect
->
cords
.
y2
!=
new_cords
.
y2
)
{
lv_obj_inv
(
rect
);
area_cpy
(
&
rect
->
cords
,
&
new_cords
);
lv_obj_inv
(
rect
);
/*Notify the object about its new coordinates*/
rect
->
signal_f
(
rect
,
LV_SIGNAL_CORD_CHG
,
&
ori
);
/*Notify the object about its new coordinates*/
rect
->
signal_f
(
rect
,
LV_SIGNAL_CORD_CHG
,
&
ori
);
/*Inform the parent about the new coordinates*/
lv_obj_t
*
par
=
lv_obj_get_parent
(
rect
);
par
->
signal_f
(
par
,
LV_SIGNAL_CHILD_CHG
,
rect
);
/*Inform the parent about the new coordinates*/
lv_obj_t
*
par
=
lv_obj_get_parent
(
rect
);
par
->
signal_f
(
par
,
LV_SIGNAL_CHILD_CHG
,
rect
);
}
}
}
...
...
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