summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/arch/avr/src/at90usb/at90usb_lowconsole.c19
-rw-r--r--nuttx/arch/avr/src/atmega/atmega_lowconsole.c42
2 files changed, 32 insertions, 29 deletions
diff --git a/nuttx/arch/avr/src/at90usb/at90usb_lowconsole.c b/nuttx/arch/avr/src/at90usb/at90usb_lowconsole.c
index 053b053ca..5360eb44d 100644
--- a/nuttx/arch/avr/src/at90usb/at90usb_lowconsole.c
+++ b/nuttx/arch/avr/src/at90usb/at90usb_lowconsole.c
@@ -198,32 +198,33 @@ void usart1_configure(void)
/* Select parity */
#if CONFIG_USART1_PARITY == 1
- ucsr1c |= (UPM11 | UPM10); /* Odd parity */
+ ucsr1c |= ((1 << UPM11) | (1 << UPM10)); /* Odd parity */
#else
- ucsr1c |= UPM11; /* Even parity */
+ ucsr1c |= (1 << UPM11); /* Even parity */
#endif
/* 1 or 2 stop bits */
#if defined(CONFIG_USART1_2STOP) && CONFIG_USART1_2STOP > 0
- ucsr1c |= USBS1; /* Two stop bits */
+ ucsr1c |= (1 << USBS1); /* Two stop bits */
#endif
/* Word size */
#if CONFIG_USART1_BITS == 5
#elif CONFIG_USART1_BITS == 6
- ucsr1c |= UCSZ10;
+ ucsr1c |= (1 << UCSZ10);
#elif CONFIG_USART1_BITS == 7
- ucsr1c |= UCSZ11;
+ ucsr1c |= (1 << UCSZ11);
#elif CONFIG_USART1_BITS == 8
- ucsr1c |= (UCSZ10 | UCSZ11);
+ ucsr1c |= ((1 << UCSZ10) | (1 << UCSZ11));
#elif CONFIG_USART1_BITS == 9
- ucsr1c |= (UCSZ10 | UCSZ11);
- ucsr1b |= UCSZ12;
+ ucsr1c |= ((1 << UCSZ10) | (1 << UCSZ11));
+ ucsr1b |= (1 << UCSZ12);
#else
# error "Unsupported word size"
#endif
+
UCSR1B = ucsr1b;
UCSR1C = ucsr1c;
@@ -239,7 +240,7 @@ void usart1_configure(void)
* an output regardless of the value of DDD3.
*/
- DDRD |= (1 << 3); /* Force Port D pin 3 to be an output */
+ DDRD |= (1 << 3); /* Force Port D pin 3 to be an output -- Shouldn't be necessary */
PORTD |= (1 << 2); /* Set pull-up on port D pin 2 */
/* Set the baud rate divisor */
diff --git a/nuttx/arch/avr/src/atmega/atmega_lowconsole.c b/nuttx/arch/avr/src/atmega/atmega_lowconsole.c
index e746f6e5d..596ab7730 100644
--- a/nuttx/arch/avr/src/atmega/atmega_lowconsole.c
+++ b/nuttx/arch/avr/src/atmega/atmega_lowconsole.c
@@ -279,32 +279,33 @@ void usart0_configure(void)
/* Select parity */
#if CONFIG_USART0_PARITY == 1
- ucsr0c |= (UPM01 | UPM00); /* Odd parity */
+ ucsr0c |= ((1 << UPM01) | (1 << UPM00)); /* Odd parity */
#else
- ucsr0c |= UPM00; /* Even parity */
+ ucsr0c |= (1 << UPM00); /* Even parity */
#endif
/* 1 or 2 stop bits */
#if defined(CONFIG_USART0_2STOP) && CONFIG_USART0_2STOP > 0
- ucsr0c |= USBS0; /* Two stop bits */
+ ucsr0c |= (1 << USBS0); /* Two stop bits */
#endif
/* Word size */
#if CONFIG_USART0_BITS == 5
#elif CONFIG_USART0_BITS == 6
- ucsr0c |= UCSZ00;
+ ucsr0c |= (1 << UCSZ00);
#elif CONFIG_USART0_BITS == 7
- ucsr0c |= UCSZ01;
+ ucsr0c |= (1 << UCSZ01);
#elif CONFIG_USART0_BITS == 8
- ucsr0c |= (UCSZ00 | UCSZ01);
+ ucsr0c |= ((1 << UCSZ00) | (1 << UCSZ01));
#elif CONFIG_USART0_BITS == 9
- ucsr0c |= (UCSZ00 | UCSZ01);
- ucsr0b |= UCSZ02;
+ ucsr0c |= ((1 << UCSZ0) | (1 << UCSZ01));
+ ucsr0b |= (1 << UCSZ02);
#else
# error "Unsupported word size"
#endif
+
UCSR0B = ucsr0b;
UCSR0C = ucsr0c;
@@ -323,13 +324,13 @@ void usart0_configure(void)
* However, this is not explicitly stated in the text.
*/
- DDRE |= (1 << 1); /* Force Port E pin 1 to be an input */
+ DDRE |= (1 << 1); /* Force Port E pin 1 to be an input -- might not be necessary */
PORTE |= (1 << 0); /* Set pull-up on Port E pin 0 */
/* Set the baud rate divisor */
- UBRR0H = AVR_UBRR1 >> 8;
- UBRR0L = AVR_UBRR1 & 0xff;
+ UBRR0H = AVR_UBRR0 >> 8;
+ UBRR0L = AVR_UBRR0 & 0xff;
}
#endif
@@ -355,32 +356,33 @@ void usart1_configure(void)
/* Select parity */
#if CONFIG_USART1_PARITY == 1
- ucsr1c |= (UPM11 | UPM10); /* Odd parity */
+ ucsr1c |= ((1 << UPM11) | (1 << UPM10)); /* Odd parity */
#else
- ucsr1c |= UPM11; /* Even parity */
+ ucsr1c |= (1 << UPM11); /* Even parity */
#endif
/* 1 or 2 stop bits */
#if defined(CONFIG_USART1_2STOP) && CONFIG_USART1_2STOP > 0
- ucsr1c |= USBS1; /* Two stop bits */
+ ucsr1c |= (1 << USBS1); /* Two stop bits */
#endif
/* Word size */
#if CONFIG_USART1_BITS == 5
#elif CONFIG_USART1_BITS == 6
- ucsr1c |= UCSZ10;
+ ucsr1c |= (1 << UCSZ10);
#elif CONFIG_USART1_BITS == 7
- ucsr1c |= UCSZ11;
+ ucsr1c |= (1 << UCSZ11);
#elif CONFIG_USART1_BITS == 8
- ucsr1c |= (UCSZ10 | UCSZ11);
+ ucsr1c |= ((1 << UCSZ10) | (1 << UCSZ11));
#elif CONFIG_USART1_BITS == 9
- ucsr1c |= (UCSZ10 | UCSZ11);
- ucsr1b |= UCSZ12;
+ ucsr1c |= (U(1 << CSZ10) | (1 << UCSZ11));
+ ucsr1b |= (1 << UCSZ12);
#else
# error "Unsupported word size"
#endif
+
UCSR1B = ucsr1b;
UCSR1C = ucsr1c;
@@ -396,7 +398,7 @@ void usart1_configure(void)
* an output regardless of the value of DDD3.
*/
- DDRD |= (1 << 3); /* Force Port D pin 3 to be an output */
+ DDRD |= (1 << 3); /* Force Port D pin 3 to be an output -- should not be necessary */
PORTD |= (1 << 2); /* Set pull-up on port D pin 2 */
/* Set the baud rate divisor */