Chris Pepper
/
sIRFstarIII_Example
Example Program for the sIRFstarIII Library
main.cpp@0:999ed846ba1e, 2012-04-01 (annotated)
- Committer:
- p3p
- Date:
- Sun Apr 01 22:28:45 2012 +0000
- Revision:
- 0:999ed846ba1e
- Child:
- 1:b1c95f8edfec
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
p3p | 0:999ed846ba1e | 1 | #include "mbed.h" |
p3p | 0:999ed846ba1e | 2 | #include "GpsInterface.h" |
p3p | 0:999ed846ba1e | 3 | |
p3p | 0:999ed846ba1e | 4 | MODDMA dma; |
p3p | 0:999ed846ba1e | 5 | Serial debug(USBTX, USBRX); |
p3p | 0:999ed846ba1e | 6 | Timer timer; |
p3p | 0:999ed846ba1e | 7 | |
p3p | 0:999ed846ba1e | 8 | SirfStarIII::GpsInterface gps(p13,p14); |
p3p | 0:999ed846ba1e | 9 | |
p3p | 0:999ed846ba1e | 10 | bool toggle = false; |
p3p | 0:999ed846ba1e | 11 | |
p3p | 0:999ed846ba1e | 12 | int main() { |
p3p | 0:999ed846ba1e | 13 | debug.baud(115200); |
p3p | 0:999ed846ba1e | 14 | debug.printf("GPS TEST FIRMWARE\r\n"); |
p3p | 0:999ed846ba1e | 15 | |
p3p | 0:999ed846ba1e | 16 | gps.initialise(); |
p3p | 0:999ed846ba1e | 17 | gps.MODDMA(&dma); |
p3p | 0:999ed846ba1e | 18 | |
p3p | 0:999ed846ba1e | 19 | timer.start(); |
p3p | 0:999ed846ba1e | 20 | |
p3p | 0:999ed846ba1e | 21 | while (1) { |
p3p | 0:999ed846ba1e | 22 | gps.update(); |
p3p | 0:999ed846ba1e | 23 | |
p3p | 0:999ed846ba1e | 24 | if (timer.read_ms() > 1000) { |
p3p | 0:999ed846ba1e | 25 | timer.reset(); |
p3p | 0:999ed846ba1e | 26 | debug.printf("%02d/%02d/%d %02d:%02d:%02d - %f, %f\r\n", gps._time.day, gps._time.month, gps._time.year, gps._time.hours, gps._time.minutes, gps._time.seconds, gps._position.latitude._dec_degrees, gps._position.longitude._dec_degrees); |
p3p | 0:999ed846ba1e | 27 | } |
p3p | 0:999ed846ba1e | 28 | } |
p3p | 0:999ed846ba1e | 29 | } |