aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino
diff options
context:
space:
mode:
authorMartino Facchin <m.facchin@arduino.cc>2017-12-01 15:41:18 +0100
committerMartino Facchin <m.facchin@arduino.cc>2017-12-18 09:59:29 +0100
commit6e235622edb1b882401c77c171b0e738a093fd5b (patch)
treec8ed200f803f9ab9bdeeba9be511689f095d49e2 /cores/arduino
parent58006613a7c858417881744419c5da54cc21a401 (diff)
Fix MCUs without MPCM0 register
Diffstat (limited to 'cores/arduino')
-rw-r--r--cores/arduino/HardwareSerial.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp
index ecd7918..e99d503 100644
--- a/cores/arduino/HardwareSerial.cpp
+++ b/cores/arduino/HardwareSerial.cpp
@@ -100,7 +100,11 @@ void HardwareSerial::_tx_udr_empty_irq(void)
// actually got written. Other r/w bits are preserved, and zeroes
// written to the rest.
+#ifdef MPCM0
*_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << MPCM0))) | (1 << TXC0);
+#else
+ *_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << TXC0)));
+#endif
if (_tx_buffer_head == _tx_buffer_tail) {
// Buffer empty, so disable interrupts
@@ -236,7 +240,11 @@ size_t HardwareSerial::write(uint8_t c)
// be cleared when no bytes are left, causing flush() to hang
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
*_udr = c;
+#ifdef MPCM0
*_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << MPCM0))) | (1 << TXC0);
+#else
+ *_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << TXC0)));
+#endif
}
return 1;
}