mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
Revert "Match return value to type in available()"
This reverts commit f40e471354
.
Added an hint for the buffer sizes.
See #2057
Fixes #2367
This commit is contained in:
@ -53,6 +53,8 @@
|
|||||||
// using a ring buffer (I think), in which head is the index of the location
|
// using a ring buffer (I think), 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.
|
||||||
|
// NOTE: a "power of 2" buffer size is reccomended to dramatically
|
||||||
|
// optimize all the modulo operations for ring buffers.
|
||||||
#if (RAMEND < 1000)
|
#if (RAMEND < 1000)
|
||||||
#define SERIAL_BUFFER_SIZE 16
|
#define SERIAL_BUFFER_SIZE 16
|
||||||
#else
|
#else
|
||||||
@ -426,7 +428,7 @@ void HardwareSerial::end()
|
|||||||
|
|
||||||
int HardwareSerial::available(void)
|
int HardwareSerial::available(void)
|
||||||
{
|
{
|
||||||
return (int)(SERIAL_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail) % SERIAL_BUFFER_SIZE;
|
return ((unsigned int)(SERIAL_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail)) % SERIAL_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int HardwareSerial::peek(void)
|
int HardwareSerial::peek(void)
|
||||||
|
Reference in New Issue
Block a user