mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Compiler Warning UARTClass.cpp and RingBuffer.h correction
This commit is contained in:
parent
4a5228f559
commit
fa0d580846
@ -22,7 +22,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
// Define constants and variables for buffering incoming serial data. We're
|
// Define constants and variables for buffering incoming serial data. We're
|
||||||
// using a ring buffer (I think), in which head is the index of the location
|
// using a ring buffer, in which head is the index of the location
|
||||||
// to which to write the next incoming character and tail is the index of the
|
// to which to write the next incoming character and tail is the index of the
|
||||||
// location from which to read.
|
// location from which to read.
|
||||||
#define SERIAL_BUFFER_SIZE 128
|
#define SERIAL_BUFFER_SIZE 128
|
||||||
|
@ -149,12 +149,12 @@ size_t UARTClass::write( const uint8_t uc_data )
|
|||||||
(_tx_buffer->_iTail != _tx_buffer->_iHead))
|
(_tx_buffer->_iTail != _tx_buffer->_iHead))
|
||||||
{
|
{
|
||||||
// If busy we buffer
|
// If busy we buffer
|
||||||
unsigned int l = (_tx_buffer->_iHead + 1) % SERIAL_BUFFER_SIZE;
|
int nextWrite = (_tx_buffer->_iHead + 1) % SERIAL_BUFFER_SIZE;
|
||||||
while (_tx_buffer->_iTail == l)
|
while (_tx_buffer->_iTail == nextWrite)
|
||||||
; // Spin locks if we're about to overwrite the buffer. This continues once the data is sent
|
; // Spin locks if we're about to overwrite the buffer. This continues once the data is sent
|
||||||
|
|
||||||
_tx_buffer->_aucBuffer[_tx_buffer->_iHead] = uc_data;
|
_tx_buffer->_aucBuffer[_tx_buffer->_iHead] = uc_data;
|
||||||
_tx_buffer->_iHead = l;
|
_tx_buffer->_iHead = nextWrite;
|
||||||
// Make sure TX interrupt is enabled
|
// Make sure TX interrupt is enabled
|
||||||
_pUart->UART_IER = UART_IER_TXRDY;
|
_pUart->UART_IER = UART_IER_TXRDY;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user