We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fd79bfe commit 9aa902eCopy full SHA for 9aa902e
hardware/arduino/avr/cores/arduino/HardwareSerial.cpp
@@ -218,8 +218,11 @@ size_t HardwareSerial::write(uint8_t c)
218
// significantly improve the effective datarate at high (>
219
// 500kbit/s) bitrates, where interrupt overhead becomes a slowdown.
220
if (_tx_buffer_head == _tx_buffer_tail && bit_is_set(*_ucsra, UDRE0)) {
221
+ uint8_t oldSREG = SREG;
222
+ cli();
223
*_udr = c;
224
sbi(*_ucsra, TXC0);
225
+ SREG = oldSREG;
226
return 1;
227
}
228
tx_buffer_index_t i = (_tx_buffer_head + 1) % SERIAL_TX_BUFFER_SIZE;
@@ -240,9 +243,12 @@ size_t HardwareSerial::write(uint8_t c)
240
243
241
244
242
245
_tx_buffer[_tx_buffer_head] = c;
246
247
248
_tx_buffer_head = i;
249
250
sbi(*_ucsrb, UDRIE0);
251
252
253
254
0 commit comments