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: C027Interface C027Interface C027_SupportTest
Fork of C027_Support by
Diff: SerialPipe.cpp
- Revision:
- 14:69c3e57ef0f5
- Parent:
- 13:e2446fcdc246
- Child:
- 15:5eda64e5b9d1
--- a/SerialPipe.cpp Tue Nov 19 08:34:51 2013 +0000
+++ b/SerialPipe.cpp Tue Nov 19 09:02:35 2013 +0000
@@ -104,16 +104,21 @@
int SerialPipeEx::getLine(char* buffer, int length)
{
+ return getLine(buffer, length, &_pipeRx);
+}
+
+int SerialPipeEx::getLine(char* buffer, int length, Pipe<char>* pipe)
+{
int o = 0;
int i = 0;
- int l = _pipeRx.start();
+ int l = pipe->start();
while ((i < l) && (o < length))
{
- int t = _pipeRx.next();
+ int t = pipe->next();
i ++;
if (t == '\r') // terminate commands with carriage return
{
- _pipeRx.done();
+ pipe->done();
if (length > o)
buffer[o] = '\0';
return o; // if enter send the zero char
