110 static inline uint16_t
FAT_DATE(uint16_t year, uint8_t month, uint8_t day) {
111 return (year - 1980) << 9 | month << 5 | day;
118 static inline uint16_t
FAT_YEAR(uint16_t fatDate) {
119 return 1980 + (fatDate >> 9);
127 return (fatDate >> 5) & 0XF;
134 static inline uint8_t
FAT_DAY(uint16_t fatDate) {
135 return fatDate & 0X1F;
144 static inline uint16_t
FAT_TIME(uint8_t hour, uint8_t minute, uint8_t second) {
145 return hour << 11 | minute << 5 | second >> 1;
153 return fatTime >> 11;
161 return(fatTime >> 5) & 0X3F;
171 return 2*(fatTime & 0X1F);
208 const char* path, uint32_t size);
243 void (*dateTime)(uint16_t* date, uint16_t* time)) {
244 dateTime_ = dateTime;
250 bool exists(
const char* name);
251 int16_t
fgets(
char* str, int16_t num,
char* delim = 0);
269 void ls( uint8_t flags = 0, uint8_t indent = 0);
272 bool makeDir(
SdBaseFile* dir,
const char* path) {
273 return mkdir(dir, path,
false);
277 bool open(
const char* path, uint8_t oflag =
O_READ);
286 int16_t
read(
void* buf, uint16_t nbyte);
296 bool rmDir() {
return rmdir();}
303 return seekSet(curPosition_ + offset);
313 bool timestamp(uint8_t flag, uint16_t year, uint8_t month, uint8_t day,
314 uint8_t hour, uint8_t minute, uint8_t second);
320 uint8_t
type()
const {
return type_;}
324 int16_t
write(
const void* buf, uint16_t nbyte);
332 static void (*dateTime_)(uint16_t* date, uint16_t* time);
337 static uint8_t
const F_FILE_DIR_DIRTY = 0X80;
343 uint32_t curCluster_;
344 uint32_t curPosition_;
348 uint32_t firstCluster_;
355 bool addDirCluster();
356 dir_t* cacheDirEntry(uint8_t action);
357 int8_t lsPrintNext( uint8_t flags, uint8_t indent);
358 static bool make83Name(
const char* str, uint8_t* name,
const char** ptr);
360 bool open(
SdBaseFile* dirFile,
const uint8_t dname[11], uint8_t oflag);
361 bool openCachedEntry(uint8_t cacheIndex, uint8_t oflags);
362 dir_t* readDirCache();
366 uint8_t width,
bool printSlash);
369 #if ALLOW_DEPRECATED_FUNCTIONS && !defined(DOXYGEN)
389 const char* path, uint32_t size) {
398 void (*dateTime)(uint16_t& date, uint16_t& time)) {
399 oldDateTime_ = dateTime;
400 dateTime_ = dateTime ? oldToNew : 0;
415 return mkdir(&dir, path);
427 const char* path, uint8_t oflag) {
428 return open(&dirFile, path, oflag);
449 return open(&dirFile, index, oflag);
468 return remove(&dirFile, path);
473 static void (*oldDateTime_)(uint16_t& date, uint16_t& time);
474 static void oldToNew(uint16_t* date, uint16_t* time) {
uint16_t const FAT_DEFAULT_TIME
Definition: SdBaseFile.h:176
static uint8_t FAT_MINUTE(uint16_t fatTime)
Definition: SdBaseFile.h:160
uint8_t const FAT_FILE_TYPE_ROOT_FIXED
Definition: SdBaseFile.h:95
uint8_t const O_CREAT
Definition: SdBaseFile.h:68
static uint16_t FAT_YEAR(uint16_t fatDate)
Definition: SdBaseFile.h:118
uint8_t const T_WRITE
Definition: SdBaseFile.h:88
uint8_t const O_SYNC
Definition: SdBaseFile.h:62
static uint16_t FAT_TIME(uint8_t hour, uint8_t minute, uint8_t second)
Definition: SdBaseFile.h:144
uint8_t const O_AT_END
Definition: SdBaseFile.h:66
uint8_t const O_APPEND
Definition: SdBaseFile.h:60
static uint8_t FAT_MONTH(uint16_t fatDate)
Definition: SdBaseFile.h:126
uint16_t const FAT_DEFAULT_DATE
Definition: SdBaseFile.h:174
static uint16_t FAT_DATE(uint16_t year, uint8_t month, uint8_t day)
Definition: SdBaseFile.h:110
uint8_t const O_WRITE
Definition: SdBaseFile.h:52
static uint8_t FAT_DAY(uint16_t fatDate)
Definition: SdBaseFile.h:134
static uint8_t FAT_SECOND(uint16_t fatTime)
Definition: SdBaseFile.h:170
uint8_t const FAT_FILE_TYPE_CLOSED
Definition: SdBaseFile.h:91
uint8_t const O_ACCMODE
Definition: SdBaseFile.h:58
uint8_t const T_CREATE
Definition: SdBaseFile.h:86
uint8_t const T_ACCESS
Definition: SdBaseFile.h:84
uint8_t const FAT_FILE_TYPE_NORMAL
Definition: SdBaseFile.h:93
uint8_t const O_WRONLY
Definition: SdBaseFile.h:54
uint8_t const LS_SIZE
Definition: SdBaseFile.h:77
uint8_t const FAT_FILE_TYPE_ROOT32
Definition: SdBaseFile.h:97
uint8_t const O_TRUNC
Definition: SdBaseFile.h:64
uint8_t const O_EXCL
Definition: SdBaseFile.h:70
uint8_t const FAT_FILE_TYPE_MIN_DIR
Definition: SdBaseFile.h:101
uint8_t const O_RDONLY
Definition: SdBaseFile.h:50
uint8_t const FAT_FILE_TYPE_SUBDIR
Definition: SdBaseFile.h:99
uint8_t const O_READ
Definition: SdBaseFile.h:48
uint8_t const LS_DATE
Definition: SdBaseFile.h:75
uint8_t const O_RDWR
Definition: SdBaseFile.h:56
static uint8_t FAT_HOUR(uint16_t fatTime)
Definition: SdBaseFile.h:152
uint8_t const LS_R
Definition: SdBaseFile.h:79
configuration definitions
Base class for SdFile with Print and C++ streams.
Definition: SdBaseFile.h:182
static void dateTimeCallbackCancel()
Definition: SdBaseFile.h:247
uint32_t curCluster() const
Definition: SdBaseFile.h:210
bool dirEntry(dir_t *dir)
Definition: SdBaseFile.cpp:182
bool dirEntry(dir_t &dir)
Definition: SdBaseFile.h:406
int16_t read()
Definition: SdBaseFile.cpp:1029
static void dateTimeCallback(void(*dateTime)(uint16_t *date, uint16_t *time))
Definition: SdBaseFile.h:242
bool close()
Definition: SdBaseFile.cpp:93
static void printFatDate(uint16_t fatDate)
Definition: SdBaseFile.cpp:988
bool printName()
Definition: SdBaseFile.cpp:1017
bool contiguousRange(uint32_t *bgnBlock, uint32_t *endBlock)
Definition: SdBaseFile.cpp:109
SdBaseFile()
Definition: SdBaseFile.h:185
bool sync()
Definition: SdBaseFile.cpp:1511
bool isRoot() const
Definition: SdBaseFile.h:266
bool getFilename(char *name)
Definition: SdBaseFile.cpp:280
bool open(SdBaseFile &dirFile, uint16_t index, uint8_t oflag)
Definition: SdBaseFile.h:448
uint32_t fileSize() const
Definition: SdBaseFile.h:253
bool rmRfStar()
Definition: SdBaseFile.cpp:1395
int16_t fgets(char *str, int16_t num, char *delim=0)
Definition: SdBaseFile.cpp:251
void getpos(filepos_t *pos)
Definition: SdBaseFile.cpp:297
bool writeError
Definition: SdBaseFile.h:193
int16_t write(const void *buf, uint16_t nbyte)
Definition: SdBaseFile.cpp:1732
void setpos(filepos_t *pos)
Definition: SdBaseFile.cpp:1498
bool contiguousRange(uint32_t &bgnBlock, uint32_t &endBlock)
Definition: SdBaseFile.h:377
bool isOpen() const
Definition: SdBaseFile.h:262
static SdBaseFile * cwd()
Definition: SdBaseFile.h:214
bool open(SdBaseFile &dirFile, const char *path, uint8_t oflag)
Definition: SdBaseFile.h:426
bool mkdir(SdBaseFile &dir, const char *path)
Definition: SdBaseFile.h:414
static void printDirName(const dir_t &dir, uint8_t width, bool printSlash)
Definition: SdBaseFile.cpp:945
uint8_t type() const
Definition: SdBaseFile.h:320
bool remove()
Definition: SdBaseFile.cpp:1201
bool seekEnd(int32_t offset=0)
Definition: SdBaseFile.h:309
bool open(SdBaseFile *dirFile, uint16_t index, uint8_t oflag)
Definition: SdBaseFile.cpp:712
bool open(SdBaseFile &dirFile, const char *path)
Definition: SdBaseFile.h:436
bool rmdir()
Definition: SdBaseFile.cpp:1354
void ls(uint8_t flags=0, uint8_t indent=0)
Definition: SdBaseFile.cpp:318
void rewind()
Definition: SdBaseFile.h:292
bool isFile() const
Definition: SdBaseFile.h:260
bool isDir() const
Definition: SdBaseFile.h:258
uint32_t firstCluster() const
Definition: SdBaseFile.h:255
static void dirName(const dir_t &dir, char *name)
Definition: SdBaseFile.cpp:205
bool createContiguous(SdBaseFile &dirFile, const char *path, uint32_t size)
Definition: SdBaseFile.h:388
static void dateTimeCallback(void(*dateTime)(uint16_t &date, uint16_t &time))
Definition: SdBaseFile.h:397
int peek()
Definition: SdBaseFile.cpp:930
bool truncate(uint32_t size)
Definition: SdBaseFile.cpp:1670
static void printFatTime(uint16_t fatTime)
Definition: SdBaseFile.cpp:1004
bool exists(const char *name)
Definition: SdBaseFile.cpp:226
bool seekCur(int32_t offset)
Definition: SdBaseFile.h:302
bool isSubDir() const
Definition: SdBaseFile.h:264
bool openRoot(SdVolume *vol)
Definition: SdBaseFile.cpp:893
uint32_t curPosition() const
Definition: SdBaseFile.h:212
bool createContiguous(SdBaseFile *dirFile, const char *path, uint32_t size)
Definition: SdBaseFile.cpp:149
bool mkdir(SdBaseFile *dir, const char *path, bool pFlag=true)
Definition: SdBaseFile.cpp:431
bool rename(SdBaseFile *dirFile, const char *newPath)
Definition: SdBaseFile.cpp:1261
int8_t readDir(dir_t *dir, char *longFilename)
Definition: SdBaseFile.cpp:1114
bool timestamp(SdBaseFile *file)
Definition: SdBaseFile.cpp:1553
bool openNext(SdBaseFile *dirFile, uint8_t oflag)
Definition: SdBaseFile.cpp:794
int8_t readDir(dir_t &dir, char *longFilename)
Definition: SdBaseFile.h:460
static bool remove(SdBaseFile &dirFile, const char *path)
Definition: SdBaseFile.h:467
bool openParent(SdBaseFile *dir)
Definition: SdBaseFile.cpp:836
SdVolume * volume() const
Definition: SdBaseFile.h:323
bool openRoot(SdVolume &vol)
Definition: SdBaseFile.h:455
bool seekSet(uint32_t pos)
Definition: SdBaseFile.cpp:1459
Access FAT16 and FAT32 volumes on SD and SDHC cards.
Definition: SdVolume.h:60
FAT short directory entry.
Definition: SdFatStructs.h:496
internal type for istream do not use in user apps
Definition: SdBaseFile.h:38
uint32_t position
Definition: SdBaseFile.h:40
uint32_t cluster
Definition: SdBaseFile.h:42