Skip to content

Commit 20fcee9

Browse files
committed
HardwareSerial: set TXC0 bit when MPCM0 is undefined
1 parent 855ea01 commit 20fcee9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cores/arduino/HardwareSerial.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ void HardwareSerial::_tx_udr_empty_irq(void)
101101
// written to the rest.
102102

103103
#ifdef MPCM0
104-
*_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << MPCM0))) | (1 << TXC0);
104+
*_ucsra = (1 << TXC0) | ((*_ucsra) & ((1 << U2X0) | (1 << MPCM0)));
105105
#else
106-
*_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << TXC0)));
106+
*_ucsra = (1 << TXC0) | ((*_ucsra) & ((1 << U2X0)));
107107
#endif
108108

109109
if (_tx_buffer_head == _tx_buffer_tail) {
@@ -241,9 +241,9 @@ size_t HardwareSerial::write(uint8_t c)
241241
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
242242
*_udr = c;
243243
#ifdef MPCM0
244-
*_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << MPCM0))) | (1 << TXC0);
244+
*_ucsra = (1 << TXC0) | ((*_ucsra) & ((1 << U2X0) | (1 << MPCM0)));
245245
#else
246-
*_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << TXC0)));
246+
*_ucsra = (1 << TXC0) | ((*_ucsra) & ((1 << U2X0)));
247247
#endif
248248
}
249249
return 1;

0 commit comments

Comments
 (0)