-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvfs_register.cpp
More file actions
38 lines (30 loc) · 764 Bytes
/
vfs_register.cpp
File metadata and controls
38 lines (30 loc) · 764 Bytes
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
#include <Arduino.h>
#include <esp_vfs.h>
static int my_open(const char* path, int flags, int mode) {
(void)flags; (void)mode;
Serial.print("VFS open: ");
Serial.println(path);
return 1;
}
static int my_close(int fd) {
(void)fd;
Serial.println("VFS close");
return 0;
}
void setup() {
Serial.begin(115200);
esp_vfs_t vfs = {};
vfs.open = my_open;
vfs.close = my_close;
esp_err_t err = esp_vfs_register("/myfs", &vfs, nullptr);
if (err == ESP_OK) {
Serial.println("Custom VFS registered at /myfs");
}
Serial.print("VFS entries: ");
Serial.println((int)esp32emu::vfs::count());
esp_vfs_unregister("/myfs");
Serial.println("VFS unregistered");
}
void loop() {
delay(1000);
}