-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileSystem.cpp
59 lines (47 loc) · 1.02 KB
/
FileSystem.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "FileSystem.h"
#include "EpUtil.h"
#include "WiFiSerial.h"
// #include "FS.h"
// #include <LittleFS.h>
namespace FileSystem
{
constexpr bool format_littlefs_if_failed = true;
void writeData(int value)
{
// File file = SPIFFS.open(filename, FILE_WRITE);
File file = EP_FS.open(filename, FILE_WRITE);
if (!file)
{
dlog("Unable to open file test.txt for writing.");
return;
}
// if (!file.printf("%d", value))
// dlog("Unable to write value.");
if (!file.print("herbert"))
dlog("Unable to write test string");
file.close();
}
int readData()
{
//FIXME
// int value = 0;
int value = 666666;
File file = EP_FS.open(filename, FILE_READ);
if (!file)
{
dlog("Unable to open file test.txt for reading.");
return value;
}
file.close();
return value;
}
void begin()
{
if (!EP_FS.begin(format_littlefs_if_failed))
{
dlog("FS mount failed");
return;
}
dlog("FS mounted");
}
}