Fixed flush

It behaved like prior Arduino 1.0
This commit is contained in:
Kristian Lauszus 2013-11-25 18:15:10 +01:00
parent a31cc42585
commit 148b67ca2d
3 changed files with 8 additions and 5 deletions

View file

@ -801,7 +801,7 @@ int SPP::available(void) {
return rfcommAvailable; return rfcommAvailable;
}; };
void SPP::flush(void) { void SPP::discard(void) {
rfcommAvailable = 0; rfcommAvailable = 0;
} }

8
SPP.h
View file

@ -130,8 +130,10 @@ public:
* @return Return the number of bytes ready to be read. * @return Return the number of bytes ready to be read.
*/ */
virtual int available(void); virtual int available(void);
/** Discard all the bytes in the buffer. */ /** Send out all bytes in the buffer. */
virtual void flush(void); virtual void flush(void) {
send();
};
/** /**
* Used to read the next value in the buffer without advancing to the next one. * Used to read the next value in the buffer without advancing to the next one.
* @return Return the byte. Will return -1 if no bytes are available. * @return Return the byte. Will return -1 if no bytes are available.
@ -157,6 +159,8 @@ public:
virtual size_t write(const uint8_t* data, size_t size); virtual size_t write(const uint8_t* data, size_t size);
/** Pull in write(const char *str) from Print */ /** Pull in write(const char *str) from Print */
using Print::write; using Print::write;
/** Discard all the bytes in the buffer. */
void discard(void);
/** /**
* This will send all the bytes in the buffer. * This will send all the bytes in the buffer.
* This is called whenever Usb.Task() is called, * This is called whenever Usb.Task() is called,

View file

@ -228,8 +228,7 @@ SPP KEYWORD1
#################################################### ####################################################
connected KEYWORD2 connected KEYWORD2
printNumber KEYWORD2 discard KEYWORD2
printNumberln KEYWORD2
#################################################### ####################################################
# Syntax Coloring Map For Wiimote Library # Syntax Coloring Map For Wiimote Library