/ firmware / include / storage.h
storage.h
 1  #pragma once
 2  
 3  #include <stdint.h>
 4  
 5  enum class StorageKind { LittleFS, SD };
 6  
 7  struct StorageSnapshot {
 8    bool mounted;
 9    StorageKind kind;
10    uint64_t total_bytes;
11    uint64_t used_bytes;
12    uint64_t free_bytes;
13  };
14  
15  struct StorageQuery {
16    StorageKind kind;
17    StorageSnapshot snapshot;
18  };
19  
20  namespace hardware::storage {
21  
22  void initialize();
23  bool ensureLittleFS();
24  bool ensureSD();
25  bool isLittleFSReady();
26  bool isSDReady();
27  bool accessSnapshot(StorageQuery *query);
28  
29  }
30