2019-03-30 11:55:34 +00:00
|
|
|
#ifndef __FLASH_FILER_H__
|
|
|
|
#define __FLASH_FILER_H__
|
|
|
|
|
2023-10-20 12:01:15 +00:00
|
|
|
#define MAX_FILES 5
|
2023-10-19 14:04:28 +00:00
|
|
|
|
|
|
|
class flash_file: virtual public serialio {
|
|
|
|
public:
|
|
|
|
flash_file(uint8_t fd = 0): _fd(fd) {}
|
|
|
|
|
|
|
|
virtual bool more();
|
|
|
|
virtual uint8_t read();
|
|
|
|
virtual void write(uint8_t);
|
|
|
|
|
|
|
|
bool seek(uint32_t pos);
|
2023-10-20 12:01:15 +00:00
|
|
|
operator bool() const;
|
2023-10-19 14:04:28 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const uint8_t _fd;
|
|
|
|
};
|
|
|
|
|
|
|
|
class flash_filer: public filer, public flash_file {
|
2019-03-30 11:55:34 +00:00
|
|
|
public:
|
|
|
|
flash_filer(const char *programs): _programs(programs) {}
|
|
|
|
|
|
|
|
const char *advance();
|
|
|
|
const char *rewind();
|
|
|
|
|
|
|
|
const char *checkpoint();
|
|
|
|
void restore(const char *);
|
|
|
|
|
|
|
|
bool start();
|
|
|
|
void stop();
|
2023-10-19 14:04:28 +00:00
|
|
|
|
|
|
|
void select(uint8_t f) { _current = f; }
|
2019-03-30 11:55:34 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const char *_programs;
|
2023-10-19 14:04:28 +00:00
|
|
|
uint8_t _current;
|
2019-03-30 11:55:34 +00:00
|
|
|
};
|
|
|
|
#endif
|