aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/HardwareSerial.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cores/arduino/HardwareSerial.cpp')
-rw-r--r--cores/arduino/HardwareSerial.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp
index e512421..2e64acb 100644
--- a/cores/arduino/HardwareSerial.cpp
+++ b/cores/arduino/HardwareSerial.cpp
@@ -393,11 +393,11 @@ try_again:
*_ubrrh = baud_setting >> 8;
*_ubrrl = baud_setting;
- //set number of data bits
- current_config = *_ubrrh;
- current_config = *_ucsrc;
- current_config |= config;
- *_ucsrc = current_config;
+ //set the data bits, parity, and stop bits
+#if defined(__AVR_ATmega8__)
+ config |= 0x80; // select UCSRC register (shared with UBRRH)
+#endif
+ *_ucsrc = config;
sbi(*_ucsrb, _rxen);
sbi(*_ucsrb, _txen);