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
b2073475
Commit
b2073475
authored
Aug 24, 2014
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes in Makefile and main for gps function move
The subject is the test program for the GPS.
parent
6f224d40
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
127 deletions
+16
-127
Makefile
sw/gps/Makefile
+16
-5
main.c
sw/gps/main.c
+0
-122
No files found.
sw/gps/Makefile
View file @
b2073475
...
...
@@ -93,7 +93,7 @@ SIZE = $(QUOTE)$(TOOLDIR)/bin/arm-none-eabi-size$(QUOTE)
# -MF : Specify a file to write the dependencies to.
DEPFLAGS
=
-MMD -MP -MF
$
(@:.o=.d)
#
# Add -Wa,-ahld=$(LST_DIR)/$(@F:.o=.lst) to CFLAGS to produce assembly list files
#
override
CFLAGS
+=
-D
$(DEVICE)
-Wall -Wextra -mcpu=cortex-m3 -mthumb
\
...
...
@@ -110,16 +110,16 @@ override LDFLAGS += -Xlinker -Map=$(LST_DIR)/$(PROJECTNAME).map -mcpu=cortex-m3
-mthumb -T../common/Device/EnergyMicro/EFM32GG/Source/GCC/efm32gg.ld
\
-Wl,--gc-sections
LIBS
=
-Wl,--start-group -lgcc -lc -lnosys
-Wl,--end-group
LIBS
=
-Wl,--start-group -lgcc -lc -lnosys -Wl,--end-group
INCLUDEPATHS
+=
\
-I../src
\
-I../src
\
-I../common/CMSIS/Include
\
-I../common/Device/EnergyMicro/EFM32GG/Include
\
-I../common/emlib/inc
\
-I../common/usb
\
-I../common/usb/inc
\
-Igps/
\
-Igps/nmealib/include
####################################################################
# Files #
...
...
@@ -144,7 +144,18 @@ C_SRC += \
../common/usb/src/em_usbdep.c
\
../common/usb/src/em_usbdint.c
\
../common/usb/src/em_usbtimer.c
\
../src/main.c
gps/nmealib/src/context.c
\
gps/nmealib/src/generate.c
\
gps/nmealib/src/generator.c
\
gps/nmealib/src/gmath.c
\
gps/nmealib/src/info.c
\
gps/nmealib/src/parse.c
\
gps/nmealib/src/parser.c
\
gps/nmealib/src/sentence.c
\
gps/nmealib/src/time.c
\
gps/nmealib/src/tok.c
\
gps/gps.c
\
main.c
s_SRC
+=
...
...
sw/gps/main.c
View file @
b2073475
...
...
@@ -47,38 +47,6 @@
#include "usbdbg.h"
#define GPS_OK_TO_SEND "$PSRF150,1*3E\r\n"
#define RXBUFSIZE 16
static
char
rxbuf
[
RXBUFSIZE
];
volatile
char
idx
=
0
;
volatile
char
gps_rdy
=
0
;
void
gps_init
();
void
gps_on_off_pulse
();
int
gps_puts
(
char
*
);
void
gps_reset
(
int
val
);
int
nmea_crc
(
const
char
*
);
void
LEUART0_IRQHandler
()
{
if
(
LEUART0
->
IF
&
LEUART_IF_RXDATAV
)
{
rxbuf
[
idx
++
]
=
LEUART_Rx
(
LEUART0
);
if
((
gps_rdy
==
0
)
&&
(
strncmp
(
rxbuf
,
GPS_OK_TO_SEND
,
strlen
(
GPS_OK_TO_SEND
))
==
0
))
{
gps_rdy
=
1
;
usbdbg_puts
(
"GPS ready to send!
\r\n
"
);
idx
=
0
;
}
if
((
gps_rdy
)
&&
(
idx
==
RXBUFSIZE
))
{
idx
=
0
;
usbdbg_puts
(
rxbuf
);
}
}
}
int
main
()
{
...
...
@@ -133,93 +101,3 @@ int main()
return
0
;
}
int
gps_puts
(
char
*
s
)
{
while
(
*
s
++
)
{
if
(
*
s
==
EOF
)
return
EOF
;
LEUART_Tx
(
LEUART0
,
*
s
);
}
return
1
;
}
int
nmea_crc
(
const
char
*
nmea_str
)
{
int
chksum
=
0
;
int
i
=
0
;
int
n
=
0
;
char
buf
[
128
];
while
(
*
nmea_str
!=
'*'
)
buf
[
n
++
]
=
*
nmea_str
++
;
for
(
i
=
1
;
i
<
n
;
i
++
)
chksum
^=
(
int
)
buf
[
i
];
return
chksum
;
}
void
gps_init
()
{
int
i
;
/* Init GPS control pins & delay before ON_OFF pulse */
USB
->
ROUTE
&=
~
(
USB_ROUTE_VBUSENPEN
);
GPIO_PinModeSet
(
gpioPortF
,
5
,
gpioModePushPull
,
1
);
GPIO_PinModeSet
(
gpioPortA
,
1
,
gpioModeInput
,
0
);
GPIO_PinModeSet
(
gpioPortE
,
13
,
gpioModePushPull
,
0
);
for
(
i
=
0
;
i
<
10000000
;
i
++
)
;
gps_on_off_pulse
();
/* LEUART0 config */
LEUART_Init_TypeDef
init
=
LEUART_INIT_DEFAULT
;
GPIO_PinModeSet
(
gpioPortE
,
14
,
gpioModePushPull
,
1
);
GPIO_PinModeSet
(
gpioPortE
,
15
,
gpioModeInput
,
0
);
CMU_ClockEnable
(
cmuClock_CORELE
,
true
);
CMU_ClockSelectSet
(
cmuClock_LFB
,
cmuSelect_LFXO
);
CMU_ClockEnable
(
cmuClock_LEUART0
,
true
);
CMU_ClockDivSet
(
cmuClock_LEUART0
,
cmuClkDiv_1
);
init
.
enable
=
leuartDisable
;
init
.
baudrate
=
4800
;
init
.
databits
=
leuartDatabits8
;
init
.
stopbits
=
leuartStopbits1
;
LEUART_Init
(
LEUART0
,
&
init
);
LEUART0
->
ROUTE
=
LEUART_ROUTE_RXPEN
|
LEUART_ROUTE_TXPEN
|
LEUART_ROUTE_LOCATION_LOC2
;
LEUART_IntClear
(
LEUART0
,
LEUART_IF_RXDATAV
);
NVIC_ClearPendingIRQ
(
LEUART0_IRQn
);
LEUART_IntEnable
(
LEUART0
,
LEUART_IF_RXDATAV
);
NVIC_EnableIRQ
(
LEUART0_IRQn
);
LEUART_Enable
(
LEUART0
,
leuartEnable
);
}
void
gps_on_off_pulse
()
{
int
i
;
/* Pulse */
GPIO_PinOutSet
(
gpioPortE
,
13
);
GPIO_PinOutSet
(
gpioPortE
,
12
);
for
(
i
=
0
;
i
<
100000
;
i
++
)
;
GPIO_PinOutClear
(
gpioPortE
,
13
);
GPIO_PinOutClear
(
gpioPortE
,
12
);
/* Delay to make sure GPS module sees this as a pulse */
for
(
i
=
0
;
i
<
100000
;
i
++
)
;
}
void
gps_reset
(
int
val
)
{
val
?
GPIO_PinOutClear
(
gpioPortF
,
5
)
:
GPIO_PinOutSet
(
gpioPortF
,
5
);
}
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