add file seek
This commit is contained in:
1 parent
5c9fa09a93
commit
aa5b285b26
4 files changed
+10
-1
No files matched your search
@@ -107,7 +107,7 @@ void File::flush (void)
|
||||
|
||||
bool File::seek (uint32_t pos)
|
||||
{
|
||||
|
||||
return _fs->_f_seek(_hdl, pos);
|
||||
}
|
||||
|
||||
uint32_t File::position (void)
|
||||
|
||||
@@ -85,6 +85,7 @@ class File: public Stream
|
||||
friend class ::LittleFS;
|
||||
};
|
||||
|
||||
// Abstract Interface Class
|
||||
class FileSystemClass
|
||||
{
|
||||
public:
|
||||
@@ -114,6 +115,8 @@ class FileSystemClass
|
||||
virtual int _f_read (void* fhdl, void *buf, uint16_t nbyte) = 0;
|
||||
virtual void _f_flush (void* fhdl) = 0;
|
||||
virtual void _f_close (void* fhdl) = 0;
|
||||
|
||||
virtual bool _f_seek (void* fhdl, uint32_t pos) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -248,6 +248,11 @@ int LittleFS::_f_read (void* fhdl, void *buf, uint16_t nbyte)
|
||||
return lfs_file_read(&_lfs, (lfs_file_t*) fhdl, buf, nbyte);
|
||||
}
|
||||
|
||||
bool LittleFS::_f_seek (void* fhdl, uint32_t pos)
|
||||
{
|
||||
return lfs_file_seek(&_lfs, (lfs_file_t*) fhdl, pos, LFS_SEEK_SET) >= 0;
|
||||
}
|
||||
|
||||
void LittleFS::_f_close (void* fhdl)
|
||||
{
|
||||
lfs_file_close(&_lfs, (lfs_file_t*) fhdl);
|
||||
|
||||
@@ -60,6 +60,7 @@ class LittleFS: public BluefuritLib::FileSystemClass
|
||||
virtual int _f_read (void* fhdl, void *buf, uint16_t nbyte);
|
||||
virtual void _f_flush (void* fhdl);
|
||||
virtual void _f_close (void* fhdl);
|
||||
virtual bool _f_seek (void* fhdl, uint32_t pos);
|
||||
|
||||
private:
|
||||
struct lfs_config _lfs_cfg;
|
||||
|
||||
Reference in new issue
Block a user