1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-18 07:52:14 +01:00

Implemented FileIO.position()

This commit is contained in:
Cristian Maglie 2013-06-10 11:50:00 +02:00
parent b41d62b516
commit 4392938f6a

View File

@ -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() {