Export for Dan
Fork of MODSERIAL by
Diff: INIT.cpp
- Revision:
- 2:b936b4acbd92
- Parent:
- 0:eb2522b41db8
- Child:
- 4:28de979b77cf
--- a/INIT.cpp Sun Nov 21 02:15:07 2010 +0000 +++ b/INIT.cpp Sun Nov 21 03:31:51 2010 +0000 @@ -30,7 +30,13 @@ { disableIrq(); - setBase(); + switch(_uidx) { + case 0: _base = LPC_UART0; break; + case 1: _base = LPC_UART1; break; + case 2: _base = LPC_UART2; break; + case 3: _base = LPC_UART3; break; + default : _base = NULL; break; + } if (_base != NULL) { buffer_size[RxIrq] = rxSize; @@ -39,6 +45,7 @@ buffer_out[RxIrq] = 0; buffer_count[RxIrq] = 0; buffer_overflow[RxIrq] = 0; + dmaInUse[RxIrq] = -1; Serial::attach(this, &MODSERIAL::isr_rx, Serial::RxIrq); buffer_size[TxIrq] = txSize; @@ -47,8 +54,12 @@ buffer_out[TxIrq] = 0; buffer_count[TxIrq] = 0; buffer_overflow[TxIrq] = 0; + dmaInUse[TxIrq] = -1; Serial::attach(this, &MODSERIAL::isr_tx, Serial::TxIrq); } + else { + error("MODSERIAL must have a defined UART to function."); + } if (!txBufferSane()) { error("Failed to allocate memory for TX buffer"); @@ -63,16 +74,4 @@ enableIrq(); } -void -MODSERIAL::setBase(void) -{ - switch(_uidx) { - case 0: _base = LPC_UART0; break; - case 1: _base = LPC_UART1; break; - case 2: _base = LPC_UART2; break; - case 3: _base = LPC_UART3; break; - default : _base = NULL; break; - } -} - }; // namespace AjK ends