Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
fwatch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
fwatch
Commits
298e6b69
Commit
298e6b69
authored
Aug 27, 2014
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gpsapp: Add icon to show activity
The GPS icon blinks while searching for signal and is on when fixed
parent
0b6f2bc8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
5 deletions
+37
-5
event.h
sw/common/event.h
+3
-1
Makefile
sw/gps/Makefile
+3
-1
gpsapp.c
sw/gps/gpsapp.c
+31
-3
No files found.
sw/common/event.h
View file @
298e6b69
...
...
@@ -33,7 +33,9 @@
enum
event_type
{
BUTTON_PRESSED
,
SENSOR
,
RTC_TICK
RTC_TICK
,
GPS_FIX_LOST
,
GPS_FIX_ACQ
};
/**
...
...
sw/gps/Makefile
View file @
298e6b69
...
...
@@ -120,7 +120,8 @@ INCLUDEPATHS += \
-I../common/drivers/usb
\
-I../common/drivers/usb/inc
\
-I../common/drivers/gps/
\
-I../common/drivers/gps/nmealib/include
-I../common/drivers/gps/nmealib/include
\
-I../bitmaps/
####################################################################
# Files #
...
...
@@ -174,6 +175,7 @@ C_SRC += \
../common/gfx/font_xm4x6.c
\
../common/gfx/font_xm5x8.c
\
../common/udelay.c
\
../bitmaps/bitmaps.c
\
gpsapp.c
s_SRC
+=
...
...
sw/gps/gpsapp.c
View file @
298e6b69
...
...
@@ -51,9 +51,12 @@
#include <gfx/graphics.h>
#include <gfx/ui.h>
#include <bitmaps.h>
#include "gps.h"
static
int
i
=
0
;
static
struct
rle_bitmap
gps_ico
;
static
int
gps_ico_blink
=
0
;
static
void
gps_redraw
(
struct
ui_widget
*
w
)
{
...
...
@@ -67,10 +70,21 @@ static void gps_redraw(struct ui_widget *w)
utc
.
min
,
utc
.
sec
);
gfx_text
(
&
w
->
dc
,
&
font_helv17b
,
0
,
0
,
buf
,
0
);
gfx_draw_bitmap
(
&
w
->
dc
,
0
,
112
,
&
gps_ico
);
}
static
void
gps_event
(
struct
ui_widget
*
w
,
const
struct
event
*
evt
)
{
if
(
evt
->
type
==
GPS_FIX_LOST
)
{
gps_ico_blink
^=
1
;
if
(
gps_ico_blink
)
memcpy
(
&
gps_ico
,
&
gps_searching
,
sizeof
(
struct
rle_bitmap
));
else
memcpy
(
&
gps_ico
,
0
,
sizeof
(
struct
rle_bitmap
));
}
else
if
(
evt
->
type
==
GPS_FIX_ACQ
)
{
memcpy
(
&
gps_ico
,
&
gps_receiving
,
sizeof
(
struct
rle_bitmap
));
}
w
->
flags
|=
WF_DIRTY
;
}
...
...
@@ -87,10 +101,17 @@ static struct ui_widget gps_screen = {
// NULL,
//};
static
struct
ui_widget
gps_fix
=
{
NULL
,
NULL
,
{
0
,
112
,
15
,
112
},
0
,
WF_ACTIVE
|
WF_VISIBLE
};
void
main
(
void
*
params
)
{
struct
event
evt
;
evt
.
type
=
RTC_TICK
;
int
i
=
0
;
/* Init clocks */
...
...
@@ -118,7 +139,14 @@ void main(void *params)
while
(
1
)
{
for
(
i
=
0
;
i
<
100000
;
i
++
)
;
ui_update
(
&
evt
);
if
(
gps_fixed
())
{
evt
.
type
=
GPS_FIX_ACQ
;
ui_update
(
&
evt
);
}
else
{
evt
.
type
=
GPS_FIX_LOST
;
ui_update
(
&
evt
);
}
}
}
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