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: HTTPClient_Cellular_HelloWorld Cellular_HelloMQTT MbedSmartRestMain Car_Bon_car_module ... more
This library is intended to be used with u-blox products such as the C027 or a shield with u-blox cellular and GPS modules like the cellular and positioning shield from Embedded Artist.
For 2G/GSM and 3G/UMTS you need to:
- have a SIM card and know its PIN number
- need to know you network operators APN setting These setting should be passed to the connect or init and join functions. You can also extend the APN database in MDMAPN.h.
For CDMA products you need to make sure that you have provisioned and activated the modem with either Sprint or Verizon.
Diff: GPS.cpp
- Revision:
- 95:8282dbbe1492
- Parent:
- 76:f7c3dd568dae
- Child:
- 139:fd9fe498f142
--- 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)); }