mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Added flush()
This commit is contained in:
parent
36044a4356
commit
702b07d03c
2 changed files with 3 additions and 0 deletions
2
SPP.cpp
2
SPP.cpp
|
@ -823,6 +823,8 @@ void SPP::printNumberln(uint16_t n) {
|
|||
}
|
||||
|
||||
uint8_t SPP::read() {
|
||||
if(rfcommAvailable == 0) // Don't read if there is nothing in the buffer
|
||||
return 0;
|
||||
uint8_t output = rfcommDataBuffer[0];
|
||||
for(uint8_t i = 1; i < rfcommAvailable; i++)
|
||||
rfcommDataBuffer[i-1] = rfcommDataBuffer[i]; // Shift the buffer one left
|
||||
|
|
1
SPP.h
1
SPP.h
|
@ -120,6 +120,7 @@ public:
|
|||
|
||||
uint8_t available() { return rfcommAvailable; }; // Get the bytes waiting to be read
|
||||
uint8_t read(); // Used to read the buffer
|
||||
void flush() { rfcommAvailable = 0; }; // Discard all the bytes in the buffer
|
||||
|
||||
private:
|
||||
/* Bluetooth dongle library pointer */
|
||||
|
|
Loading…
Reference in a new issue