uart.c: save resources if UART1 isn't used
This commit is contained in:
parent
43f4fc9b2c
commit
877bebd41a
|
@ -245,7 +245,7 @@ static volatile unsigned char UART_RxHead;
|
||||||
static volatile unsigned char UART_RxTail;
|
static volatile unsigned char UART_RxTail;
|
||||||
static volatile unsigned char UART_LastRxError;
|
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_TxBuf[UART_TX_BUFFER_SIZE];
|
||||||
static volatile unsigned char UART1_RxBuf[UART_RX_BUFFER_SIZE];
|
static volatile unsigned char UART1_RxBuf[UART_RX_BUFFER_SIZE];
|
||||||
static volatile unsigned char UART1_TxHead;
|
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
|
* these functions are only for ATmegas with two USART
|
||||||
*/
|
*/
|
||||||
#if defined( ATMEGA_USART1 )
|
#if defined( ATMEGA_USART1 ) && defined (USE_UART1)
|
||||||
|
|
||||||
ISR(UART1_RECEIVE_INTERRUPT)
|
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()
|
Function: uart1_init()
|
||||||
Purpose: initialize UART1 and set baudrate
|
Purpose: initialize UART1 and set baudrate
|
||||||
|
@ -688,6 +685,4 @@ void uart1_puts_p(const char *progmem_s )
|
||||||
|
|
||||||
}/* uart1_puts_p */
|
}/* uart1_puts_p */
|
||||||
|
|
||||||
#endif // defined USE_UART1 || defined DOXYGEN
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -285,10 +285,10 @@ static bool uartcmd_read_until_enter(void) {
|
||||||
case 27: // ignore Esc
|
case 27: // ignore Esc
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// We don't accept control characters (except for \r and \n) and
|
// We don't accept control characters except for \b, \r and \n.
|
||||||
// we also limit the input to 7 bit ASCII.
|
// We also limit the input to 7 bit ASCII.
|
||||||
if ((uart_result < 0x20) || (uart_result > 0x7f)) {
|
if ((uart_result < 0x20) || (uart_result > 0x7f)) {
|
||||||
uart_putc('\007'); // complain via ASCII bell
|
uart_putc('\a'); // complain via ASCII bell
|
||||||
} else {
|
} else {
|
||||||
g_rx_buffer[g_rx_index++] = uart_result; // accept input
|
g_rx_buffer[g_rx_index++] = uart_result; // accept input
|
||||||
uart_putc(uart_result); // echo input back to terminal
|
uart_putc(uart_result); // echo input back to terminal
|
||||||
|
|
Loading…
Reference in New Issue