File tree 1 file changed +3
-1
lines changed
hardware/arduino/cores/arduino
1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 53
53
// using a ring buffer (I think), in which head is the index of the location
54
54
// to which to write the next incoming character and tail is the index of the
55
55
// 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.
56
58
#if (RAMEND < 1000)
57
59
#define SERIAL_BUFFER_SIZE 16
58
60
#else
@@ -426,7 +428,7 @@ void HardwareSerial::end()
426
428
427
429
int HardwareSerial::available (void )
428
430
{
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;
430
432
}
431
433
432
434
int HardwareSerial::peek (void )
You can’t perform that action at this time.
0 commit comments