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
ae23300c
Commit
ae23300c
authored
Dec 11, 2017
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indev: add inactivity timer
parent
e7055bed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
6 deletions
+23
-6
lv_indev.c
lv_core/lv_indev.c
+20
-4
lv_indev.h
lv_core/lv_indev.h
+1
-1
lv_hal_indev.h
lv_hal/lv_hal_indev.h
+2
-1
No files found.
lv_core/lv_indev.c
View file @
ae23300c
...
@@ -175,12 +175,24 @@ void lv_indev_get_vect(lv_indev_t * indev, lv_point_t * point)
...
@@ -175,12 +175,24 @@ void lv_indev_get_vect(lv_indev_t * indev, lv_point_t * point)
/**
/**
* Get elapsed time since last press
* Get elapsed time since last press
* @param indev pointer to an input device
* @param indev pointer to an input device
(NULL to get the overall smallest inactivity)
* @return Elapsed ticks (milliseconds) since last press
* @return Elapsed ticks (milliseconds) since last press
*/
*/
uint32_t
lv_indev_get_inactive_time
(
lv_indev_t
*
indev
)
uint32_t
lv_indev_get_inactive_time
(
lv_indev_t
*
indev
)
{
{
return
indev
->
proc
.
pr_timestamp
;
uint32_t
t
;
if
(
indev
)
return
t
=
lv_tick_elaps
(
indev
->
last_activity_time
);
lv_indev_t
*
i
;
t
=
UINT16_MAX
;
i
=
lv_indev_next
(
NULL
);
while
(
i
)
{
t
=
LV_MATH_MIN
(
t
,
lv_tick_elaps
(
i
->
last_activity_time
));
i
=
lv_indev_next
(
i
);
}
return
t
;
}
}
/**
/**
...
@@ -229,7 +241,11 @@ static void indev_proc_task(void * param)
...
@@ -229,7 +241,11 @@ static void indev_proc_task(void * param)
if
(
i
->
proc
.
disabled
==
0
)
{
if
(
i
->
proc
.
disabled
==
0
)
{
/*Read the data*/
/*Read the data*/
lv_indev_read
(
i
,
&
data
);
lv_indev_read
(
i
,
&
data
);
i
->
proc
.
event
=
data
.
state
;
i
->
proc
.
state
=
data
.
state
;
if
(
i
->
proc
.
state
==
LV_INDEV_STATE_PR
)
{
i
->
last_activity_time
=
lv_tick_get
();
}
/*Move the cursor if set and moved*/
/*Move the cursor if set and moved*/
if
(
i
->
driver
.
type
==
LV_INDEV_TYPE_POINTER
&&
if
(
i
->
driver
.
type
==
LV_INDEV_TYPE_POINTER
&&
...
@@ -296,7 +312,7 @@ static void indev_proc_task(void * param)
...
@@ -296,7 +312,7 @@ static void indev_proc_task(void * param)
*/
*/
static
void
indev_proc_point
(
lv_indev_proc_t
*
indev
)
static
void
indev_proc_point
(
lv_indev_proc_t
*
indev
)
{
{
if
(
indev
->
event
==
LV_INDEV_STATE_PR
){
if
(
indev
->
state
==
LV_INDEV_STATE_PR
){
#if LV_INDEV_POINT_MARKER != 0
#if LV_INDEV_POINT_MARKER != 0
area_t
area
;
area_t
area
;
area
.
x1
=
indev
->
act_point
.
x
-
(
LV_INDEV_POINT_MARKER
>>
1
);
area
.
x1
=
indev
->
act_point
.
x
-
(
LV_INDEV_POINT_MARKER
>>
1
);
...
...
lv_core/lv_indev.h
View file @
ae23300c
...
@@ -96,7 +96,7 @@ void lv_indev_get_vect(lv_indev_t * indev, lv_point_t * point);
...
@@ -96,7 +96,7 @@ void lv_indev_get_vect(lv_indev_t * indev, lv_point_t * point);
/**
/**
* Get elapsed time since last press
* Get elapsed time since last press
* @param indev pointer to an input device
* @param indev pointer to an input device
(NULL to get the overall smallest inactivity)
* @return Elapsed ticks (milliseconds) since last press
* @return Elapsed ticks (milliseconds) since last press
*/
*/
uint32_t
lv_indev_get_inactive_time
(
lv_indev_t
*
indev
);
uint32_t
lv_indev_get_inactive_time
(
lv_indev_t
*
indev
);
...
...
lv_hal/lv_hal_indev.h
View file @
ae23300c
...
@@ -59,7 +59,7 @@ typedef struct {
...
@@ -59,7 +59,7 @@ typedef struct {
struct
_lv_obj_t
;
struct
_lv_obj_t
;
typedef
struct
_lv_indev_state_t
{
typedef
struct
_lv_indev_state_t
{
lv_indev_state_t
event
;
lv_indev_state_t
state
;
union
{
union
{
struct
{
/*Pointer data*/
struct
{
/*Pointer data*/
lv_point_t
act_point
;
lv_point_t
act_point
;
...
@@ -95,6 +95,7 @@ struct _lv_group_t;
...
@@ -95,6 +95,7 @@ struct _lv_group_t;
typedef
struct
_lv_indev_t
{
typedef
struct
_lv_indev_t
{
lv_indev_drv_t
driver
;
lv_indev_drv_t
driver
;
lv_indev_proc_t
proc
;
lv_indev_proc_t
proc
;
uint32_t
last_activity_time
;
union
{
union
{
struct
_lv_obj_t
*
cursor
;
struct
_lv_obj_t
*
cursor
;
struct
_lv_group_t
*
group
;
/*Keypad destination group*/
struct
_lv_group_t
*
group
;
/*Keypad destination group*/
...
...
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