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
9e60e1cc
Commit
9e60e1cc
authored
Sep 06, 2014
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving to Fede's branch to check bootloader code
parent
cfa74c96
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
11 deletions
+34
-11
gps.c
sw/common/drivers/gps/gps.c
+12
-3
gps.h
sw/common/drivers/gps/gps.h
+1
-1
gpscoord.c
sw/freertos/src/apps/gpscoord.c
+21
-7
No files found.
sw/common/drivers/gps/gps.c
View file @
9e60e1cc
...
...
@@ -183,10 +183,19 @@ void gps_get_utc(struct gps_utc *utc)
utc
->
sec
=
gps_info
.
utc
.
sec
;
}
void
gps_get_coord
(
struct
gps_coord
*
coord
)
void
gps_get_coord
(
struct
gps_coord
*
coord
,
int
format
)
{
coord
->
lat
=
gps_info
.
lat
;
coord
->
lon
=
gps_info
.
lon
;
if
(
format
==
0
)
{
/* Raw [deg][min].[sec/60] data */
coord
->
lat
=
gps_info
.
lat
;
coord
->
lon
=
gps_info
.
lon
;
}
else
if
(
format
==
1
)
{
/* [deg][min].[sec] */
coord
->
lat
=
(
int
)
gps_info
.
lat
+
0
.
6
*
(
gps_info
.
lat
-
(
int
)
gps_info
.
lat
);
coord
->
lon
=
(
int
)
gps_info
.
lon
+
0
.
6
*
(
gps_info
.
lon
-
(
int
)
gps_info
.
lon
);
}
coord
->
elev
=
gps_info
.
elv
;
}
...
...
sw/common/drivers/gps/gps.h
View file @
9e60e1cc
...
...
@@ -64,7 +64,7 @@ int gps_puts(char *s);
int
gps_nmea_crc
(
const
char
*
nmeastr
);
int
gps_fixed
();
void
gps_get_utc
(
struct
gps_utc
*
utc
);
void
gps_get_coord
(
struct
gps_coord
*
coord
);
void
gps_get_coord
(
struct
gps_coord
*
coord
,
int
format
);
void
gps_get_speed
(
double
*
spd
);
void
gps_get_direction
(
double
*
dir
);
...
...
sw/freertos/src/apps/gpscoord.c
View file @
9e60e1cc
...
...
@@ -37,21 +37,31 @@
#include "application.h"
static
struct
gps_coord
coord
;
static
int
coord_format
;
static
void
gps_redraw
(
struct
ui_widget
*
w
)
{
char
buf
[
16
];
if
(
gps_fixed
())
gps_get_coord
(
&
coord
);
gps_get_coord
(
&
coord
,
coord_format
);
gfx_clear
(
&
w
->
dc
,
0
);
sprintf
(
buf
,
"%4.4f"
,
coord
.
lat
);
gfx_text
(
&
w
->
dc
,
&
font_helv22b
,
10
,
10
,
buf
,
0
);
sprintf
(
buf
,
"%4.4f"
,
coord
.
lon
);
gfx_text
(
&
w
->
dc
,
&
font_helv22b
,
10
,
30
,
buf
,
0
);
sprintf
(
buf
,
"%5.0f m"
,
coord
.
elev
);
gfx_text
(
&
w
->
dc
,
&
font_helv22b
,
10
,
50
,
buf
,
0
);
sprintf
(
buf
,
"L: -90"
,
(
int
)(
coord
.
lat
/
100
));
gfx_text
(
&
w
->
dc
,
&
font_helv22b
,
0
,
0
,
buf
,
0
);
sprintf
(
buf
,
"60.7777'"
);
gfx_text
(
&
w
->
dc
,
&
font_helv22b
,
15
,
20
,
buf
,
0
);
sprintf
(
buf
,
"l: -180"
,
(
int
)(
coord
.
lon
/
100
));
gfx_text
(
&
w
->
dc
,
&
font_helv22b
,
0
,
40
,
buf
,
0
);
sprintf
(
buf
,
"60.7777'"
);
gfx_text
(
&
w
->
dc
,
&
font_helv22b
,
15
,
60
,
buf
,
0
);
sprintf
(
buf
,
"h: 8848m"
);
gfx_text
(
&
w
->
dc
,
&
font_helv22b
,
0
,
80
,
buf
,
0
);
// sprintf(buf, "%2.4f" )
// gfx_text(&w->dc, &font_helv22b, 0, 30, buf, 0);
// sprintf(buf, "%5.0f m", coord.elev);
// gfx_text(&w->dc, &font_helv22b, 0, 50, buf, 0);
}
static
void
gps_event
(
struct
ui_widget
*
w
,
const
struct
event
*
evt
)
...
...
@@ -102,6 +112,10 @@ void gpscoord_main(void *params)
case
BUTTON_PRESSED
:
if
(
evt
.
data
.
button
==
BUT_TR
)
return
;
else
if
(
evt
.
data
.
button
==
BUT_BR
)
{
coord_format
+=
1
;
coord_format
%=
2
;
}
break
;
case
RTC_TICK
:
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