Implemented multi-byte read in File::read of Bridge library.

This commit is contained in:
Cristian Maglie 2013-11-22 15:41:49 +01:00
parent e5e9d536ab
commit fe6295e124
1 changed files with 15 additions and 1 deletions

View File

@ -137,7 +137,21 @@ int File::available() {
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() {
if (bridge.getBridgeVersion() < 101)