Browse Source

uart.c: save resources if UART1 isn't used

feature/2015
Christian Kroll 10 years ago
parent
commit
877bebd41a
  1. 9
      src/uart/uart.c
  2. 6
      src/uart/uart_commands.c

9
src/uart/uart.c

@ -245,7 +245,7 @@ static volatile unsigned char UART_RxHead;
static volatile unsigned char UART_RxTail;
static volatile unsigned char UART_LastRxError;
#if defined( ATMEGA_USART1 )
#if defined( ATMEGA_USART1 ) && defined (USE_UART1)
static volatile unsigned char UART1_TxBuf[UART_TX_BUFFER_SIZE];
static volatile unsigned char UART1_RxBuf[UART_RX_BUFFER_SIZE];
static volatile unsigned char UART1_TxHead;
@ -506,7 +506,7 @@ void uart_puts_p(const char *progmem_s )
/*
* these functions are only for ATmegas with two USART
*/
#if defined( ATMEGA_USART1 )
#if defined( ATMEGA_USART1 ) && defined (USE_UART1)
ISR(UART1_RECEIVE_INTERRUPT)
/*************************************************************************
@ -565,9 +565,6 @@ Purpose: called when the UART1 is ready to transmit the next byte
}
#if defined USE_UART1 || defined DOXYGEN
/*************************************************************************
Function: uart1_init()
Purpose: initialize UART1 and set baudrate
@ -688,6 +685,4 @@ void uart1_puts_p(const char *progmem_s )
}/* uart1_puts_p */
#endif // defined USE_UART1 || defined DOXYGEN
#endif

6
src/uart/uart_commands.c

@ -285,10 +285,10 @@ static bool uartcmd_read_until_enter(void) {
case 27: // ignore Esc
break;
default:
// We don't accept control characters (except for \r and \n) and
// we also limit the input to 7 bit ASCII.
// We don't accept control characters except for \b, \r and \n.
// We also limit the input to 7 bit ASCII.
if ((uart_result < 0x20) || (uart_result > 0x7f)) {
uart_putc('\007'); // complain via ASCII bell
uart_putc('\a'); // complain via ASCII bell
} else {
g_rx_buffer[g_rx_index++] = uart_result; // accept input
uart_putc(uart_result); // echo input back to terminal

Loading…
Cancel
Save