Takashi Matsuoka / MJ_LineSerial
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LineSerial.h Source File

LineSerial.h

00001 #ifndef LINE_SERIAL_H
00002 #define LINE_SERIAL_H
00003 
00004 #include "mbed.h"
00005 
00006 class LineSerial : public Serial
00007 {
00008 public:
00009     LineSerial(PinName tx, PinName rx, const char *name = NULL);
00010     virtual ~LineSerial();
00011 
00012     void allocateReadBuffer(size_t size);
00013     
00014     void attachReadLine(void (*func)(const char* str));
00015     
00016     void task();
00017 
00018 private:
00019     char *readBuffer;
00020     size_t readBufferSize;
00021     size_t readBufferCount;
00022 
00023     void (*readLineFunc)(const char* data);
00024 
00025     bool appendReadBuffer(char data);
00026     bool removeReadBuffer();
00027 
00028 };
00029 
00030 #endif