Own fork of C027_Support

Dependents:   MbedSmartRestMain MbedSmartRestMain

Fork of C027_Support by u-blox

Committer:
mazgch
Date:
Tue Nov 19 09:02:35 2013 +0000
Revision:
14:69c3e57ef0f5
Parent:
13:e2446fcdc246
Child:
15:5eda64e5b9d1
have a static getline function

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mazgch 0:cb2d45baaca3 1 #pragma once
mazgch 0:cb2d45baaca3 2
mazgch 2:b6012cd91657 3 #include "mbed.h"
mazgch 0:cb2d45baaca3 4 #include "Pipe.h"
mazgch 0:cb2d45baaca3 5
mazgch 0:cb2d45baaca3 6 class SerialPipe : public Serial
mazgch 0:cb2d45baaca3 7 {
mazgch 9:e7a5959ffae1 8 public:
mazgch 9:e7a5959ffae1 9 SerialPipe(PinName tx, PinName rx, int rxSize = 128, int txSize = 128, const char* name = NULL);
mazgch 9:e7a5959ffae1 10 virtual ~SerialPipe(void);
mazgch 9:e7a5959ffae1 11 // tx channel
mazgch 13:e2446fcdc246 12 int writeable(void);
mazgch 13:e2446fcdc246 13 int putc(int c); // blocking
mazgch 13:e2446fcdc246 14 int put(const void* buffer, int length, bool blocking = false);
mazgch 9:e7a5959ffae1 15 // rx channel
mazgch 9:e7a5959ffae1 16 int readable(void);
mazgch 13:e2446fcdc246 17 int getc(void); // blocking
mazgch 13:e2446fcdc246 18 int get(void* buffer, int length, bool blocking = false);
mazgch 13:e2446fcdc246 19 protected:
mazgch 13:e2446fcdc246 20 virtual int _getc();
mazgch 13:e2446fcdc246 21 virtual int _putc(int c);
mazgch 9:e7a5959ffae1 22 void rxIrqBuf(void);
mazgch 9:e7a5959ffae1 23 void txIrqBuf(void);
mazgch 13:e2446fcdc246 24 void txStart(void);
mazgch 9:e7a5959ffae1 25 Pipe<char> _pipeRx;
mazgch 9:e7a5959ffae1 26 Pipe<char> _pipeTx;
mazgch 9:e7a5959ffae1 27 };
mazgch 0:cb2d45baaca3 28
mazgch 13:e2446fcdc246 29 // -----------------------------------------------------------------------
mazgch 9:e7a5959ffae1 30 #define WAIT -1
mazgch 9:e7a5959ffae1 31 #define NOT_FOUND 0
mazgch 9:e7a5959ffae1 32
mazgch 9:e7a5959ffae1 33 class SerialPipeEx : public SerialPipe
mazgch 9:e7a5959ffae1 34 {
mazgch 9:e7a5959ffae1 35 public:
mazgch 9:e7a5959ffae1 36 SerialPipeEx(PinName tx, PinName rx, int rxSize = 128, int txSize = 128, const char* name = NULL);
mazgch 13:e2446fcdc246 37 int getLine(char* buffer, int length);
mazgch 14:69c3e57ef0f5 38 static int getLine(char* buffer, int length, Pipe<char>* pipe);
mazgch 0:cb2d45baaca3 39 };