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.
Diff: GPS.cpp
- Revision:
- 18:e5697801df29
- Parent:
- 15:5eda64e5b9d1
- Child:
- 19:2b5d097ca15d
- Child:
- 20:535ef78655df
--- a/GPS.cpp Fri Jan 31 09:49:51 2014 +0000
+++ b/GPS.cpp Fri Mar 14 13:07:48 2014 +0000
@@ -203,6 +203,24 @@
return false;
}
+bool GPSParser::getNmeaAngle(int ix, char* buf, int len, double& d)
+{
+ char ch;
+ char val;
+ if (getNmeaItem(ix,buf,len,val) && getNmeaItem(ix+1,buf,len,ch) &&
+ ((ch == 'S') || (ch == 'N') || (ch == 'E') || (ch == 'W')))
+ {
+ val *= 0.01;
+ int i = (int)d;
+ val = (val - i) / 0.6 + i;
+ if (ch == 'S' || ch == 'W')
+ val = -val;
+ d = val;
+ return true;
+ }
+ return false;
+}
+
const char GPSParser::toHex[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
// ----------------------------------------------------------------
@@ -221,11 +239,6 @@
return _getMessage(&_pipeRx, buf, len);
}
-char GPSSerial::next(void)
-{
- return _pipeRx.next();
-}
-
int GPSSerial::_send(const void* buf, int len)
{
return put((const char*)buf, len, true/*=blocking*/);
@@ -319,11 +332,6 @@
return read;
}
-char GPSI2C::next(void)
-{
- return _pipe.next();
-}
-
int GPSI2C::_send(const void* buf, int len)
{
return !I2C::write(GPSADR,(const char*)buf,len,true) ? len : 0;