EmbeddedArtists AB
/
lpc812_exp_solution_exp-port-gps-lib
Solutions for the GPS with MTK3339 lib experiments for LPC812 MAX
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "MTK3339.h" 00003 00004 static int waitData = 0; 00005 static MTK3339 gps(P0_4, P0_0); 00006 00007 00008 static void dataAvailable() { 00009 waitData |= gps.getAvailableDataType(); 00010 } 00011 00012 int main(void) { 00013 00014 gps.start(&dataAvailable, (MTK3339::NmeaGga|MTK3339::NmeaVtg)); 00015 00016 while(1) { 00017 while(waitData == 0); 00018 00019 if ((waitData & MTK3339::NmeaGga) != 0) { 00020 waitData &= ~(MTK3339::NmeaGga); 00021 printf("gpa: fix=%d, sats=%d, alt=%f, lat=%f, lon=%f\n", 00022 gps.gga.fix, gps.gga.satellites, gps.gga.altitude, 00023 gps.getLatitudeAsDegrees(), gps.getLongitudeAsDegrees()); 00024 } 00025 if ((waitData & MTK3339::NmeaVtg) != 0) { 00026 waitData &= ~(MTK3339::NmeaVtg); 00027 printf("vtg: course=%f, speed=%f km/h, mode=%c\n", 00028 gps.vtg.course, gps.vtg.speedKmHour, gps.vtg.mode); 00029 } 00030 00031 waitData &= (MTK3339::NmeaGga|MTK3339::NmeaVtg); 00032 } 00033 }
Generated on Sun Jul 31 2022 07:56:37 by 1.7.2