1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-23 19:21:59 +03:00

Add SPIFFS::end (#1657)

This commit is contained in:
Ivan Grokhotkov
2016-05-20 10:20:04 +08:00
parent 43fb139ed8
commit 5313c56f24
5 changed files with 26 additions and 1 deletions

View File

@ -167,6 +167,12 @@ bool FS::begin() {
return _impl->begin();
}
void FS::end() {
if (_impl) {
_impl->end();
}
}
bool FS::format() {
if (!_impl) {
return false;

View File

@ -102,7 +102,8 @@ public:
FS(FSImplPtr impl) : _impl(impl) { }
bool begin();
void end();
bool format();
bool info(FSInfo& info);

View File

@ -63,6 +63,7 @@ public:
class FSImpl {
public:
virtual bool begin() = 0;
virtual void end() = 0;
virtual bool format() = 0;
virtual bool info(FSInfo& info) = 0;
virtual FileImplPtr open(const char* path, OpenMode openMode, AccessMode accessMode) = 0;

View File

@ -132,6 +132,14 @@ public:
return _tryMount();
}
void end() override
{
if (SPIFFS_mounted(&_fs) == 0) {
return;
}
SPIFFS_unmount(&_fs);
}
bool format() override
{
if (_size == 0) {