File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
hardware/arduino/cores/arduino Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 5353// using a ring buffer (I think), in which head is the index of the location
5454// to which to write the next incoming character and tail is the index of the
5555// location from which to read.
56+ // NOTE: a "power of 2" buffer size is reccomended to dramatically
57+ // optimize all the modulo operations for ring buffers.
5658#if (RAMEND < 1000)
5759 #define SERIAL_BUFFER_SIZE 16
5860#else
@@ -426,7 +428,7 @@ void HardwareSerial::end()
426428
427429int HardwareSerial::available (void )
428430{
429- return (int )(SERIAL_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail ) % SERIAL_BUFFER_SIZE;
431+ return (( unsigned int )(SERIAL_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail ) ) % SERIAL_BUFFER_SIZE;
430432}
431433
432434int HardwareSerial::peek (void )
You can’t perform that action at this time.
0 commit comments