-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileSystem.h
46 lines (37 loc) · 1.04 KB
/
FileSystem.h
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
/*
* FileSystem.h – various utilities for reading SD card and loading files
* matching filename pattern or an extension.
*
* Created on: Dec 2, 2014
* Author: kig
*/
#include "FlixCapacitor.h"
#ifdef ENABLE_AUDIO_SD
#ifndef FILESYSTEM_H_
#define FILESYSTEM_H_
#include <SD.h>
typedef struct FileListStruct {
char *parentFolder;
char **files;
int size;
int currentIndex;
int allocated;
} FileList;
enum direction { PREVIOUS = -1, CURRENT = 0, NEXT = 1};
class FileSystem {
public:
FileSystem(uint8_t pinCS);
virtual ~FileSystem();
bool initSDCard();
bool hasInitialized();
FileList *findFilesMatchingExtension(char *folder, char *extension);
bool nextFileInList(FileList *fileList, char* fullPath, direction dir);
bool randomFileInList(FileList *fileList, char* fullPath);
private:
void saveDirectory(FileList *fileList, File dir, int level, char *match);
bool sdCardInitialized;
uint8_t pinCS; // pin where slave select on SD is located
char buf[50];
};
#endif /* FILESYSTEM_H_ */
#endif /* ENABLE_AUDIO_SD */