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.
Fork of C027_Support_Plus_Dialing by
Diff: GPS.cpp
- Revision:
- 11:b084552b03fe
- Parent:
- 10:3f1c13a8763d
- Child:
- 15:5eda64e5b9d1
--- a/GPS.cpp Thu Nov 14 12:57:21 2013 +0000 +++ b/GPS.cpp Thu Nov 14 15:52:36 2013 +0000 @@ -119,7 +119,7 @@ return i; } -int GPSParser::sendUbx(unsigned char cls, unsigned char id, const void* buf, int len) +int GPSParser::sendUbx(unsigned char cls, unsigned char id, const void* buf /*= NULL*/, int len /*= 0*/) { char head[6] = { 0xB5, 0x62, cls, id, len >> 0, len >> 8 }; char crc[2]; @@ -134,7 +134,7 @@ for (i = 0; i < len; i ++) { ca += ((char*)buf)[i]; - cb += ca; + cb += ca; } i = _send(head, sizeof(head)); i += _send(buf, len); @@ -272,7 +272,7 @@ if (len) { if (!I2C::write(GPSADR,®STREAM,sizeof(REGSTREAM),true)) - sent = _send(buf, len); + sent = send(buf, len); found = (len == sent); stop(); } @@ -282,26 +282,20 @@ int GPSI2C::sendNmea(const char* buf, int len) { int sent = 0; - if (len) - { - if (!I2C::write(GPSADR,®STREAM,sizeof(REGSTREAM),true)) - sent = GPSParser::sendNmea(buf, len); - found = (len == sent); - stop(); - } + if (!I2C::write(GPSADR,®STREAM,sizeof(REGSTREAM),true)) + sent = GPSParser::sendNmea(buf, len); + found = (len == sent); + stop(); return sent; } int GPSI2C::sendUbx(unsigned char cls, unsigned char id, const void* buf, int len) { int sent = 0; - if (len) - { - if (!I2C::write(GPSADR,®STREAM,sizeof(REGSTREAM),true)) - sent = GPSParser::sendUbx(cls, id, buf, len); - found = (len == sent); - stop(); - } + if (!I2C::write(GPSADR,®STREAM,sizeof(REGSTREAM),true)) + sent = GPSParser::sendUbx(cls, id, buf, len); + found = (len == sent); + stop(); return sent; }