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
f3e1df39
Commit
f3e1df39
authored
Feb 24, 2018
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add LV_GROUP_KEY_ENETER_LONG to trigger long press evets of the objects
parent
b2f72d3f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
11 deletions
+55
-11
lv_group.h
lv_core/lv_group.h
+3
-1
lv_indev.c
lv_core/lv_indev.c
+31
-3
lv_hal_indev.c
lv_hal/lv_hal_indev.c
+2
-0
lv_hal_indev.h
lv_hal/lv_hal_indev.h
+1
-0
lv_btn.c
lv_objx/lv_btn.c
+16
-7
lv_ddlist.c
lv_objx/lv_ddlist.c
+2
-0
No files found.
lv_core/lv_group.h
View file @
f3e1df39
...
...
@@ -25,11 +25,13 @@ extern "C" {
#define LV_GROUP_KEY_DOWN 18
/*0x12*/
#define LV_GROUP_KEY_RIGHT 19
/*0x13*/
#define LV_GROUP_KEY_LEFT 20
/*0x14*/
#define LV_GROUP_KEY_ESC
33
/*0x1B*/
#define LV_GROUP_KEY_ESC
27
/*0x1B*/
#define LV_GROUP_KEY_ENTER 10
/*0x0A, '\n'*/
#define LV_GROUP_KEY_NEXT 9
/*0x09, '\t'*/
#define LV_GROUP_KEY_PREV 11
/*0x0B, '*/
#define LV_GROUP_KEY_ENTER_LONG 14
/*0x0E, Sent by the library if ENTER is long pressed*/
#if USE_LV_GROUP != 0
/**********************
* TYPEDEFS
...
...
lv_core/lv_indev.c
View file @
f3e1df39
...
...
@@ -349,11 +349,34 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
static
void
indev_keypad_proc
(
lv_indev_t
*
i
,
lv_indev_data_t
*
data
)
{
#if USE_LV_GROUP
if
(
i
->
group
!=
NULL
&&
data
->
key
!=
0
&&
data
->
state
==
LV_INDEV_STATE_PR
&&
i
->
proc
.
last_state
==
LV_INDEV_STATE_REL
)
if
(
i
->
group
==
NULL
)
return
;
/*Key press happened*/
if
(
data
->
state
==
LV_INDEV_STATE_PR
&&
i
->
proc
.
last_state
==
LV_INDEV_STATE_REL
)
{
i
->
proc
.
pr_timestamp
=
lv_tick_get
();
}
/*Pressing*/
else
if
(
data
->
state
==
LV_INDEV_STATE_PR
&&
i
->
proc
.
last_state
==
LV_INDEV_STATE_PR
)
{
if
(
data
->
key
==
LV_GROUP_KEY_ENTER
&&
i
->
proc
.
long_pr_sent
==
0
&&
lv_tick_elaps
(
i
->
proc
.
pr_timestamp
)
>
LV_INDEV_LONG_PRESS_TIME
)
{
lv_group_send_data
(
i
->
group
,
LV_GROUP_KEY_ENTER_LONG
);
i
->
proc
.
long_pr_sent
=
1
;
}
}
/*Release happened*/
else
if
(
data
->
state
==
LV_INDEV_STATE_REL
&&
i
->
proc
.
last_state
==
LV_INDEV_STATE_PR
)
{
/*The user might clear the key it was released. Always release the pressed key*/
data
->
key
=
i
->
proc
.
last_key
;
if
(
data
->
key
==
LV_GROUP_KEY_NEXT
)
{
lv_group_focus_next
(
i
->
group
);
lv_group_focus_next
(
i
->
group
);
}
else
if
(
data
->
key
==
LV_GROUP_KEY_PREV
)
{
lv_group_focus_prev
(
i
->
group
);
...
...
@@ -361,8 +384,13 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
else
{
lv_group_send_data
(
i
->
group
,
data
->
key
);
}
i
->
proc
.
pr_timestamp
=
0
;
i
->
proc
.
long_pr_sent
=
0
;
}
i
->
proc
.
last_state
=
data
->
state
;
i
->
proc
.
last_key
=
data
->
key
;
#endif
}
...
...
lv_hal/lv_hal_indev.c
View file @
f3e1df39
...
...
@@ -61,12 +61,14 @@ lv_indev_t * lv_indev_drv_register(lv_indev_drv_t *driver)
node
=
lv_mem_alloc
(
sizeof
(
lv_indev_t
));
if
(
!
node
)
return
NULL
;
memset
(
node
,
0
,
sizeof
(
lv_indev_t
));
memcpy
(
&
node
->
driver
,
driver
,
sizeof
(
lv_indev_drv_t
));
node
->
next
=
NULL
;
node
->
proc
.
reset_query
=
1
;
node
->
cursor
=
NULL
;
node
->
group
=
NULL
;
node
->
btn_points
=
NULL
;
if
(
indev_list
==
NULL
)
{
indev_list
=
node
;
...
...
lv_hal/lv_hal_indev.h
View file @
f3e1df39
...
...
@@ -81,6 +81,7 @@ typedef struct _lv_indev_proc_t {
};
struct
{
/*Keypad data*/
lv_indev_state_t
last_state
;
uint32_t
last_key
;
};
};
...
...
lv_objx/lv_btn.c
View file @
f3e1df39
...
...
@@ -368,14 +368,23 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
res
=
ext
->
actions
[
LV_BTN_ACTION_CLICK
](
btn
);
}
}
else
if
(
c
==
LV_GROUP_KEY_ENTER
)
{
if
(
lv_btn_get_toggle
(
btn
)
!=
false
)
{
if
(
state
==
LV_BTN_STATE_REL
)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_TGL_REL
);
else
if
(
state
==
LV_BTN_STATE_PR
)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_TGL_PR
);
else
if
(
state
==
LV_BTN_STATE_TGL_REL
)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_REL
);
else
if
(
state
==
LV_BTN_STATE_TGL_PR
)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_PR
);
if
(
!
ext
->
long_pr_action_executed
)
{
if
(
lv_btn_get_toggle
(
btn
))
{
if
(
state
==
LV_BTN_STATE_REL
)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_TGL_REL
);
else
if
(
state
==
LV_BTN_STATE_PR
)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_TGL_PR
);
else
if
(
state
==
LV_BTN_STATE_TGL_REL
)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_REL
);
else
if
(
state
==
LV_BTN_STATE_TGL_PR
)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_PR
);
}
if
(
ext
->
actions
[
LV_BTN_ACTION_CLICK
]
&&
state
!=
LV_BTN_STATE_INA
)
{
res
=
ext
->
actions
[
LV_BTN_ACTION_CLICK
](
btn
);
}
}
if
(
ext
->
actions
[
LV_BTN_ACTION_CLICK
]
&&
state
!=
LV_BTN_STATE_INA
)
{
res
=
ext
->
actions
[
LV_BTN_ACTION_CLICK
](
btn
);
ext
->
long_pr_action_executed
=
0
;
}
else
if
(
c
==
LV_GROUP_KEY_ENTER_LONG
)
{
if
(
ext
->
actions
[
LV_BTN_ACTION_LONG_PR
]
&&
state
!=
LV_BTN_STATE_INA
)
{
res
=
ext
->
actions
[
LV_BTN_ACTION_LONG_PR
](
btn
);
ext
->
long_pr_action_executed
=
1
;
}
}
}
...
...
lv_objx/lv_ddlist.c
View file @
f3e1df39
...
...
@@ -516,6 +516,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
if
(
ext
->
sel_opt_id
+
1
<
ext
->
option_cnt
)
{
ext
->
sel_opt_id
++
;
lv_ddlist_pos_current_option
(
ddlist
);
lv_obj_invalidate
(
ddlist
);
if
(
ext
->
action
!=
NULL
)
{
ext
->
action
(
ddlist
);
}
...
...
@@ -524,6 +525,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
if
(
ext
->
sel_opt_id
>
0
)
{
ext
->
sel_opt_id
--
;
lv_ddlist_pos_current_option
(
ddlist
);
lv_obj_invalidate
(
ddlist
);
if
(
ext
->
action
!=
NULL
)
{
ext
->
action
(
ddlist
);
}
...
...
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