Skip to content

Commit fa0d580

Browse files
techpaulsandeepmistry
authored andcommitted
Compiler Warning UARTClass.cpp and RingBuffer.h correction
1 parent 4a5228f commit fa0d580

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

hardware/arduino/sam/cores/arduino/RingBuffer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <stdint.h>
2323

2424
// 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
2626
// to which to write the next incoming character and tail is the index of the
2727
// location from which to read.
2828
#define SERIAL_BUFFER_SIZE 128

hardware/arduino/sam/cores/arduino/UARTClass.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ size_t UARTClass::write( const uint8_t uc_data )
149149
(_tx_buffer->_iTail != _tx_buffer->_iHead))
150150
{
151151
// 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)
154154
; // Spin locks if we're about to overwrite the buffer. This continues once the data is sent
155155

156156
_tx_buffer->_aucBuffer[_tx_buffer->_iHead] = uc_data;
157-
_tx_buffer->_iHead = l;
157+
_tx_buffer->_iHead = nextWrite;
158158
// Make sure TX interrupt is enabled
159159
_pUart->UART_IER = UART_IER_TXRDY;
160160
}

0 commit comments

Comments
 (0)