support library for C027 helper functions for Buffer Pipes, Buffered Serial Port (rtos capable) and GPS parsing. It includes modem APIs for USSD, SMS and Sockets.
Dependents: C027Interface C027Interface C027_SupportTest
Fork of C027_Support by
Diff: SerialPipe.cpp
- Revision:
- 45:ebc2fd8dcf21
- Parent:
- 35:9275215a3a5b
- Child:
- 70:0a87d256cd24
diff -r 9d12223b78ff -r ebc2fd8dcf21 SerialPipe.cpp --- a/SerialPipe.cpp Thu Apr 17 20:41:30 2014 +0000 +++ b/SerialPipe.cpp Mon May 05 15:42:49 2014 +0000 @@ -6,13 +6,18 @@ : _SerialPipeBase(tx,rx), _pipeRx(rxSize), _pipeTx(txSize) { attach(this, &SerialPipe::rxIrqBuf, RxIrq); +#if defined(TARGET_UBLOX_C027) || defined(TARGET_LPC1768) + // the lpc1768 supports interrupt driven tx attach(this, &SerialPipe::txIrqBuf, TxIrq); +#endif } SerialPipe::~SerialPipe(void) { attach(NULL, RxIrq); +#if defined(TARGET_UBLOX_C027) || defined(TARGET_LPC1768) attach(NULL, TxIrq); +#endif } // tx channel @@ -57,9 +62,19 @@ void SerialPipe::txStart(void) { +#if defined(TARGET_UBLOX_C027) || defined(TARGET_LPC1768) __disable_irq(); txIrqBuf(); __enable_irq(); +#else + while (_pipeTx.readable()) + { + char c = _pipeTx.getc(); + while (!_SerialPipeBase::writeable()) + /*wait*/; + _SerialPipeBase::_base_putc(c); + } +#endif } // rx channel