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_Plus_Dialing by
Diff: SerialPipe.cpp
- Revision:
- 11:b084552b03fe
- Parent:
- 9:e7a5959ffae1
- Child:
- 12:684b31d5482b
--- a/SerialPipe.cpp Thu Nov 14 12:57:21 2013 +0000 +++ b/SerialPipe.cpp Thu Nov 14 15:52:36 2013 +0000 @@ -16,26 +16,29 @@ } // tx channel -int SerialPipe::put(const char* b, int s, bool t) +int SerialPipe::put(const char* b, int n, bool t) { - int c = 0; - while (s && t) + int c = n; + while (c && t) { - c += _pipeTx.put(b, s, false); - b ++; - s --; + int i = _pipeTx.put(b, c, false); + b += i; + c -= i; // give a chance to start tx __disable_irq(); txIrqBuf(); __enable_irq(); } - return c; + return (n - c); } void SerialPipe::txIrqBuf(void) { while (serial_writable(&_serial) && _pipeTx.readable()) - serial_putc(&_serial, _pipeTx.getc()); + { + char ch = _pipeTx.getc(); + serial_putc(&_serial, ch); + } } // rx channel