aboutsummaryrefslogtreecommitdiff
path: root/cores
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2011-03-06 11:47:18 -0500
committerDavid A. Mellis <d.mellis@arduino.cc>2011-03-06 11:47:18 -0500
commit01d82d82770de18628b0fc9f9be1c85c7abc294e (patch)
tree990d7253142bff5815c41e096c2105d9ed06fefa /cores
parentbc416b14bd62937a96bd6eb28d3755282fdeb941 (diff)
Fixing race condition in Serial write (Brian Cook).
Diffstat (limited to 'cores')
-rw-r--r--cores/arduino/HardwareSerial.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp
index 1cd8cc5..6738675 100644
--- a/cores/arduino/HardwareSerial.cpp
+++ b/cores/arduino/HardwareSerial.cpp
@@ -367,7 +367,6 @@ void HardwareSerial::flush()
void HardwareSerial::write(uint8_t c)
{
- bool empty = (_tx_buffer->head == _tx_buffer->tail);
int i = (_tx_buffer->head + 1) % SERIAL_BUFFER_SIZE;
// If the output buffer is full, there's nothing for it other than to
@@ -378,11 +377,7 @@ void HardwareSerial::write(uint8_t c)
_tx_buffer->buffer[_tx_buffer->head] = c;
_tx_buffer->head = i;
- if (empty) {
- // The buffer was empty, so enable interrupt on
- // USART Data Register empty. The interrupt handler will take it from there
- sbi(*_ucsrb, _udrie);
- }
+ sbi(*_ucsrb, _udrie);
}
// Preinstantiate Objects //////////////////////////////////////////////////////