support library for C027 helper functions for Buffer Pipes, Buffered Serial Port (rtos capable) and GPS parsing. It includes modem APIs for USSD, SMS and Sockets.
Dependents: C027Interface C027Interface C027_SupportTest
Fork of C027_Support by
Diff: GPS.cpp
- Revision:
- 95:8282dbbe1492
- Parent:
- 76:f7c3dd568dae
--- a/GPS.cpp Thu Jun 12 12:41:26 2014 +0000 +++ b/GPS.cpp Tue Jun 17 07:03:48 2014 +0000 @@ -1,7 +1,6 @@ #include "mbed.h" #include <ctype.h> #include "GPS.h" -#include "Relax.h" #ifdef TARGET_UBLOX_C027 #include "C027_api.h" #endif @@ -261,16 +260,14 @@ bool GPSSerial::init(PinName pn) { // send a byte to wakup the device again - putc(0); + putc(0xFF); // wait until we get some bytes int size = _pipeRx.size(); - int i = 30; - while (i--) { - RELAX_MS(10); - if(size != _pipeRx.size()) - break; - } - return (i >= 0); + Timer timer; + timer.start(); + while ((100 > timer.read_ms()) && (size == _pipeRx.size())) + /* nothing / just wait */; + return (size != _pipeRx.size()); } int GPSSerial::getMessage(char* buf, int len) @@ -314,9 +311,9 @@ { if (pn != NC) { DigitalOut pin(pn, 0); - wait_us(1); + ::wait_us(1); pin = 1; - RELAX_MS(100); + ::wait_ms(100); } return !I2C::write(_i2cAdr,®STREAM,sizeof(REGSTREAM)); }