aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/AVR
diff options
context:
space:
mode:
authorFabio Utzig <utzig@utzig.org>2016-10-21 11:53:17 +0000
committerFabio Utzig <utzig@utzig.org>2016-10-21 11:53:17 +0000
commit6de99ec69c1ea92dba73e22d561b2847f8faf7f8 (patch)
tree148513e8858b7d439f6c6267b9dbce107e01f9bb /os/hal/ports/AVR
parent566f91822b4545b3bafbdff2fd0541dd91c38507 (diff)
downloadChibiOS-6de99ec69c1ea92dba73e22d561b2847f8faf7f8.tar.gz
ChibiOS-6de99ec69c1ea92dba73e22d561b2847f8faf7f8.tar.bz2
ChibiOS-6de99ec69c1ea92dba73e22d561b2847f8faf7f8.zip
Fixed style / be more defensive writing register
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9869 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/AVR')
-rw-r--r--os/hal/ports/AVR/hal_serial_lld.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/os/hal/ports/AVR/hal_serial_lld.c b/os/hal/ports/AVR/hal_serial_lld.c
index ab0d7f47b..6b4d00106 100644
--- a/os/hal/ports/AVR/hal_serial_lld.c
+++ b/os/hal/ports/AVR/hal_serial_lld.c
@@ -139,11 +139,7 @@ static void usart0_init(const SerialConfig *config) {
uint8_t ucsr0c;
UBRR0L = config->sc_brr;
-#if defined(__AVR_ATmega162__)
UBRR0H = (config->sc_brr >> 8) & 0x0f;
-#else
- UBRR0H = config->sc_brr >> 8;
-#endif
UCSR0A = 0;
UCSR0B = (1 << RXEN0) | (1 << TXEN0) | (1 << RXCIE0);
switch (config->sc_bits_per_char) {
@@ -180,7 +176,7 @@ static void usart0_deinit(void) {
UCSR0A = 0;
UCSR0B = 0;
#if defined(__AVR_ATmega162__)
- UCSR0C = (1 << URSEL0) | 0;
+ UCSR0C = (1 << URSEL0);
#else
UCSR0C = 0;
#endif
@@ -204,16 +200,12 @@ static void usart1_init(const SerialConfig *config) {
uint8_t ucsr1c;
UBRR1L = config->sc_brr;
-#if defined(__AVR_ATmega162__)
UBRR1H = (config->sc_brr >> 8) & 0x0f;
-#else
- UBRR1H = config->sc_brr >> 8;
-#endif
UCSR1A = 0;
UCSR1B = (1 << RXEN1) | (1 << TXEN1) | (1 << RXCIE1);
switch (config->sc_bits_per_char) {
case USART_CHAR_SIZE_5:
- ucsr1c = 0;
+ ucsr1c = 0;
break;
case USART_CHAR_SIZE_6:
ucsr1c = (1 << UCSZ10);
@@ -245,7 +237,7 @@ static void usart1_deinit(void) {
UCSR1A = 0;
UCSR1B = 0;
#if defined(__AVR_ATmega162__)
- UCSR1C = (1 << URSEL1) | 0;
+ UCSR1C = (1 << URSEL1);
#else
UCSR1C = 0;
#endif