mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-19 08:52:15 +01:00
Merge branch 'fix-flush' of https://github.com/cmaglie/Arduino
This commit is contained in:
commit
ca5aff00e8
@ -2,6 +2,9 @@ ARDUINO 1.6.7
|
||||
|
||||
[libraries]
|
||||
* SPI: Added SPI.transfer16(...) function to SAM core.
|
||||
* Ethernet, WiFi, SoftwareSerial: Fixed flush() behaviour:
|
||||
the flush function is no more dropping the receive buffer, as per
|
||||
1.0 API specification. Thanks @drmpf
|
||||
|
||||
[core]
|
||||
* Fixed wrong timings for HardwareSerial::flush() in SAM core. Thanks @borisff
|
||||
|
@ -469,13 +469,7 @@ size_t SoftwareSerial::write(uint8_t b)
|
||||
|
||||
void SoftwareSerial::flush()
|
||||
{
|
||||
if (!isListening())
|
||||
return;
|
||||
|
||||
uint8_t oldSREG = SREG;
|
||||
cli();
|
||||
_receive_buffer_head = _receive_buffer_tail = 0;
|
||||
SREG = oldSREG;
|
||||
// There is no tx buffering, simply return
|
||||
}
|
||||
|
||||
int SoftwareSerial::peek()
|
||||
|
@ -118,7 +118,12 @@ size_t EthernetUDP::write(const uint8_t *buffer, size_t size)
|
||||
int EthernetUDP::parsePacket()
|
||||
{
|
||||
// discard any remaining bytes in the last packet
|
||||
flush();
|
||||
while (_remaining) {
|
||||
// could this fail (loop endlessly) if _remaining > 0 and recv in read fails?
|
||||
// should only occur if recv fails after telling us the data is there, lets
|
||||
// hope the w5100 always behaves :)
|
||||
read();
|
||||
}
|
||||
|
||||
if (recvAvailable(_sock) > 0)
|
||||
{
|
||||
@ -206,14 +211,7 @@ int EthernetUDP::peek()
|
||||
|
||||
void EthernetUDP::flush()
|
||||
{
|
||||
// could this fail (loop endlessly) if _remaining > 0 and recv in read fails?
|
||||
// should only occur if recv fails after telling us the data is there, lets
|
||||
// hope the w5100 always behaves :)
|
||||
|
||||
while (_remaining)
|
||||
{
|
||||
read();
|
||||
}
|
||||
// TODO: we should wait for TX buffer to be emptied
|
||||
}
|
||||
|
||||
/* Start EthernetUDP socket, listening at local port PORT */
|
||||
|
@ -140,8 +140,7 @@ int WiFiClient::peek() {
|
||||
}
|
||||
|
||||
void WiFiClient::flush() {
|
||||
while (available())
|
||||
read();
|
||||
// TODO: a real check to ensure transmission has been completed
|
||||
}
|
||||
|
||||
void WiFiClient::stop() {
|
||||
|
@ -155,8 +155,7 @@ int WiFiUDP::peek()
|
||||
|
||||
void WiFiUDP::flush()
|
||||
{
|
||||
while (available())
|
||||
read();
|
||||
// TODO: a real check to ensure transmission has been completed
|
||||
}
|
||||
|
||||
IPAddress WiFiUDP::remoteIP()
|
||||
|
Loading…
x
Reference in New Issue
Block a user