Changing Serial.flush() to write outgoing data, not drop incoming data.
This brings it in line with most other uses of flush(), both in and out of Arduino. http://code.google.com/p/arduino/issues/detail?id=497
This commit is contained in:
parent
1cac0f3eb7
commit
c7c7302d9d
|
@ -359,16 +359,8 @@ int HardwareSerial::read(void)
|
||||||
|
|
||||||
void HardwareSerial::flush()
|
void HardwareSerial::flush()
|
||||||
{
|
{
|
||||||
// don't reverse this or there may be problems if the RX interrupt
|
while (_tx_buffer->head != _tx_buffer->tail)
|
||||||
// occurs after reading the value of rx_buffer_head but before writing
|
;
|
||||||
// the value to rx_buffer_tail; the previous value of rx_buffer_head
|
|
||||||
// may be written to rx_buffer_tail, making it appear as if the buffer
|
|
||||||
// don't reverse this or there may be problems if the RX interrupt
|
|
||||||
// occurs after reading the value of rx_buffer_head but before writing
|
|
||||||
// the value to rx_buffer_tail; the previous value of rx_buffer_head
|
|
||||||
// may be written to rx_buffer_tail, making it appear as if the buffer
|
|
||||||
// were full, not empty.
|
|
||||||
_rx_buffer->head = _rx_buffer->tail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HardwareSerial::write(uint8_t c)
|
void HardwareSerial::write(uint8_t c)
|
||||||
|
|
Loading…
Reference in New Issue