Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: USBDevice max32630fthr
Revision 6:af25f19eb4e6, committed 2017-07-01
- Comitter:
- koziniec
- Date:
- Sat Jul 01 02:02:38 2017 +0000
- Parent:
- 5:703f61be6ee2
- Child:
- 7:4218bb385ca4
- Commit message:
- First attempt at calculating CS. Probably incorrect and doesn't print the CS to screen
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Jul 01 01:35:47 2017 +0000
+++ b/main.cpp Sat Jul 01 02:02:38 2017 +0000
@@ -29,7 +29,7 @@
char nmea_descriptor[5] = {0};
gps_power(on);
while (1) {
- char nmea_sentence[82] = {0}; //Fill with NUL terminators
+ char nmea_sentence[82] = {0}; //Fill with NULL terminators
gps.format(8,Serial::None,1);
while (gps.getc()!='$'); //wait for start of sentence
int nmea_index = 0;
@@ -47,6 +47,14 @@
nmea_index=80; //Don't overflow buffer
}
}
+ // Checksum
+ bool checksum_valid = FALSE;
+ int checksum = 0;
+ int i = 1; //After the '$'
+ while (nmea_sentence[i++] != '*'){
+ checksum ^= nmea_sentence[i];
+ }
+ pc.printf( "Checksum: %i\n\r", checksum );
// const char s[2] = ",";
const char gprmc[7] = "$GPRMC";
char *token;
@@ -77,7 +85,7 @@
data[1] = 0x19; //3.3V
i2c.write( 0x50, data, 2 );
gps_power(off);
- wait(5);
+ wait(2);
while (1) {
gps_update();
}