1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-21 12:29:23 +01:00

Renaming constants: SD_MODE -> FILE_MODE

This commit is contained in:
David A. Mellis 2010-11-28 13:56:22 -06:00
parent ff89afb606
commit a78fa1d2be
3 changed files with 11 additions and 11 deletions

View File

@ -15,21 +15,21 @@ void setup()
ATS_PrintTestStatus("SD.begin()", b = SD.begin(4));
if (!b) goto done;
f = SD.open("test.txt", SD_TRUNCATE);
f = SD.open("test.txt", FILE_TRUNCATE);
ATS_PrintTestStatus("SD.open()", f);
if (!f) goto done;
f.print("1234");
f.close();
f = SD.open("test.txt", SD_TRUNCATE);
f = SD.open("test.txt", FILE_TRUNCATE);
ATS_PrintTestStatus("SD.open()", f);
if (!f) goto done;
f.print("abcde");
f.close();
f = SD.open("test.txt", SD_APPEND);
f = SD.open("test.txt", FILE_APPEND);
ATS_PrintTestStatus("SD.open()", f);
if (!f) goto done;
@ -71,7 +71,7 @@ void setup()
f.close();
f = SD.open("test2.txt", SD_TRUNCATE);
f = SD.open("test2.txt", FILE_TRUNCATE);
ATS_PrintTestStatus("SD.open()", f);
if (!f) goto done;

View File

@ -13,7 +13,7 @@ void setup()
if (!b) goto done;
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf.txt"));
ATS_PrintTestStatus("SD.open()", f = SD.open("asdf.txt", SD_TRUNCATE)); f.close();
ATS_PrintTestStatus("SD.open()", f = SD.open("asdf.txt", FILE_TRUNCATE)); f.close();
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf.txt"));
ATS_PrintTestStatus("SD.exists()", SD.exists("/asdf.txt"));
ATS_PrintTestStatus("SD.remove()", SD.remove("asdf.txt"));
@ -48,13 +48,13 @@ void setup()
ATS_PrintTestStatus("!SD.exists()", !SD.exists("x/y"));
ATS_PrintTestStatus("!SD.exists()", !SD.exists("x/y/z"));
ATS_PrintTestStatus("!SD.open()", !(f = SD.open("asdf/asdf.txt", SD_TRUNCATE))); f.close();
ATS_PrintTestStatus("!SD.open()", !(f = SD.open("asdf/asdf.txt", FILE_TRUNCATE))); f.close();
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf"));
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf.txt"));
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf/asdf.txt"));
ATS_PrintTestStatus("SD.mkdir()", SD.mkdir("asdf"));
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf"));
ATS_PrintTestStatus("SD.open()", f = SD.open("asdf/asdf.txt", SD_TRUNCATE)); f.close();
ATS_PrintTestStatus("SD.open()", f = SD.open("asdf/asdf.txt", FILE_TRUNCATE)); f.close();
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf/asdf.txt"));
ATS_PrintTestStatus("!SD.rmdir()", !SD.rmdir("asdf"));
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf"));

View File

@ -20,9 +20,9 @@
#include <utility/SdFat.h>
#include <utility/SdFatUtil.h>
#define SD_READ O_READ
#define SD_TRUNCATE (O_WRITE | O_CREAT | O_TRUNC)
#define SD_APPEND (O_WRITE | O_CREAT | O_APPEND)
#define FILE_READ O_READ
#define FILE_TRUNCATE (O_WRITE | O_CREAT | O_TRUNC)
#define FILE_APPEND (O_WRITE | O_CREAT | O_APPEND)
class File : public Stream {
public:
@ -53,7 +53,7 @@ public:
// Open the specified file/directory with the supplied mode (e.g. read or
// write, etc). Returns a File object for interacting with the file.
// Note that currently only one file can be open at a time.
File open(char *filename, uint8_t mode = SD_READ);
File open(char *filename, uint8_t mode = FILE_READ);
// Methods to determine if the requested file path exists.
boolean exists(char *filepath);