Support for LISA-N101
Fork of C027_Support by
This is a variant of the C027 driver code for the C027N version, i.e. the one with the Neul/Huawei/u-blox Cellular Internet of Things module on board. The AT command interface for this module is entirely different to the AT interface for the other u-blox modules, hence this fork of the driver. Work is underway to rearchitect the original C027 driver so that a merge can be done.
Diff: GPS.cpp
- Revision:
- 46:8ce9169e0747
- Parent:
- 45:ebc2fd8dcf21
- Child:
- 74:208e3e32d263
--- a/GPS.cpp Mon May 05 15:42:49 2014 +0000 +++ b/GPS.cpp Tue May 06 06:54:12 2014 +0000 @@ -323,20 +323,25 @@ int GPSI2C::_get(char* buf, int len) { int read = 0; - unsigned char sz[2]; + unsigned char sz[2] = {0,0}; if (!I2C::write(_i2cAdr,®LEN,sizeof(REGLEN),true) && - !I2C::read(_i2cAdr,(char*)sz,sizeof(sz),true)) + !I2C::read(_i2cAdr,(char*)sz,sizeof(sz))) { int size = 256 * (int)sz[0] + sz[1]; if (size > len) size = len; - if (size > 0) - read = !I2C::read(_i2cAdr,buf,size, true) ? size : 0; - found = (read == size); + if (size > 0) + { + if (!I2C::write(_i2cAdr,®STREAM,sizeof(REGSTREAM),true) && + !I2C::read(_i2cAdr,buf,size)) { + read = size; + } + else + found = false; + } } else found = false; - I2C::stop(); return read; }