2017-02-20 13:55:16 -05:00
|
|
|
#ifndef __TEENSYFILEMANAGER_H
|
|
|
|
#define __TEENSYFILEMANAGER_H
|
|
|
|
|
|
|
|
#include "filemanager.h"
|
|
|
|
#include <stdint.h>
|
2020-07-06 07:04:22 -04:00
|
|
|
#include <SD.h>
|
|
|
|
#include <SPI.h>
|
2017-02-20 13:55:16 -05:00
|
|
|
|
|
|
|
class TeensyFileManager : public FileManager {
|
|
|
|
public:
|
|
|
|
TeensyFileManager();
|
|
|
|
virtual ~TeensyFileManager();
|
2017-12-30 15:20:34 -05:00
|
|
|
|
2017-02-20 13:55:16 -05:00
|
|
|
virtual int8_t openFile(const char *name);
|
|
|
|
virtual void closeFile(int8_t fd);
|
|
|
|
|
|
|
|
virtual const char *fileName(int8_t fd);
|
|
|
|
|
2020-07-11 07:39:56 -04:00
|
|
|
virtual int16_t readDir(const char *where, const char *suffix, char *outputFN, int16_t startIdx, uint16_t maxlen);
|
|
|
|
virtual void closeDir();
|
|
|
|
|
2018-02-07 10:20:26 -05:00
|
|
|
virtual void getRootPath(char *toWhere, int8_t maxLen);
|
2019-02-20 22:06:55 -05:00
|
|
|
|
|
|
|
virtual bool setSeekPosition(int8_t fd, uint32_t pos);
|
|
|
|
virtual void seekToEnd(int8_t fd);
|
2020-06-28 09:21:27 -04:00
|
|
|
|
|
|
|
virtual int write(int8_t fd, const void *buf, int nbyte);
|
|
|
|
virtual int read(int8_t fd, void *buf, int nbyte);
|
|
|
|
virtual int lseek(int8_t fd, int offset, int whence);
|
2017-12-29 15:35:47 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool _prepCache(int8_t fd);
|
2017-12-29 14:08:49 -05:00
|
|
|
|
2017-02-20 13:55:16 -05:00
|
|
|
private:
|
2020-07-06 07:04:22 -04:00
|
|
|
int8_t numCached;
|
2018-01-07 05:08:29 -05:00
|
|
|
|
2020-07-06 07:04:22 -04:00
|
|
|
int8_t cacheFd;
|
|
|
|
File cacheFile;
|
2017-02-20 13:55:16 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|