#ifndef TEENSY_RESAMPLING_INDEXABLESERIALFLASH_FILE_H #define TEENSY_RESAMPLING_INDEXABLESERIALFLASH_FILE_H #include #include "IndexableFile.h" #include #include namespace newdigate { template // BUFFER_SIZE needs to be a power of two class IndexableSerialFlashFile : public IndexableFile { public: static_assert(isPowerOf2(BUFFER_SIZE), "BUFFER_SIZE must be a power of 2"); IndexableSerialFlashFile(SerialFlashChip &fs, const char *filename) : IndexableFile(filename), _myFS(fs) { IndexableFile::_file = _myFS.open(filename); } SerialFlashFile open(const char *filename) override { return _myFS.open(filename); } virtual ~IndexableSerialFlashFile() { IndexableFile::close(); } int16_t &operator[](int i) { return IndexableFile::operator[](i); } private: SerialFlashChip &_myFS; }; } #endif //TEENSY_RESAMPLING_INDEXABLESERIALFLASH_FILE_H