Skip to content

Commit

Permalink
Fix MCUs without MPCM0 register
Browse files Browse the repository at this point in the history
  • Loading branch information
facchinm committed Dec 18, 2017
1 parent 5800661 commit 6e23562
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cores/arduino/HardwareSerial.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 6e23562

Please sign in to comment.