File tree 2 files changed +4
-4
lines changed
hardware/arduino/sam/cores/arduino
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 22
22
#include < stdint.h>
23
23
24
24
// Define constants and variables for buffering incoming serial data. We're
25
- // using a ring buffer (I think) , in which head is the index of the location
25
+ // using a ring buffer, in which head is the index of the location
26
26
// to which to write the next incoming character and tail is the index of the
27
27
// location from which to read.
28
28
#define SERIAL_BUFFER_SIZE 128
Original file line number Diff line number Diff line change @@ -149,12 +149,12 @@ size_t UARTClass::write( const uint8_t uc_data )
149
149
(_tx_buffer->_iTail != _tx_buffer->_iHead ))
150
150
{
151
151
// If busy we buffer
152
- unsigned int l = (_tx_buffer->_iHead + 1 ) % SERIAL_BUFFER_SIZE;
153
- while (_tx_buffer->_iTail == l )
152
+ int nextWrite = (_tx_buffer->_iHead + 1 ) % SERIAL_BUFFER_SIZE;
153
+ while (_tx_buffer->_iTail == nextWrite )
154
154
; // Spin locks if we're about to overwrite the buffer. This continues once the data is sent
155
155
156
156
_tx_buffer->_aucBuffer [_tx_buffer->_iHead ] = uc_data;
157
- _tx_buffer->_iHead = l ;
157
+ _tx_buffer->_iHead = nextWrite ;
158
158
// Make sure TX interrupt is enabled
159
159
_pUart->UART_IER = UART_IER_TXRDY;
160
160
}
You can’t perform that action at this time.
0 commit comments