1
0
mirror of https://github.com/jscrane/r65emu.git synced 2024-11-16 21:10:58 +00:00

add USE_FS

This commit is contained in:
Stephen Crane 2018-11-16 12:30:09 +00:00
parent bb1c69f48a
commit 5cceb03cc7
4 changed files with 13 additions and 8 deletions

View File

@ -20,6 +20,7 @@
// "tape" storage...
#undef USE_SD
#undef USE_FS
#define USE_SPIFFS
// sound: dac and pwm

View File

@ -16,6 +16,7 @@
// "tape" storage...
#undef USE_SD
#undef USE_FS
#define USE_SPIFFS
// sound: dac and pwm

View File

@ -21,6 +21,7 @@
// "tape" storage...
#undef USE_SD
#undef USE_SPIFFS
#define USE_FS
// sound
#define PWM_SOUND D2

View File

@ -7,7 +7,7 @@
#elif defined(USE_SPIFFS)
#include <SPIFFS.h>
#define DISK SPIFFS
#elif defined(ESP8266)
#elif defined(USE_FS)
#include <FS.h>
#endif
@ -15,14 +15,16 @@
#if defined(DISK)
static File file, dir;
#elif defined(ESP8266)
#elif defined(USE_FS)
static File file;
static Dir dir;
#endif
#define STORAGE defined(USE_SD) || defined(USE_SPIFFS) || defined(USE_FS)
bool sdtape::start(const char *programs)
{
#if defined(ESP8266)
#if defined(USE_FS)
dir = SPIFFS.openDir("/");
#elif defined(DISK)
dir = DISK.open(programs);
@ -36,14 +38,14 @@ bool sdtape::start(const char *programs)
void sdtape::stop()
{
#if defined(DISK) || defined(ESP8266)
#if defined(STORAGE)
file.close();
#endif
}
bool sdtape::more()
{
#if defined(DISK) || defined(ESP8266)
#if defined(STORAGE)
if (_pos >= _len) {
_pos = 0;
_len = file.read(_buf, sizeof(_buf));
@ -56,10 +58,10 @@ bool sdtape::more()
}
const char *sdtape::advance() {
#if defined(DISK) || defined(ESP8266)
#if defined(STORAGE)
bool rewound = false;
file.close();
#if defined(ESP8266)
#if defined(USE_FS)
static char buf[32];
while (true) {
if (dir.next()) {
@ -92,7 +94,7 @@ const char *sdtape::advance() {
}
const char *sdtape::rewind() {
#if defined(DISK) && !defined(ESP8266)
#if defined(DISK)
dir.rewindDirectory();
#endif
return advance();