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.
Diff: LineSerial.h
- Revision:
- 0:d3ca6a57e60b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LineSerial.h Mon Oct 13 12:50:10 2014 +0000
@@ -0,0 +1,30 @@
+#ifndef LINE_SERIAL_H
+#define LINE_SERIAL_H
+
+#include "mbed.h"
+
+class LineSerial : public Serial
+{
+public:
+ LineSerial(PinName tx, PinName rx, const char *name = NULL);
+ virtual ~LineSerial();
+
+ void allocateReadBuffer(size_t size);
+
+ void attachReadLine(void (*func)(const char* str));
+
+ void task();
+
+private:
+ char *readBuffer;
+ size_t readBufferSize;
+ size_t readBufferCount;
+
+ void (*readLineFunc)(const char* data);
+
+ bool appendReadBuffer(char data);
+ bool removeReadBuffer();
+
+};
+
+#endif
\ No newline at end of file