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.
Revision 2:62b98648091a, committed 2021-11-03
- Comitter:
- berajay
- Date:
- Wed Nov 03 17:43:51 2021 +0000
- Parent:
- 1:acd907fbcbae
- Commit message:
- STM32F401RE with Neo 6M;
Changed in this revision
--- a/MODSERIAL.lib Fri Aug 22 12:43:55 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/edodm85/code/MODSERIAL/#4213f9a7c3ad
--- a/main.cpp Fri Aug 22 12:43:55 2014 +0000 +++ b/main.cpp Wed Nov 03 17:43:51 2021 +0000 @@ -1,22 +1,54 @@ -/* - * Author: Edoardo De Marchi - * Date: 22-08-14 - * Notes: Firmware for GPS U-Blox NEO-6M -*/ +/* Includes */ +#include "mbed.h" + +Serial pc(USBTX, USBRX, 115200); +Serial gps(D8, D2, 9800); + +char cDataBuffer[500]; +int i = 0; -#include "main.h" - +void parse(char *cmd, int n) +{ + + char ns, ew, tf, status; + int fq, nst, fix, date; // fix quality, Number of satellites being tracked, 3D fix + float latitude, longitude, timefix, speed, altitude; + + + // Global Positioning System Fix Data + if(strncmp(cmd,"$GPGGA", 6) == 0) + { + sscanf(cmd, "$GPGGA,%f,%f,%c,%f,%c,%d,%d,%*f,%f", &timefix, &latitude, &ns, &longitude, &ew, &fq, &nst, &altitude); + pc.printf("GPGGA Fix taken at: %f, Latitude: %f %c, Longitude: %f %c, Fix quality: %d, Number of sat: %d, Altitude: %f M\r\n", timefix, latitude, ns, longitude, ew, fq, nst, altitude); + } + + // Satellite status + if(strncmp(cmd,"$GPGSA", 6) == 0) + { + sscanf(cmd, "$GPGSA,%c,%d,%d", &tf, &fix, &nst); + pc.printf("GPGSA Type fix: %c, 3D fix: %d, number of sat: %d\r\n", tf, fix, nst); + } + + // Geographic position, Latitude and Longitude + if(strncmp(cmd,"$GPGLL", 6) == 0) + { + sscanf(cmd, "$GPGLL,%f,%c,%f,%c,%f", &latitude, &ns, &longitude, &ew, &timefix); + pc.printf("GPGLL Latitude: %f %c, Longitude: %f %c, Fix taken at: %f\r\n", latitude, ns, longitude, ew, timefix); + } + + // Geographic position, Latitude and Longitude + if(strncmp(cmd,"$GPRMC", 6) == 0) + { + sscanf(cmd, "$GPRMC,%f,%c,%f,%c,%f,%c,%f,,%d", &timefix, &status, &latitude, &ns, &longitude, &ew, &speed, &date); + pc.printf("GPRMC Fix taken at: %f, Status: %c, Latitude: %f %c, Longitude: %f %c, Speed: %f, Date: %d\r\n", timefix, status, latitude, ns, longitude, ew, speed, date); + } +} void Init() { - gps.baud(9600); - pc.baud(115200); - - pc.printf("Init OK\n"); + printf("Init OK\r\n"); } - - int main() { Init(); @@ -48,43 +80,8 @@ } -void parse(char *cmd, int n) -{ - - char ns, ew, tf, status; - int fq, nst, fix, date; // fix quality, Number of satellites being tracked, 3D fix - float latitude, longitude, timefix, speed, altitude; - - - // Global Positioning System Fix Data - if(strncmp(cmd,"$GPGGA", 6) == 0) - { - sscanf(cmd, "$GPGGA,%f,%f,%c,%f,%c,%d,%d,%*f,%f", &timefix, &latitude, &ns, &longitude, &ew, &fq, &nst, &altitude); - pc.printf("GPGGA Fix taken at: %f, Latitude: %f %c, Longitude: %f %c, Fix quality: %d, Number of sat: %d, Altitude: %f M\n", timefix, latitude, ns, longitude, ew, fq, nst, altitude); - } - - // Satellite status - if(strncmp(cmd,"$GPGSA", 6) == 0) - { - sscanf(cmd, "$GPGSA,%c,%d,%d", &tf, &fix, &nst); - pc.printf("GPGSA Type fix: %c, 3D fix: %d, number of sat: %d\r\n", tf, fix, nst); - } - - // Geographic position, Latitude and Longitude - if(strncmp(cmd,"$GPGLL", 6) == 0) - { - sscanf(cmd, "$GPGLL,%f,%c,%f,%c,%f", &latitude, &ns, &longitude, &ew, &timefix); - pc.printf("GPGLL Latitude: %f %c, Longitude: %f %c, Fix taken at: %f\n", latitude, ns, longitude, ew, timefix); - } - - // Geographic position, Latitude and Longitude - if(strncmp(cmd,"$GPRMC", 6) == 0) - { - sscanf(cmd, "$GPRMC,%f,%c,%f,%c,%f,%c,%f,,%d", &timefix, &status, &latitude, &ns, &longitude, &ew, &speed, &date); - pc.printf("GPRMC Fix taken at: %f, Status: %c, Latitude: %f %c, Longitude: %f %c, Speed: %f, Date: %d\n", timefix, status, latitude, ns, longitude, ew, speed, date); - } -} +
--- a/main.h Fri Aug 22 12:43:55 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -#pragma once -#include "mbed.h" -#include "MODSERIAL.h" - -MODSERIAL pc(USBTX,USBRX); - -#if defined(TARGET_LPC1768) -MODSERIAL gps(p13, p14); -#elif defined(TARGET_LPC4330_M4) -MODSERIAL gps(UART0_TX, UART0_RX); -#endif - - -char cDataBuffer[500]; -int i = 0; - - -void Init(); -void parse(char *cmd, int n);
--- a/mbed-src.lib Fri Aug 22 12:43:55 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed-src/#ec1b66a3d094
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Nov 03 17:43:51 2021 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e1686b8d5b90 \ No newline at end of file