2017-02-20 18:55:16 +00:00
|
|
|
#ifndef __TEENSYFILEMANAGER_H
|
|
|
|
#define __TEENSYFILEMANAGER_H
|
|
|
|
|
|
|
|
#include "filemanager.h"
|
|
|
|
#include <stdint.h>
|
2020-08-03 00:34:48 +00:00
|
|
|
#include <SdFat.h>
|
2020-07-06 11:04:22 +00:00
|
|
|
#include <SPI.h>
|
2017-02-20 18:55:16 +00:00
|
|
|
|
|
|
|
class TeensyFileManager : public FileManager {
|
|
|
|
public:
|
|
|
|
TeensyFileManager();
|
|
|
|
virtual ~TeensyFileManager();
|
2017-12-30 20:20:34 +00:00
|
|
|
|
2017-02-20 18:55:16 +00:00
|
|
|
virtual int8_t openFile(const char *name);
|
|
|
|
virtual void closeFile(int8_t fd);
|
|
|
|
|
|
|
|
virtual const char *fileName(int8_t fd);
|
|
|
|
|
2020-07-11 11:39:56 +00: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 15:20:26 +00:00
|
|
|
virtual void getRootPath(char *toWhere, int8_t maxLen);
|
2019-02-21 03:06:55 +00:00
|
|
|
|
|
|
|
virtual bool setSeekPosition(int8_t fd, uint32_t pos);
|
|
|
|
virtual void seekToEnd(int8_t fd);
|
2020-06-28 13:21:27 +00: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);
|
2022-01-07 17:50:13 +00:00
|
|
|
|
|
|
|
virtual void flush();
|
|
|
|
|
2017-12-29 20:35:47 +00:00
|
|
|
private:
|
|
|
|
bool _prepCache(int8_t fd);
|
2017-12-29 19:08:49 +00:00
|
|
|
|
2017-02-20 18:55:16 +00:00
|
|
|
private:
|
2020-07-06 11:04:22 +00:00
|
|
|
int8_t numCached;
|
2018-01-07 10:08:29 +00:00
|
|
|
|
2020-07-06 11:04:22 +00:00
|
|
|
int8_t cacheFd;
|
2017-02-20 18:55:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|