1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-13 10:29:35 +01:00

Added missing File::size() method to Bridge.

This commit is contained in:
Cristian Maglie 2013-11-22 15:04:23 +01:00
parent 061d71e123
commit fcb20ea80c

View File

@ -139,7 +139,19 @@ void File::flush() {
//int read(void *buf, uint16_t nbyte)
//uint32_t size()
uint32_t File::size() {
if (bridge.getBridgeVersion() < 101)
return 0;
uint8_t cmd[] = {'t', handle};
uint8_t buff[5];
bridge.transfer(cmd, 2, buff, 5);
//err = res[0]; // First byte is error code
uint32_t res = buff[1] << 24;
res += buff[2] << 16;
res += buff[3] << 8;
res += buff[4];
return res;
}
void File::close() {
if (mode == 255)