Add a bunch of APNs
Fork of C027_Support by
Diff: SerialPipe.cpp
- Revision:
- 11:b084552b03fe
- Parent:
- 9:e7a5959ffae1
- Child:
- 12:684b31d5482b
diff -r 3f1c13a8763d -r b084552b03fe SerialPipe.cpp --- 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