diff --git a/arch/avr/src/atmega/atmega_config.h b/arch/avr/src/atmega/atmega_config.h index d9b82ac5e01..0390f1c129f 100644 --- a/arch/avr/src/atmega/atmega_config.h +++ b/arch/avr/src/atmega/atmega_config.h @@ -46,6 +46,7 @@ * Pre-processor Definitions ************************************************************************************/ /* USARTs ***************************************************************************/ +/* Check if any USART is selected */ #undef HAVE_USART_DEVICE #if defined(CONFIG_AVR_USART0) || defined(CONFIG_AVR_USART1) diff --git a/arch/avr/src/atmega/atmega_serial.c b/arch/avr/src/atmega/atmega_serial.c index 062492e6758..a9ccf5e176f 100644 --- a/arch/avr/src/atmega/atmega_serial.c +++ b/arch/avr/src/atmega/atmega_serial.c @@ -80,28 +80,31 @@ /* Which USART with be tty0/console and which tty1? */ +#undef CONSOLE_DEV +#undef TTYS0_DEV +#undef TTYS1_DEV + #if defined(CONFIG_USART0_SERIAL_CONSOLE) # define CONSOLE_DEV g_usart0port /* USART0 is console */ # define TTYS0_DEV g_usart0port /* USART0 is ttyS0 */ # ifdef CONFIG_AVR_USART1 # define TTYS1_DEV g_usart1port /* USART1 is ttyS1 */ -# else -# undef TTYS1_DEV /* No ttyS1 */ # endif #elif defined(CONFIG_USART1_SERIAL_CONSOLE) # define CONSOLE_DEV g_usart1port /* USART1 is console */ # define TTYS0_DEV g_usart1port /* USART1 is ttyS0 */ # ifdef CONFIG_AVR_USART0 # define TTYS1_DEV g_usart0port /* USART0 is ttyS1 */ -# else -# undef TTYS1_DEV /* No ttyS1 */ # endif +#elif defined(CONFIG_AVR_USART0) +# define TTYS0_DEV g_usart0port /* USART0 is ttyS0 */ +# ifdef CONFIG_AVR_USART1 +# define TTYS1_DEV g_usart1port /* USART1 is ttyS1 */ +# endif +#elif defined(CONFIG_AVR_USART1) +# define TTYS0_DEV g_usart1port /* USART1 is ttyS1 */ #endif -/**************************************************************************** - * Private Types - ****************************************************************************/ - /**************************************************************************** * Private Function Prototypes ****************************************************************************/