Merge pull request #3207 from chromhelm/master

Fixed bug with HWSerial flushing
This commit is contained in:
Martino Facchin 2015-05-28 09:44:46 +02:00
commit f816e76d47
1 changed files with 1 additions and 0 deletions

View File

@ -220,6 +220,7 @@ size_t HardwareSerial::write(uint8_t c)
if (_tx_buffer_head == _tx_buffer_tail && bit_is_set(*_ucsra, UDRE0)) { if (_tx_buffer_head == _tx_buffer_tail && bit_is_set(*_ucsra, UDRE0)) {
*_udr = c; *_udr = c;
sbi(*_ucsra, TXC0); sbi(*_ucsra, TXC0);
_written = true;
return 1; return 1;
} }
tx_buffer_index_t i = (_tx_buffer_head + 1) % SERIAL_TX_BUFFER_SIZE; tx_buffer_index_t i = (_tx_buffer_head + 1) % SERIAL_TX_BUFFER_SIZE;