aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/HardwareSerial.cpp
diff options
context:
space:
mode:
authorchromhelm <chromhelm@users.noreply.github.com>2015-05-29 16:51:55 +0200
committerCristian Maglie <c.maglie@arduino.cc>2015-05-29 18:12:24 +0200
commitb7855ab7e159010e50d8b00e1cdd9dd7a8112d88 (patch)
tree2dfa6737c09e9630c17e17327a1d12de905e87c2 /cores/arduino/HardwareSerial.cpp
parentef4eb0cf6a2afd7dfc3b67561c8523ac8d4c6205 (diff)
Saving some bytes in HardwareSerial::write
Diffstat (limited to 'cores/arduino/HardwareSerial.cpp')
-rw-r--r--cores/arduino/HardwareSerial.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp
index 4022698..a2029a8 100644
--- a/cores/arduino/HardwareSerial.cpp
+++ b/cores/arduino/HardwareSerial.cpp
@@ -213,6 +213,7 @@ void HardwareSerial::flush()
size_t HardwareSerial::write(uint8_t c)
{
+ _written = true;
// If the buffer and the data register is empty, just write the byte
// to the data register and be done. This shortcut helps
// significantly improve the effective datarate at high (>
@@ -220,7 +221,6 @@ size_t HardwareSerial::write(uint8_t c)
if (_tx_buffer_head == _tx_buffer_tail && bit_is_set(*_ucsra, UDRE0)) {
*_udr = c;
sbi(*_ucsra, TXC0);
- _written = true;
return 1;
}
tx_buffer_index_t i = (_tx_buffer_head + 1) % SERIAL_TX_BUFFER_SIZE;
@@ -244,10 +244,8 @@ size_t HardwareSerial::write(uint8_t c)
_tx_buffer_head = i;
sbi(*_ucsrb, UDRIE0);
- _written = true;
return 1;
}
-
#endif // whole file