mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-07 01:54:26 +01:00
Merge pull request #1863 from matthijskooijman/ide-1.5.x-serial-int
In HardwareSerial, don't use int for buffer indices
This commit is contained in:
commit
92958ef4cb
@ -171,7 +171,7 @@ int HardwareSerial::read(void)
|
|||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
unsigned char c = _rx_buffer[_rx_buffer_tail];
|
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;
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ size_t HardwareSerial::write(uint8_t c)
|
|||||||
sbi(*_ucsra, TXC0);
|
sbi(*_ucsra, TXC0);
|
||||||
return 1;
|
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
|
// If the output buffer is full, there's nothing for it other than to
|
||||||
// wait for the interrupt handler to empty it a bit
|
// wait for the interrupt handler to empty it a bit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user