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.
MjLineSerial.h@5:b7902dd4ab46, 2014-11-21 (annotated)
- Committer:
- matsujirushi
- Date:
- Fri Nov 21 10:48:30 2014 +0000
- Revision:
- 5:b7902dd4ab46
- Parent:
- 4:14ef86f5de57
Add echo member.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| matsujirushi | 0:40d65405e747 | 1 | #ifndef MJ_LINE_SERIAL_H |
| matsujirushi | 0:40d65405e747 | 2 | #define MJ_LINE_SERIAL_H |
| matsujirushi | 0:40d65405e747 | 3 | |
| matsujirushi | 0:40d65405e747 | 4 | #include "mbed.h" |
| matsujirushi | 1:833745ae8a7e | 5 | #include <vector> |
| matsujirushi | 3:e730a11160d7 | 6 | #include <queue> |
| matsujirushi | 0:40d65405e747 | 7 | |
| matsujirushi | 0:40d65405e747 | 8 | namespace matsujirushi { |
| matsujirushi | 0:40d65405e747 | 9 | |
| matsujirushi | 0:40d65405e747 | 10 | class MjLineSerial |
| matsujirushi | 0:40d65405e747 | 11 | { |
| matsujirushi | 0:40d65405e747 | 12 | public: |
| matsujirushi | 0:40d65405e747 | 13 | MjLineSerial(RawSerial *serial); |
| matsujirushi | 2:84178b3b2824 | 14 | |
| matsujirushi | 0:40d65405e747 | 15 | int putc(int c); |
| matsujirushi | 1:833745ae8a7e | 16 | int puts(const char *str); |
| matsujirushi | 0:40d65405e747 | 17 | int printf(const char *format, ...); |
| matsujirushi | 0:40d65405e747 | 18 | |
| matsujirushi | 1:833745ae8a7e | 19 | void attachReadLine(void (*func)(const char *str)); |
| matsujirushi | 1:833745ae8a7e | 20 | void task(); |
| matsujirushi | 1:833745ae8a7e | 21 | |
| matsujirushi | 4:14ef86f5de57 | 22 | const char *txDelimiter; |
| matsujirushi | 5:b7902dd4ab46 | 23 | bool echo; |
| matsujirushi | 4:14ef86f5de57 | 24 | |
| matsujirushi | 0:40d65405e747 | 25 | private: |
| matsujirushi | 0:40d65405e747 | 26 | RawSerial *baseSerial; |
| matsujirushi | 1:833745ae8a7e | 27 | vector<char> rxBuffer; |
| matsujirushi | 3:e730a11160d7 | 28 | queue<char> txBuffer; |
| matsujirushi | 1:833745ae8a7e | 29 | void (*readLineFunc)(const char *str); |
| matsujirushi | 2:84178b3b2824 | 30 | |
| matsujirushi | 0:40d65405e747 | 31 | }; |
| matsujirushi | 0:40d65405e747 | 32 | |
| matsujirushi | 0:40d65405e747 | 33 | } // namespace matsujirushi |
| matsujirushi | 0:40d65405e747 | 34 | |
| matsujirushi | 0:40d65405e747 | 35 | #endif |