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.h
- Revision:
- 9:e7a5959ffae1
- Parent:
- 4:c959dd4c5fe8
- Child:
- 11:b084552b03fe
--- a/GPS.h Sat Nov 09 13:31:49 2013 +0000 +++ b/GPS.h Sun Nov 10 16:39:42 2013 +0000 @@ -5,6 +5,9 @@ #include "SerialPipe.h" #include "C027_PinNames.h" +#define RX_SIZE 256 +#define TX_SIZE 128 + class GPSParser { public: @@ -33,24 +36,23 @@ static const char toHex[16]; }; -class GPSSerial : public Serial, public GPSParser +class GPSSerial : public SerialPipe, public GPSParser { public: - GPSSerial(PinName tx = GPSTXD, PinName rx = GPSRXD, int baudrate = GPSBAUD); - virtual ~GPSSerial(void); + GPSSerial(PinName tx = GPSTXD, PinName rx = GPSRXD, int baudrate = GPSBAUD, + int rxSize = RX_SIZE, int txSize = TX_SIZE); virtual int getMessage(char* buf, int len); protected: - void serialRxIrq(void); virtual char next(void); virtual int _send(const void* buf, int len); - Pipe<char> _pipe; }; class GPSI2C : public I2C, public GPSParser { public: - GPSI2C(PinName sda = GPSSDA, PinName scl = GPSSCL); + GPSI2C(PinName sda = GPSSDA, PinName scl = GPSSCL, + int rxSize = RX_SIZE); bool detect(void); virtual int getMessage(char* buf, int len); @@ -59,6 +61,8 @@ virtual int sendUbx(unsigned char cls, unsigned char id, const void* buf, int len); protected: virtual char next(void); + bool writeable(void) { return true; } + bool putc(int c) { char ch = c; return send(&ch, 1); } virtual int _send(const void* buf, int len); int _get(char* buf, int len); // read the NMEA or UBX stream