Fix MCUs without MPCM0 register

This commit is contained in:
Martino Facchin 2017-12-01 15:41:18 +01:00
parent 58006613a7
commit 6e235622ed
1 changed files with 8 additions and 0 deletions

View File

@ -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;
}