aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2014-02-14 15:42:26 +0100
committerCristian Maglie <c.maglie@bug.st>2014-02-14 15:42:26 +0100
commitf4cd0ff0a4708b94744e08bbd72ce389797b93a8 (patch)
tree8c3bf1fe50fcf3a5522a96a87ed7bd82cecf8a3f
parente93ed5372fb220ff148080bc10bb2ebe3c777757 (diff)
parent02a5ae97d4604f50121f743ae42ab244a9ea49c1 (diff)
Merge pull request #1863 from matthijskooijman/ide-1.5.x-serial-int
In HardwareSerial, don't use int for buffer indices
-rw-r--r--cores/arduino/HardwareSerial.cpp4
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