mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-07 01:54:26 +01:00
Implemented multi-byte read in File::read of Bridge library.
This commit is contained in:
parent
e5e9d536ab
commit
fe6295e124
@ -137,7 +137,21 @@ int File::available() {
|
|||||||
void File::flush() {
|
void File::flush() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//int read(void *buf, uint16_t nbyte)
|
int File::read(void *buff, uint16_t nbyte) {
|
||||||
|
uint16_t n = 0;
|
||||||
|
uint8_t *p = reinterpret_cast<uint8_t *>(buff);
|
||||||
|
while (n < nbyte) {
|
||||||
|
if (buffered == 0) {
|
||||||
|
doBuffer();
|
||||||
|
if (buffered == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*p++ = buffer[readPos++];
|
||||||
|
buffered--;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t File::size() {
|
uint32_t File::size() {
|
||||||
if (bridge.getBridgeVersion() < 101)
|
if (bridge.getBridgeVersion() < 101)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user