|
-
- #ifndef SdFat_h
- #define SdFat_h
-
-
-
- #define DBG_FAIL_MACRO
-
-
- #define SD_FAT_VERSION 20140824
-
-
- #if !defined(ARDUINO) || ARDUINO < 100
- #error Arduino IDE must be 1.0 or greater
- #endif
-
- #include <SdFile.h>
- #include <SdStream.h>
- #include <ArduinoStream.h>
- #include <MinimumSerial.h>
-
-
- class SdFat {
- public:
- SdFat() {}
-
- Sd2Card* card() {return &m_card;}
- bool chdir(bool set_cwd = false);
- bool chdir(const char* path, bool set_cwd = false);
- void chvol();
- void errorHalt();
- void errorHalt(char const *msg);
- void errorPrint();
- void errorPrint(char const *msg);
- bool exists(const char* name);
- bool begin(uint8_t chipSelectPin = SD_CHIP_SELECT_PIN,
- uint8_t sckDivisor = SPI_FULL_SPEED);
- void initErrorHalt();
- void initErrorHalt(char const *msg);
- void initErrorPrint();
- void initErrorPrint(char const *msg);
- void ls(uint8_t flags = 0);
- void ls(const char* path, uint8_t flags = 0);
- void ls(Print* pr, uint8_t flags = 0);
- void ls(Print* pr, const char* path, uint8_t flags = 0);
- bool mkdir(const char* path, bool pFlag = true);
- bool remove(const char* path);
- bool rename(const char *oldPath, const char *newPath);
- bool rmdir(const char* path);
- bool truncate(const char* path, uint32_t length);
-
- SdVolume* vol() {return &m_vol;}
-
- SdBaseFile* vwd() {return &m_vwd;}
-
- void errorHalt_P(PGM_P msg);
- void errorPrint_P(PGM_P msg);
- void initErrorHalt_P(PGM_P msg);
- void initErrorPrint_P(PGM_P msg);
-
-
-
- static void setStdOut(Print* stream) {m_stdOut = stream;}
-
- static Print* stdOut() {return m_stdOut;}
-
- private:
- Sd2Card m_card;
- SdVolume m_vol;
- SdBaseFile m_vwd;
- static Print* m_stdOut;
- };
- #endif
|