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.h
- Revision:
- 19:2b5d097ca15d
- Parent:
- 18:e5697801df29
- Child:
- 24:0e287a85ac9e
--- a/GPS.h Fri Mar 14 13:07:48 2014 +0000
+++ b/GPS.h Mon Mar 24 07:38:05 2014 +0000
@@ -3,10 +3,15 @@
#include "mbed.h"
#include "Pipe.h"
#include "SerialPipe.h"
-#include "C027_PinNames.h"
-#define RX_SIZE 256
-#define TX_SIZE 128
+#ifdef TARGET_UBLOX_C027
+ // if we detect the C027 platform we will assign the
+ // default pinname and baudrate in the constructor
+ // this helper macro will be used.
+ #define _C027DEFAULT(name) = name
+#else
+ #define _C027DEFAULT(name)
+#endif
class GPSParser
{
@@ -40,8 +45,11 @@
class GPSSerial : public SerialPipe, public GPSParser
{
public:
- GPSSerial(PinName tx = GPSTXD, PinName rx = GPSRXD, int baudrate = GPSBAUD,
- int rxSize = RX_SIZE, int txSize = TX_SIZE);
+ GPSSerial(PinName tx _C027DEFAULT( GPSTXD ),
+ PinName rx _C027DEFAULT( GPSRXD ),
+ int baudrate _C027DEFAULT( GPSBAUD ),
+ int rxSize = 256 ,
+ int txSize = 128 );
virtual int getMessage(char* buf, int len);
protected:
virtual int _send(const void* buf, int len);
@@ -50,8 +58,10 @@
class GPSI2C : public I2C, public GPSParser
{
public:
- GPSI2C(PinName sda = GPSSDA, PinName scl = GPSSCL,
- int rxSize = RX_SIZE);
+ GPSI2C(PinName sda _C027DEFAULT( GPSSDA ),
+ PinName scl _C027DEFAULT( GPSSCL ),
+ unsigned char i2cAdr _C027DEFAULT( GPSADR ),
+ int rxSize = 256 );
bool detect(void);
virtual int getMessage(char* buf, int len);
@@ -66,6 +76,7 @@
Pipe<char> _pipe;
bool found;
+ unsigned char _i2cAdr;
static const char REGLEN;
static const char REGSTREAM;
};