File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
arduino/avr/cores/arduino Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ void HardwareSerial::end()
152152
153153int HardwareSerial::available (void )
154154{
155- return (int )(SERIAL_RX_BUFFER_SIZE + _rx_buffer_head - _rx_buffer_tail) % SERIAL_RX_BUFFER_SIZE;
155+ return (( unsigned int )(SERIAL_RX_BUFFER_SIZE + _rx_buffer_head - _rx_buffer_tail) ) % SERIAL_RX_BUFFER_SIZE;
156156}
157157
158158int HardwareSerial::peek (void )
Original file line number Diff line number Diff line change 3232// using a ring buffer (I think), in which head is the index of the location
3333// to which to write the next incoming character and tail is the index of the
3434// location from which to read.
35+ // NOTE: a "power of 2" buffer size is reccomended to dramatically
36+ // optimize all the modulo operations for ring buffers.
3537#if !(defined(SERIAL_TX_BUFFER_SIZE) && defined(SERIAL_RX_BUFFER_SIZE))
3638#if (RAMEND < 1000)
3739#define SERIAL_TX_BUFFER_SIZE 16
You can’t perform that action at this time.
0 commit comments