mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
Further SD API cleanup.
Making file and fileOpenMode private. Removing old functions.
This commit is contained in:
@ -327,8 +327,7 @@ void SDClass::begin(uint8_t csPin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
File SDClass::open(char *filepath,
|
File SDClass::open(char *filepath, boolean write, boolean append) {
|
||||||
boolean write, boolean append) {
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Open the supplied file path for reading or writing.
|
Open the supplied file path for reading or writing.
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MEMORY_CARD_DEVICE_H__
|
#ifndef __SD_H__
|
||||||
#define __MEMORY_CARD_DEVICE_H__
|
#define __SD_H__
|
||||||
|
|
||||||
#include <WProgram.h>
|
#include <WProgram.h>
|
||||||
|
|
||||||
@ -43,37 +43,34 @@ class SDClass {
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// This needs to be called to set up the connection to the memory card
|
// This needs to be called to set up the connection to the SD card
|
||||||
// before other methods are used.
|
// before other methods are used.
|
||||||
void begin(uint8_t csPin = SD_CARD_CHIP_SELECT_PIN);
|
void begin(uint8_t csPin = SD_CARD_CHIP_SELECT_PIN);
|
||||||
|
|
||||||
// Open the specified file/directory with the supplied mode (e.g. read or
|
// Open the specified file/directory with the supplied mode (e.g. read or
|
||||||
// write, etc). Once opened the file can be accessed via the
|
// write, etc). Returns a File object for interacting with the file.
|
||||||
// `MemoryCard.file` field which is a standard `sdfatlib` file object.
|
// Note that currently only one file can be open at a time.
|
||||||
File open(char *filename, boolean write = false, boolean append = true);
|
File open(char *filename, boolean write = false, boolean append = true);
|
||||||
|
|
||||||
// Close an opened file object.
|
|
||||||
//boolean close();
|
|
||||||
|
|
||||||
// Methods to determine if the requested file path exists.
|
// Methods to determine if the requested file path exists.
|
||||||
boolean exists(char *filepath);
|
boolean exists(char *filepath);
|
||||||
//boolean exists(char *filepath, SdFile& parentDir);
|
|
||||||
|
|
||||||
// Create the requested directory heirarchy--if intermediate directories
|
// Create the requested directory heirarchy--if intermediate directories
|
||||||
// do not exist they will be created.
|
// do not exist they will be created.
|
||||||
boolean makeDir(char *filepath);
|
boolean makeDir(char *filepath);
|
||||||
|
|
||||||
// At the moment this is how a developer interacts with a file they've
|
private:
|
||||||
// opened. It's unclear whether it would be better to make
|
SdFile file;
|
||||||
// `MemoryCard` provide a `Stream` interface instead.
|
|
||||||
SdFile file; // TODO: Don't make this public?
|
|
||||||
|
|
||||||
// This is used to determine the mode used to open a file
|
// This is used to determine the mode used to open a file
|
||||||
// it's here because it's the easiest place to pass the
|
// it's here because it's the easiest place to pass the
|
||||||
// information through the directory walking function. But
|
// information through the directory walking function. But
|
||||||
// it's probably not the best place for it.
|
// it's probably not the best place for it.
|
||||||
// It shouldn't be set directly--it is set via the parameters to `open`.
|
// It shouldn't be set directly--it is set via the parameters to `open`.
|
||||||
int fileOpenMode; // TODO: Don't make this public?
|
int fileOpenMode;
|
||||||
|
|
||||||
|
friend class File;
|
||||||
|
friend boolean callback_openPath(SdFile&, char *, boolean, void *);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SDClass SD;
|
extern SDClass SD;
|
||||||
|
Reference in New Issue
Block a user