diff options
author | Cristian Maglie <c.maglie@bug.st> | 2013-06-10 11:50:00 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2013-06-10 11:50:00 +0200 |
commit | 1ea21ee38a9155a9029f53712f4f369884cfbb94 (patch) | |
tree | 90e337dbe197270be15e706a5397498757769e65 /libraries/Bridge | |
parent | 5cb9a004bc81aae296ca9a9447ff6faf803dea39 (diff) |
Implemented FileIO.position()
Diffstat (limited to 'libraries/Bridge')
-rw-r--r-- | libraries/Bridge/FileIO.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libraries/Bridge/FileIO.cpp b/libraries/Bridge/FileIO.cpp index bd8f487..c66f937 100644 --- a/libraries/Bridge/FileIO.cpp +++ b/libraries/Bridge/FileIO.cpp @@ -96,6 +96,18 @@ boolean File::seek(uint32_t position) { return false; } +uint32_t File::position() { + uint8_t cmd[] = {'S', handle}; + uint8_t res[5]; + bridge.transfer(cmd, 2, res, 5); + //err = res[0]; // res[0] contains error code + uint32_t pos = res[1] << 24; + pos += res[2] << 16; + pos += res[3] << 8; + pos += res[4]; + return pos - buffered; +} + void File::doBuffer() { // If there are already char in buffer exit if (buffered > 0) @@ -124,7 +136,6 @@ void File::flush() { //int read(void *buf, uint16_t nbyte) -//uint32_t position() //uint32_t size() void File::close() { |