mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Moving write errors out of return value into separate API methods.
write(), print(), println() now return size_t (and don't use negative values to signal errors). Print adds writeError() for checking for write errors, clearWriteError() to reset the flag to false, and a protected setWriteError() for signalling errors. http://code.google.com/p/arduino/issues/detail?id=598
This commit is contained in:
@ -440,10 +440,12 @@ int SoftwareSerial::available()
|
||||
return (_receive_buffer_tail + _SS_MAX_RX_BUFF - _receive_buffer_head) % _SS_MAX_RX_BUFF;
|
||||
}
|
||||
|
||||
ssize_t SoftwareSerial::write(uint8_t b)
|
||||
size_t SoftwareSerial::write(uint8_t b)
|
||||
{
|
||||
if (_tx_delay == 0)
|
||||
return -1;
|
||||
if (_tx_delay == 0) {
|
||||
setWriteError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t oldSREG = SREG;
|
||||
cli(); // turn off interrupts for a clean txmit
|
||||
|
Reference in New Issue
Block a user