C027 support

Fork of C027_Support by u-blox

Committer:
mazgch
Date:
Mon Mar 17 13:18:04 2014 +0000
Revision:
20:535ef78655df
Parent:
18:e5697801df29
Child:
24:0e287a85ac9e
fix angle api, only one MDM constructor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mazgch 17:296d94a006b4 1 #pragma once
mazgch 17:296d94a006b4 2
mazgch 17:296d94a006b4 3 #include "mbed.h"
mazgch 18:e5697801df29 4 #include "Pipe.h"
mazgch 18:e5697801df29 5 #include "SerialPipe.h"
mazgch 17:296d94a006b4 6 #include "C027_PinNames.h"
mazgch 17:296d94a006b4 7
mazgch 18:e5697801df29 8 #define RX_SIZE 256
mazgch 18:e5697801df29 9 #define TX_SIZE 128
mazgch 18:e5697801df29 10
mazgch 18:e5697801df29 11 class MDMParser
mazgch 18:e5697801df29 12 {
mazgch 18:e5697801df29 13 public:
mazgch 18:e5697801df29 14 #define WAIT -1
mazgch 18:e5697801df29 15 #define NOT_FOUND 0
mazgch 18:e5697801df29 16
mazgch 18:e5697801df29 17 #define LENGTH(x) (x & 0x00FFFF)
mazgch 18:e5697801df29 18 // #define PROTOCOL(x) (x & 0xFF0000)
mazgch 18:e5697801df29 19 virtual int getLine(char* buf, int len) = 0;
mazgch 18:e5697801df29 20 virtual int getResp(char* buf, int len) = 0;
mazgch 18:e5697801df29 21 virtual int send(const char* buf, int len);
mazgch 18:e5697801df29 22
mazgch 18:e5697801df29 23 protected:
mazgch 18:e5697801df29 24 static int _getLine(Pipe<char>* pipe, char* buffer, int length);
mazgch 18:e5697801df29 25 static int _getResp(Pipe<char>* pipe, char* buffer, int length);
mazgch 18:e5697801df29 26 virtual int _send(const void* buf, int len) = 0;
mazgch 18:e5697801df29 27 };
mazgch 18:e5697801df29 28
mazgch 18:e5697801df29 29 // -----------------------------------------------------------------------
mazgch 18:e5697801df29 30
mazgch 18:e5697801df29 31 class MDMSerial : public SerialPipe, public MDMParser
mazgch 17:296d94a006b4 32 {
mazgch 17:296d94a006b4 33 public:
mazgch 18:e5697801df29 34 MDMSerial(PinName tx = MDMTXD, PinName rx = MDMRXD, int baudrate = MDMBAUD,
mazgch 18:e5697801df29 35 PinName rts = MDMRTS, PinName cts = MDMCTS,
mazgch 18:e5697801df29 36 int rxSize = RX_SIZE, int txSize = TX_SIZE);
mazgch 18:e5697801df29 37 virtual int getLine(char* buffer, int length);
mazgch 18:e5697801df29 38 virtual int getResp(char* buffer, int length);
mazgch 18:e5697801df29 39 protected:
mazgch 18:e5697801df29 40 virtual int _send(const void* buf, int len);
mazgch 17:296d94a006b4 41 };
mazgch 18:e5697801df29 42
mazgch 18:e5697801df29 43 // -----------------------------------------------------------------------
mazgch 18:e5697801df29 44
mazgch 18:e5697801df29 45 #define HAVE_MDMUSB
mazgch 18:e5697801df29 46 #ifdef HAVE_MDMUSB
mazgch 18:e5697801df29 47 class MDMUsb : /*public UsbSerial,*/ public MDMParser
mazgch 18:e5697801df29 48 {
mazgch 18:e5697801df29 49 public:
mazgch 18:e5697801df29 50 MDMUsb(void);
mazgch 18:e5697801df29 51 virtual int getLine(char* buffer, int length);
mazgch 18:e5697801df29 52 virtual int getResp(char* buffer, int length);
mazgch 18:e5697801df29 53 protected:
mazgch 18:e5697801df29 54 virtual int _send(const void* buf, int len);
mazgch 18:e5697801df29 55 };
mazgch 18:e5697801df29 56 #endif
mazgch 18:e5697801df29 57
mazgch 18:e5697801df29 58