MODSERIAL with support for more devices
Fork of MODSERIAL by
Diff: MODSERIAL.cpp
- Revision:
- 27:9c93ce7cb9d8
- Parent:
- 25:ae0408ebdd68
- Child:
- 31:b90b20f78f04
diff -r 91e4dba7ebe2 -r 9c93ce7cb9d8 MODSERIAL.cpp --- a/MODSERIAL.cpp Mon Jun 10 19:06:21 2013 +0000 +++ b/MODSERIAL.cpp Thu Jul 11 13:34:53 2013 +0000 @@ -48,74 +48,33 @@ MODSERIAL::~MODSERIAL() { - disableIrq(); + NVIC_DisableIRQ(_IRQ); if ( buffer[0] != NULL) free((char *)buffer[0] ); if ( buffer[1] != NULL) free((char *)buffer[1] ); } -bool -MODSERIAL::txBufferFull( void ) +bool MODSERIAL::txBufferFull( void ) { return MODSERIAL_TX_BUFFER_FULL; } -bool -MODSERIAL::rxBufferFull( void ) +bool MODSERIAL::rxBufferFull( void ) { return MODSERIAL_RX_BUFFER_FULL; } -bool -MODSERIAL::txBufferEmpty( void ) +bool MODSERIAL::txBufferEmpty( void ) { return MODSERIAL_TX_BUFFER_EMPTY; } -bool -MODSERIAL::rxBufferEmpty( void ) +bool MODSERIAL::rxBufferEmpty( void ) { return MODSERIAL_RX_BUFFER_EMPTY; } -bool -MODSERIAL::txIsBusy( void ) -{ - return ( _LSR & ( 3UL << 5 ) == 0 ) ? true : false; -} -void -MODSERIAL::disableIrq( void ) -{ - -#ifdef __LPC11UXX_H__ - NVIC_DisableIRQ( UART_IRQn ); -#else - switch( _serial.index ) { - case 0: NVIC_DisableIRQ( UART0_IRQn ); break; - case 1: NVIC_DisableIRQ( UART1_IRQn ); break; - case 2: NVIC_DisableIRQ( UART2_IRQn ); break; - case 3: NVIC_DisableIRQ( UART3_IRQn ); break; - } -#endif -} - -void -MODSERIAL::enableIrq(void) -{ -#ifdef __LPC11UXX_H__ - NVIC_EnableIRQ( UART_IRQn ); -#else - switch( _serial.index ) { - case 0: NVIC_EnableIRQ( UART0_IRQn ); break; - case 1: NVIC_EnableIRQ( UART1_IRQn ); break; - case 2: NVIC_EnableIRQ( UART2_IRQn ); break; - case 3: NVIC_EnableIRQ( UART3_IRQn ); break; - } -#endif -} - -int -MODSERIAL::rxDiscardLastChar( void ) +int MODSERIAL::rxDiscardLastChar( void ) { // This function can only be called indirectly from // an rxCallback function. Therefore, we know we