Export for Dan
Fork of MODSERIAL by
Diff: INIT.cpp
- Revision:
- 24:9c456e647a8f
- Parent:
- 23:5c45c21f36b7
- Child:
- 25:ae0408ebdd68
diff -r 5c45c21f36b7 -r 9c456e647a8f INIT.cpp --- a/INIT.cpp Wed Jul 25 22:27:49 2012 +0000 +++ b/INIT.cpp Thu Dec 06 13:06:10 2012 +0000 @@ -23,10 +23,11 @@ #include "MODSERIAL.h" #include "MACROS.h" + namespace AjK { void -MODSERIAL::init( int txSize, int rxSize ) +MODSERIAL::init( int txSize, int rxSize, PinName rx ) { disableIrq(); @@ -37,26 +38,26 @@ _base = LPC_USART; #else - 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; + switch( _serial.index ) { + 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; } #endif dmaSendChannel = -1; moddma_p = (void *)NULL; - if (_base != NULL) { + if ( _base != NULL ) { buffer_size[RxIrq] = rxSize; buffer[RxIrq] = rxSize > 0 ? (char *)malloc(buffer_size[RxIrq]) : (char *)NULL; buffer_in[RxIrq] = 0; buffer_out[RxIrq] = 0; buffer_count[RxIrq] = 0; buffer_overflow[RxIrq] = 0; - Serial::attach(this, &MODSERIAL::isr_rx, Serial::RxIrq); + Serial::attach( this, &MODSERIAL::isr_rx, (SerialIrq)0 ); buffer_size[TxIrq] = txSize; buffer[TxIrq] = txSize > 0 ? (char *)malloc(buffer_size[TxIrq]) : (char *)NULL; @@ -64,7 +65,7 @@ buffer_out[TxIrq] = 0; buffer_count[TxIrq] = 0; buffer_overflow[TxIrq] = 0; - Serial::attach(this, &MODSERIAL::isr_tx, Serial::TxIrq); + Serial::attach( this, &MODSERIAL::isr_tx, (SerialIrq)1 ); } else { error("MODSERIAL must have a defined UART to function.");