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.
Revision 5:b7902dd4ab46, committed 2014-11-21
- Comitter:
- matsujirushi
- Date:
- Fri Nov 21 10:48:30 2014 +0000
- Parent:
- 4:14ef86f5de57
- Commit message:
- Add echo member.
Changed in this revision
| MjLineSerial.cpp | Show annotated file Show diff for this revision Revisions of this file |
| MjLineSerial.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MjLineSerial.cpp Thu Nov 20 13:21:03 2014 +0000
+++ b/MjLineSerial.cpp Fri Nov 21 10:48:30 2014 +0000
@@ -10,6 +10,7 @@
baseSerial = serial;
readLineFunc = NULL;
txDelimiter = "\r\n";
+ echo = true;
}
int MjLineSerial::putc(int c)
@@ -63,7 +64,7 @@
if (readLineFunc != NULL)
{
rxBuffer.push_back('\0');
- puts(txDelimiter);
+ if (echo) puts(txDelimiter);
readLineFunc(rxBuffer.begin());
}
rxBuffer.clear();
@@ -71,17 +72,17 @@
case '\b':
if (rxBuffer.size() <= 0)
{
- putc('\a');
+ if (echo) putc('\a');
}
else
{
rxBuffer.pop_back();
- puts("\b \b");
+ if (echo) puts("\b \b");
}
break;
default:
rxBuffer.push_back(c);
- putc(c);
+ if (echo) putc(c);
break;
}
}
@@ -95,3 +96,4 @@
}
} // namespace matsujirushi
+
--- a/MjLineSerial.h Thu Nov 20 13:21:03 2014 +0000
+++ b/MjLineSerial.h Fri Nov 21 10:48:30 2014 +0000
@@ -20,6 +20,7 @@
void task();
const char *txDelimiter;
+ bool echo;
private:
RawSerial *baseSerial;