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.
Fork of C027_Support by
SerialPipe.h@15:5eda64e5b9d1, 2013-11-22 (annotated)
- Committer:
- mazgch
- Date:
- Fri Nov 22 08:23:30 2013 +0000
- Revision:
- 15:5eda64e5b9d1
- Parent:
- 14:69c3e57ef0f5
- Child:
- 16:4a7ba1887e81
- rebase the serial pipe on SerialBase; - fix nonblocking put
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mazgch | 0:cb2d45baaca3 | 1 | #pragma once |
| mazgch | 0:cb2d45baaca3 | 2 | |
| mazgch | 2:b6012cd91657 | 3 | #include "mbed.h" |
| mazgch | 0:cb2d45baaca3 | 4 | #include "Pipe.h" |
| mazgch | 0:cb2d45baaca3 | 5 | |
| mazgch | 15:5eda64e5b9d1 | 6 | #define _SerialPipeBase SerialBase |
| mazgch | 15:5eda64e5b9d1 | 7 | |
| mazgch | 15:5eda64e5b9d1 | 8 | class SerialPipe : public _SerialPipeBase |
| mazgch | 0:cb2d45baaca3 | 9 | { |
| mazgch | 9:e7a5959ffae1 | 10 | public: |
| mazgch | 15:5eda64e5b9d1 | 11 | SerialPipe(PinName tx, PinName rx, int rxSize = 128, int txSize = 128); |
| mazgch | 9:e7a5959ffae1 | 12 | virtual ~SerialPipe(void); |
| mazgch | 9:e7a5959ffae1 | 13 | // tx channel |
| mazgch | 13:e2446fcdc246 | 14 | int writeable(void); |
| mazgch | 13:e2446fcdc246 | 15 | int putc(int c); // blocking |
| mazgch | 15:5eda64e5b9d1 | 16 | int put(const void* buffer, int length, bool blocking); |
| mazgch | 9:e7a5959ffae1 | 17 | // rx channel |
| mazgch | 9:e7a5959ffae1 | 18 | int readable(void); |
| mazgch | 13:e2446fcdc246 | 19 | int getc(void); // blocking |
| mazgch | 15:5eda64e5b9d1 | 20 | int get(void* buffer, int length, bool blocking); |
| mazgch | 13:e2446fcdc246 | 21 | protected: |
| mazgch | 9:e7a5959ffae1 | 22 | void rxIrqBuf(void); |
| mazgch | 9:e7a5959ffae1 | 23 | void txIrqBuf(void); |
| mazgch | 13:e2446fcdc246 | 24 | void txStart(void); |
| mazgch | 9:e7a5959ffae1 | 25 | Pipe<char> _pipeRx; |
| mazgch | 9:e7a5959ffae1 | 26 | Pipe<char> _pipeTx; |
| mazgch | 9:e7a5959ffae1 | 27 | }; |
| mazgch | 0:cb2d45baaca3 | 28 | |
| mazgch | 13:e2446fcdc246 | 29 | // ----------------------------------------------------------------------- |
| mazgch | 9:e7a5959ffae1 | 30 | #define WAIT -1 |
| mazgch | 9:e7a5959ffae1 | 31 | #define NOT_FOUND 0 |
| mazgch | 9:e7a5959ffae1 | 32 | |
| mazgch | 9:e7a5959ffae1 | 33 | class SerialPipeEx : public SerialPipe |
| mazgch | 9:e7a5959ffae1 | 34 | { |
| mazgch | 9:e7a5959ffae1 | 35 | public: |
| mazgch | 15:5eda64e5b9d1 | 36 | SerialPipeEx(PinName tx, PinName rx, int rxSize = 128, int txSize = 128); |
| mazgch | 13:e2446fcdc246 | 37 | int getLine(char* buffer, int length); |
| mazgch | 14:69c3e57ef0f5 | 38 | static int getLine(char* buffer, int length, Pipe<char>* pipe); |
| mazgch | 0:cb2d45baaca3 | 39 | }; |
