SdFat
Public Member Functions | Static Public Member Functions
SdFat Class Reference

Integration class for the SdFat library. More...

#include <SdFat.h>

Collaboration diagram for SdFat:
Collaboration graph
[legend]

List of all members.

Public Member Functions

bool begin (uint8_t chipSelectPin=SD_CHIP_SELECT_PIN, uint8_t sckRateID=SPI_FULL_SPEED)
Sd2Cardcard ()
bool chdir (const char *path, bool set_cwd=false)
bool chdir (bool set_cwd=false)
void chvol ()
void errorHalt ()
void errorHalt (char const *msg)
void errorHalt_P (PGM_P msg)
void errorPrint ()
void errorPrint (char const *msg)
void errorPrint_P (PGM_P msg)
bool exists (const char *name)
void initErrorHalt ()
void initErrorHalt (char const *msg)
void initErrorHalt_P (PGM_P msg)
void initErrorPrint ()
void initErrorPrint (char const *msg)
void initErrorPrint_P (PGM_P msg)
void ls (uint8_t flags=0)
void ls (Print *pr, 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)
SdVolumevol ()
SdBaseFilevwd ()

Static Public Member Functions

static void setStdOut (Print *stream)
static Print * stdOut ()

Detailed Description

Integration class for the SdFat library.

error if old IDE


Member Function Documentation

bool SdFat::begin ( uint8_t  chipSelectPin = SD_CHIP_SELECT_PIN,
uint8_t  sckRateID = SPI_FULL_SPEED 
)

Initialize an SdFat object.

Initializes the SD card, SD volume, and root directory.

Parameters:
[in]chipSelectPinSD chip select pin. See Sd2Card::init().
[in]sckRateIDvalue for SPI SCK rate. See Sd2Card::init().
Returns:
The value one, true, is returned for success and the value zero, false, is returned for failure.
Sd2Card* SdFat::card ( ) [inline]
Returns:
a pointer to the Sd2Card object.
bool SdFat::chdir ( bool  set_cwd = false)

Change a volume's working directory to root

Changes the volume's working directory to the SD's root directory. Optionally set the current working directory to the volume's working directory.

Parameters:
[in]set_cwdSet the current working directory to this volume's working directory if true.
Returns:
The value one, true, is returned for success and the value zero, false, is returned for failure.
bool SdFat::chdir ( const char *  path,
bool  set_cwd = false 
)

Change a volume's working directory

Changes the volume working directory to the path subdirectory. Optionally set the current working directory to the volume's working directory.

Example: If the volume's working directory is "/DIR", chdir("SUB") will change the volume's working directory from "/DIR" to "/DIR/SUB".

If path is "/", the volume's working directory will be changed to the root directory

Parameters:
[in]pathThe name of the subdirectory.
[in]set_cwdSet the current working directory to this volume's working directory if true.
Returns:
The value one, true, is returned for success and the value zero, false, is returned for failure.
void SdFat::chvol ( )

Set the current working directory to a volume's working directory.

This is useful with multiple SD cards.

The current working directory is changed to this volume's working directory.

This is like the Windows/DOS <drive letter>: command.

void SdFat::errorHalt ( )

Print any SD error code and halt.

void SdFat::errorHalt ( char const *  msg)

Print msg, any SD error code, and halt.

Parameters:
[in]msgMessage to print.
void SdFat::errorHalt_P ( PGM_P  msg)

Print msg, any SD error code, and halt.

Parameters:
[in]msgMessage in program space (flash memory) to print.
void SdFat::errorPrint ( char const *  msg)

Print msg, any SD error code.

Parameters:
[in]msgMessage to print.
void SdFat::errorPrint ( )

Print any SD error code.

void SdFat::errorPrint_P ( PGM_P  msg)

Print msg, any SD error code.

Parameters:
[in]msgMessage in program space (flash memory) to print.
bool SdFat::exists ( const char *  name)

Test for the existence of a file.

Parameters:
[in]nameName of the file to be tested for.
Returns:
true if the file exists else false.
void SdFat::initErrorHalt ( )

Print error details and halt after SdFat::init() fails.

void SdFat::initErrorHalt ( char const *  msg)

Print message, error details, and halt after SdFat::init() fails.

Parameters:
[in]msgMessage to print.
void SdFat::initErrorHalt_P ( PGM_P  msg)

Print message, error details, and halt after SdFat::init() fails.

Parameters:
[in]msgMessage in program space (flash memory) to print.
void SdFat::initErrorPrint ( )

Print error details after SdFat::init() fails.

void SdFat::initErrorPrint ( char const *  msg)

Print message and error details and halt after SdFat::init() fails.

Parameters:
[in]msgMessage to print.
void SdFat::initErrorPrint_P ( PGM_P  msg)

Print message and error details after SdFat::init() fails.

Parameters:
[in]msgMessage in program space (flash memory) to print.
void SdFat::ls ( Print *  pr,
uint8_t  flags = 0 
)

List the directory contents of the volume working directory.

Parameters:
[in]prPrint stream for list.
[in]flagsThe inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

void SdFat::ls ( uint8_t  flags = 0)

List the directory contents of the volume working directory to stdOut.

Parameters:
[in]flagsThe inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

bool SdFat::mkdir ( const char *  path,
bool  pFlag = true 
)

Make a subdirectory in the volume working directory.

Parameters:
[in]pathA path with a valid 8.3 DOS name for the subdirectory.
[in]pFlagCreate missing parent directories if true.
Returns:
The value one, true, is returned for success and the value zero, false, is returned for failure.
bool SdFat::remove ( const char *  path)

Remove a file from the volume working directory.

Parameters:
[in]pathA path with a valid 8.3 DOS name for the file.
Returns:
The value one, true, is returned for success and the value zero, false, is returned for failure.
bool SdFat::rename ( const char *  oldPath,
const char *  newPath 
)

Rename a file or subdirectory.

Parameters:
[in]oldPathPath name to the file or subdirectory to be renamed.
[in]newPathNew path name of the file or subdirectory.

The newPath object must not exist before the rename call.

The file to be renamed must not be open. The directory entry may be moved and file system corruption could occur if the file is accessed by a file object that was opened before the rename() call.

Returns:
The value one, true, is returned for success and the value zero, false, is returned for failure.
bool SdFat::rmdir ( const char *  path)

Remove a subdirectory from the volume's working directory.

Parameters:
[in]pathA path with a valid 8.3 DOS name for the subdirectory.

The subdirectory file will be removed only if it is empty.

Returns:
The value one, true, is returned for success and the value zero, false, is returned for failure.
static void SdFat::setStdOut ( Print *  stream) [inline, static]

Set stdOut Print stream for messages.

Parameters:
[in]streamThe new Print stream.
static Print* SdFat::stdOut ( ) [inline, static]
Returns:
Print stream for messages.
bool SdFat::truncate ( const char *  path,
uint32_t  length 
)

Truncate a file to a specified length. The current file position will be maintained if it is less than or equal to length otherwise it will be set to end of file.

Parameters:
[in]pathA path with a valid 8.3 DOS name for the file.
[in]lengthThe desired length for the file.
Returns:
The value one, true, is returned for success and the value zero, false, is returned for failure. Reasons for failure include file is read only, file is a directory, length is greater than the current file size or an I/O error occurs.
SdVolume* SdFat::vol ( ) [inline]
Returns:
a pointer to the SdVolume object.
SdBaseFile* SdFat::vwd ( ) [inline]
Returns:
a pointer to the volume working directory.

The documentation for this class was generated from the following files: