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
00866650
Commit
00866650
authored
Aug 28, 2014
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working towards displaying GPS coords on app screen
parent
c87d837e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
18 deletions
+31
-18
gpscoord.c
sw/freertos/src/apps/gpscoord.c
+16
-8
menu.c
sw/freertos/src/apps/menu.c
+1
-1
status_bar.c
sw/freertos/src/apps/widgets/status_bar.c
+14
-9
No files found.
sw/freertos/src/apps/gpscoord.c
View file @
00866650
...
...
@@ -36,18 +36,26 @@
#include "application.h"
static
int
i
=
0
;
static
void
gps_redraw
(
struct
ui_widget
*
w
)
{
char
buf
[
16
];
struct
gps_
utc
ut
c
;
struct
gps_
coord
c
;
gps_get_
utc
(
&
ut
c
);
gps_get_
coord
(
&
c
);
gfx_clear
(
&
w
->
dc
,
0
);
sprintf
(
buf
,
"%d:%d:%d"
,
utc
.
hr
,
utc
.
min
,
utc
.
sec
);
gfx_text
(
&
w
->
dc
,
&
font_helv17b
,
0
,
0
,
buf
,
0
);
sprintf
(
buf
,
"%2.4f"
,
c
.
lat
);
gfx_text
(
&
w
->
dc
,
&
font_helv17b
,
10
,
0
,
buf
,
0
);
i
++
;
sprintf
(
buf
,
"(%d)%d"
,
i
,
gps_fixed
());
gfx_text
(
&
w
->
dc
,
&
font_helv17b
,
10
,
50
,
buf
,
0
);
// sprintf(buf, "%2.4f", c.lon);
// gfx_text(&w->dc, &font_helv38b, 30, 0, buf, 0);
// sprintf(buf, "%2.4fm", c.elev);
// gfx_text(&w->dc, &font_helv38b, 50, 0, buf, 0);
}
static
void
gps_event
(
struct
ui_widget
*
w
,
const
struct
event
*
evt
)
...
...
@@ -100,9 +108,9 @@ void gpscoord_main(void *params)
return
;
break
;
case
RTC_TICK
:
if
(
gps_fixed
())
evt
.
type
=
GPS_FIX_ACQ
;
else
evt
.
type
=
GPS_FIX_LOST
;
ui_update
(
&
evt
);
default:
break
;
}
}
}
...
...
sw/freertos/src/apps/menu.c
View file @
00866650
...
...
@@ -162,7 +162,7 @@ void menu_main(void* params) {
menu_size
=
get_menu_size
(
*
current_menu
);
// run clock as the the initial application
clock
.
main
(
NULL
);
gpscoord
.
main
(
NULL
);
menu_ui_init
();
// Once it is deactivated - display the menu
...
...
sw/freertos/src/apps/widgets/status_bar.c
View file @
00866650
...
...
@@ -29,27 +29,32 @@
#include <string.h>
#include <drivers/gps/gps.h>
static
struct
rle_bitmap
gps_ico
;
static
int
gps_ico_blink
=
0
;
static
void
status_bar_event
(
struct
ui_widget
*
w
,
const
struct
event
*
evt
)
{
if
(
evt
->
type
==
GPS_FIX_LOST
)
{
if
(
evt
->
type
==
RTC_TICK
)
{
w
->
flags
|=
WF_DIRTY
;
gps_ico_blink
^=
1
;
if
(
gps_ico_blink
)
memcpy
(
&
gps_ico
,
&
gps_searching
,
if
(
gps_fixed
())
{
memcpy
(
&
gps_ico
,
&
gps_receiving
,
sizeof
(
struct
rle_bitmap
));
else
memcpy
(
&
gps_ico
,
0
,
sizeof
(
struct
rle_bitmap
));
}
else
if
(
evt
->
type
==
GPS_FIX_ACQ
)
{
w
->
flags
|=
WF_DIRTY
;
memcpy
(
&
gps_ico
,
&
gps_receiving
,
sizeof
(
struct
rle_bitmap
));
}
else
{
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
));
}
}
}
static
void
status_bar_redraw
(
struct
ui_widget
*
w
)
{
gfx_clear
(
&
w
->
dc
,
0
);
gfx_round_box
(
&
w
->
dc
,
30
,
-
10
,
127
-
30
,
10
,
9
,
COLOR_BLACK
);
gfx_centered_text
(
&
w
->
dc
,
&
font_helv11
,
0
,
"Home"
,
1
);
gfx_draw_bitmap
(
&
w
->
dc
,
0
,
0
,
&
gps_ico
);
...
...
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