diff options
author | Cristian Maglie <c.maglie@bug.st> | 2014-02-14 15:42:26 +0100 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2014-02-14 15:42:26 +0100 |
commit | f4cd0ff0a4708b94744e08bbd72ce389797b93a8 (patch) | |
tree | 8c3bf1fe50fcf3a5522a96a87ed7bd82cecf8a3f /cores | |
parent | e93ed5372fb220ff148080bc10bb2ebe3c777757 (diff) | |
parent | 02a5ae97d4604f50121f743ae42ab244a9ea49c1 (diff) |
Merge pull request #1863 from matthijskooijman/ide-1.5.x-serial-int
In HardwareSerial, don't use int for buffer indices
Diffstat (limited to 'cores')
-rw-r--r-- | cores/arduino/HardwareSerial.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp index 81b406a..a270ace 100644 --- a/cores/arduino/HardwareSerial.cpp +++ b/cores/arduino/HardwareSerial.cpp @@ -171,7 +171,7 @@ int HardwareSerial::read(void) return -1; } else { unsigned char c = _rx_buffer[_rx_buffer_tail]; - _rx_buffer_tail = (unsigned int)(_rx_buffer_tail + 1) % SERIAL_BUFFER_SIZE; + _rx_buffer_tail = (uint8_t)(_rx_buffer_tail + 1) % SERIAL_BUFFER_SIZE; return c; } } @@ -207,7 +207,7 @@ size_t HardwareSerial::write(uint8_t c) sbi(*_ucsra, TXC0); return 1; } - int i = (_tx_buffer_head + 1) % SERIAL_BUFFER_SIZE; + uint8_t i = (_tx_buffer_head + 1) % SERIAL_BUFFER_SIZE; // If the output buffer is full, there's nothing for it other than to // wait for the interrupt handler to empty it a bit |