Skip to content

Commit 6e23562

Browse files
committed
Fix MCUs without MPCM0 register
1 parent 5800661 commit 6e23562

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: cores/arduino/HardwareSerial.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ void HardwareSerial::_tx_udr_empty_irq(void)
100100
// actually got written. Other r/w bits are preserved, and zeroes
101101
// written to the rest.
102102

103+
#ifdef MPCM0
103104
*_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << MPCM0))) | (1 << TXC0);
105+
#else
106+
*_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << TXC0)));
107+
#endif
104108

105109
if (_tx_buffer_head == _tx_buffer_tail) {
106110
// Buffer empty, so disable interrupts
@@ -236,7 +240,11 @@ size_t HardwareSerial::write(uint8_t c)
236240
// be cleared when no bytes are left, causing flush() to hang
237241
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
238242
*_udr = c;
243+
#ifdef MPCM0
239244
*_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << MPCM0))) | (1 << TXC0);
245+
#else
246+
*_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << TXC0)));
247+
#endif
240248
}
241249
return 1;
242250
}

0 commit comments

Comments
 (0)