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.
Dependents: MbedSmartRestMain MbedSmartRestMain
Fork of C027_Support by
SerialPipe.h
- Committer:
- mazgch
- Date:
- 2013-11-19
- Revision:
- 14:69c3e57ef0f5
- Parent:
- 13:e2446fcdc246
- Child:
- 15:5eda64e5b9d1
File content as of revision 14:69c3e57ef0f5:
#pragma once
#include "mbed.h"
#include "Pipe.h"
class SerialPipe : public Serial
{
public:
SerialPipe(PinName tx, PinName rx, int rxSize = 128, int txSize = 128, const char* name = NULL);
virtual ~SerialPipe(void);
// tx channel
int writeable(void);
int putc(int c); // blocking
int put(const void* buffer, int length, bool blocking = false);
// rx channel
int readable(void);
int getc(void); // blocking
int get(void* buffer, int length, bool blocking = false);
protected:
virtual int _getc();
virtual int _putc(int c);
void rxIrqBuf(void);
void txIrqBuf(void);
void txStart(void);
Pipe<char> _pipeRx;
Pipe<char> _pipeTx;
};
// -----------------------------------------------------------------------
#define WAIT -1
#define NOT_FOUND 0
class SerialPipeEx : public SerialPipe
{
public:
SerialPipeEx(PinName tx, PinName rx, int rxSize = 128, int txSize = 128, const char* name = NULL);
int getLine(char* buffer, int length);
static int getLine(char* buffer, int length, Pipe<char>* pipe);
};
