Updated the SD librarie because it was updated in the sdk.
This commit is contained in:
parent
5c42dfce39
commit
ae72a34a80
@ -27,11 +27,7 @@ const int chipSelect = 4;
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Open serial communications and wait for port to open:
|
// Open serial communications and wait for port to open:
|
||||||
Serial.begin(9600);
|
Serial.begin(115200);
|
||||||
while (!Serial) {
|
|
||||||
; // wait for serial port to connect. Needed for Leonardo only
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Serial.print("Initializing SD card...");
|
Serial.print("Initializing SD card...");
|
||||||
|
|
||||||
|
@ -27,11 +27,7 @@ const int chipSelect = 4;
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Open serial communications and wait for port to open:
|
// Open serial communications and wait for port to open:
|
||||||
Serial.begin(9600);
|
Serial.begin(115200);
|
||||||
while (!Serial) {
|
|
||||||
; // wait for serial port to connect. Needed for Leonardo only
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Serial.print("Initializing SD card...");
|
Serial.print("Initializing SD card...");
|
||||||
|
|
||||||
|
@ -24,11 +24,7 @@ File myFile;
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Open serial communications and wait for port to open:
|
// Open serial communications and wait for port to open:
|
||||||
Serial.begin(9600);
|
Serial.begin(115200);
|
||||||
while (!Serial) {
|
|
||||||
; // wait for serial port to connect. Needed for Leonardo only
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Serial.print("Initializing SD card...");
|
Serial.print("Initializing SD card...");
|
||||||
|
|
||||||
|
@ -25,11 +25,7 @@ File myFile;
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Open serial communications and wait for port to open:
|
// Open serial communications and wait for port to open:
|
||||||
Serial.begin(9600);
|
Serial.begin(115200);
|
||||||
while (!Serial) {
|
|
||||||
; // wait for serial port to connect. Needed for Leonardo only
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Serial.print("Initializing SD card...");
|
Serial.print("Initializing SD card...");
|
||||||
|
|
||||||
|
@ -29,9 +29,6 @@ File root;
|
|||||||
void setup() {
|
void setup() {
|
||||||
// Open serial communications and wait for port to open:
|
// Open serial communications and wait for port to open:
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
while (!Serial) {
|
|
||||||
; // wait for serial port to connect. Needed for Leonardo only
|
|
||||||
}
|
|
||||||
|
|
||||||
Serial.print("Initializing SD card...");
|
Serial.print("Initializing SD card...");
|
||||||
|
|
||||||
@ -71,11 +68,12 @@ void printDirectory(File dir, int numTabs) {
|
|||||||
// files have sizes, directories do not
|
// files have sizes, directories do not
|
||||||
Serial.print("\t\t");
|
Serial.print("\t\t");
|
||||||
Serial.print(entry.size(), DEC);
|
Serial.print(entry.size(), DEC);
|
||||||
Serial.print("\t\t");
|
time_t cr = entry.getCreationTime();
|
||||||
time_t ft = entry.getLastWrite();
|
time_t lw = entry.getLastWrite();
|
||||||
struct tm *tm = localtime(&ft);
|
struct tm * tmstruct = localtime(&cr);
|
||||||
// US format. Feel free to convert to your own locale...
|
Serial.printf("\tCREATION: %d-%02d-%02d %02d:%02d:%02d", (tmstruct->tm_year) + 1900, (tmstruct->tm_mon) + 1, tmstruct->tm_mday, tmstruct->tm_hour, tmstruct->tm_min, tmstruct->tm_sec);
|
||||||
Serial.printf("%02d-%02d-%02d %02d:%02d:%02d\n", tm->tm_mon + 1, tm->tm_mday, tm->tm_year % 100, tm->tm_hour, tm->tm_min, tm->tm_sec);
|
tmstruct = localtime(&lw);
|
||||||
|
Serial.printf("\tLAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n", (tmstruct->tm_year) + 1900, (tmstruct->tm_mon) + 1, tmstruct->tm_mday, tmstruct->tm_hour, tmstruct->tm_min, tmstruct->tm_sec);
|
||||||
}
|
}
|
||||||
entry.close();
|
entry.close();
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,9 @@ close KEYWORD2
|
|||||||
seek KEYWORD2
|
seek KEYWORD2
|
||||||
position KEYWORD2
|
position KEYWORD2
|
||||||
size KEYWORD2
|
size KEYWORD2
|
||||||
rename KEYWORD2
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Constants (LITERAL1)
|
# Constants (LITERAL1)
|
||||||
#######################################
|
#######################################
|
||||||
FILE_READ LITERAL1
|
FILE_READ LITERAL1
|
||||||
FILE_WRITE LITERAL1
|
FILE_WRITE LITERAL1
|
||||||
FILE_READWRITE LITERAL1
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
name=SD(esp8266)
|
name=SD
|
||||||
version=2.0.0
|
version=2.0.0
|
||||||
author=Earle F. Philhower, III <earlephilhower@yahoo.com>
|
author=Earle F. Philhower, III <earlephilhower@yahoo.com>
|
||||||
maintainer=Earle F. Philhower, III <earlephilhower@yahoo.com>
|
maintainer=Earle F. Philhower, III <earlephilhower@yahoo.com>
|
||||||
|
@ -28,12 +28,11 @@
|
|||||||
#define FILE_READ sdfat::O_READ
|
#define FILE_READ sdfat::O_READ
|
||||||
#undef FILE_WRITE
|
#undef FILE_WRITE
|
||||||
#define FILE_WRITE (sdfat::O_READ | sdfat::O_WRITE | sdfat::O_CREAT | sdfat::O_APPEND)
|
#define FILE_WRITE (sdfat::O_READ | sdfat::O_WRITE | sdfat::O_CREAT | sdfat::O_APPEND)
|
||||||
#undef FILE_READWRITE
|
|
||||||
#define FILE_READWRITE (sdfat::O_READ | sdfat::O_WRITE)
|
#define FILE_READWRITE (sdfat::O_READ | sdfat::O_WRITE)
|
||||||
|
|
||||||
class SDClass {
|
class SDClass {
|
||||||
public:
|
public:
|
||||||
boolean begin(uint8_t csPin, SPISettings cfg = SPI_HALF_SPEED) {
|
boolean begin(uint8_t csPin, uint32_t cfg = SPI_HALF_SPEED) {
|
||||||
SDFS.setConfig(SDFSConfig(csPin, cfg));
|
SDFS.setConfig(SDFSConfig(csPin, cfg));
|
||||||
return (boolean)SDFS.begin();
|
return (boolean)SDFS.begin();
|
||||||
}
|
}
|
||||||
@ -69,6 +68,18 @@ public:
|
|||||||
return (boolean)SDFS.exists(filepath.c_str());
|
return (boolean)SDFS.exists(filepath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean rename(const char* filepathfrom, const char* filepathto) {
|
||||||
|
return (boolean)SDFS.rename(filepathfrom, filepathto);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool info64(FSInfo64& info) {
|
||||||
|
return (boolean)SDFS.info64(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean rename(const String &filepathfrom, const String &filepathto) {
|
||||||
|
return (boolean)rename(filepathfrom.c_str(), filepathto.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
boolean mkdir(const char *filepath) {
|
boolean mkdir(const char *filepath) {
|
||||||
return (boolean)SDFS.mkdir(filepath);
|
return (boolean)SDFS.mkdir(filepath);
|
||||||
}
|
}
|
||||||
@ -93,14 +104,6 @@ public:
|
|||||||
return rmdir(filepath.c_str());
|
return rmdir(filepath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rename(const char* pathFrom, const char* pathTo) {
|
|
||||||
return (boolean)SDFS.rename(pathFrom, pathTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool info64(FSInfo64& info) {
|
|
||||||
return (boolean)SDFS.info64(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t type() {
|
uint8_t type() {
|
||||||
sdfs::SDFSImpl* sd = static_cast<sdfs::SDFSImpl*>(SDFS.getImpl().get());
|
sdfs::SDFSImpl* sd = static_cast<sdfs::SDFSImpl*>(SDFS.getImpl().get());
|
||||||
return sd->type();
|
return sd->type();
|
||||||
@ -184,7 +187,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Expose FatStructs.h helpers for MSDOS date/time for use with dateTimeCallback
|
// Expose FatStructs.h helpers for MS-DOS date/time for use with dateTimeCallback
|
||||||
static inline uint16_t FAT_DATE(uint16_t year, uint8_t month, uint8_t day) {
|
static inline uint16_t FAT_DATE(uint16_t year, uint8_t month, uint8_t day) {
|
||||||
return (year - 1980) << 9 | month << 5 | day;
|
return (year - 1980) << 9 | month << 5 | day;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user