Skip to content

Commit b28c423

Browse files
committed
Fixes for pull comments
1 parent 747ab2e commit b28c423

File tree

2 files changed

+43
-7
lines changed

2 files changed

+43
-7
lines changed

libraries/SPIFFS/src/SPIFFS.cpp

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
extern "C" {
216
#include <sys/unistd.h>
317
#include <sys/stat.h>
@@ -13,12 +27,14 @@ SPIFFSImpl::SPIFFSImpl()
1327
{
1428
}
1529

16-
bool SPIFFSImpl::exists(const char* path) {
30+
bool SPIFFSImpl::exists(const char* path)
31+
{
1732
File f = open(path, "r");
1833
return (f == true) && !f.isDirectory();
1934
}
2035

21-
SPIFFSFS::SPIFFSFS() : FS(FSImplPtr(new SPIFFSImpl())) {
36+
SPIFFSFS::SPIFFSFS() : FS(FSImplPtr(new SPIFFSImpl()))
37+
{
2238

2339
}
2440

@@ -62,7 +78,8 @@ void SPIFFSFS::end()
6278
}
6379
}
6480

65-
bool SPIFFSFS::format() {
81+
bool SPIFFSFS::format()
82+
{
6683
disableCore0WDT();
6784
esp_err_t err = esp_spiffs_format(NULL);
6885
enableCore0WDT();
@@ -73,15 +90,17 @@ bool SPIFFSFS::format() {
7390
return true;
7491
}
7592

76-
size_t SPIFFSFS::totalBytes() {
93+
size_t SPIFFSFS::totalBytes()
94+
{
7795
size_t total,used;
7896
if(esp_spiffs_info(NULL, &total, &used)){
7997
return 0;
8098
}
8199
return total;
82100
}
83101

84-
size_t SPIFFSFS::usedBytes() {
102+
size_t SPIFFSFS::usedBytes()
103+
{
85104
size_t total,used;
86105
if(esp_spiffs_info(NULL, &total, &used)){
87106
return 0;

libraries/SPIFFS/src/SPIFFS.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
#ifndef _SPIFFS_H_
15+
#define _SPIFFS_H_
16+
117
#pragma once
218

319
#include "FS.h"
@@ -10,15 +26,15 @@ namespace fs
1026
class SPIFFSImpl : public VFSImpl
1127
{
1228
public:
13-
SPIFFSImpl();
29+
SPIFFSImpl();
1430
virtual ~SPIFFSImpl() { }
1531
virtual bool exists(const char* path);
1632
};
1733

1834
class SPIFFSFS : public FS
1935
{
2036
public:
21-
SPIFFSFS();
37+
SPIFFSFS();
2238
bool begin(bool formatOnFail=false, const char * basePath="/spiffs", uint8_t maxOpenFiles=10);
2339
bool format();
2440
size_t totalBytes();
@@ -31,3 +47,4 @@ class SPIFFSFS : public FS
3147
extern fs::SPIFFSFS SPIFFS;
3248

3349

50+
#endif

0 commit comments

Comments
 (0)