# SdFat: SdExFat Class Reference

SdExFat Class Reference

SD file system class for exFAT volumes. More...

`#include <SdFat.h>`

Inheritance diagram for SdExFat:
[legend]
Collaboration diagram for SdExFat:
[legend]

## Public Member Functions

bool | begin (BlockDevice *dev, bool setCwv=true, uint8_t part=1)
bool | begin (SdCsPin_t csPin, uint32_t maxSck)
bool | begin (SdCsPin_t csPin=SS)
bool | begin (SdioConfig sdioConfig)
bool | begin (SdSpiConfig spiConfig)
uint32_t | bytesPerCluster ()
uint8_t | bytesPerClusterShift ()
uint16_t | bytesPerSector ()
uint8_t | bytesPerSectorShift ()
uint8_t * | cacheClear ()
SdCard * | card ()
bool | cardBegin (SdioConfig sdioConfig)
bool | cardBegin (SdSpiConfig spiConfig)
bool | chdir ()
bool | chdir (const ExChar_t *path)
bool | chdir (const String &path)
void | chvol ()
uint32_t | clusterCount ()
uint32_t | clusterHeapStartSector ()
void | errorHalt ()
void | errorHalt (const __FlashStringHelper *msg)
void | errorHalt (const char *msg)
void | errorHalt (print_t *pr)
void | errorHalt (print_t *pr, const __FlashStringHelper *msg)
void | errorHalt (print_t *pr, const char *msg)
void | errorPrint (const __FlashStringHelper *msg)
void | errorPrint (const char *msg)
void | errorPrint (Print *pr, const __FlashStringHelper *msg)
void | errorPrint (print_t *pr)
void | errorPrint (print_t *pr, char const *msg)
bool | exists (const ExChar_t *path)
bool | exists (const String &path)
uint32_t | fatLength ()
uint32_t | fatStartSector ()
uint8_t | fatType () const
bool | format (print_t *pr=NULL)
uint32_t | freeClusterCount ()
bool | init (BlockDevice *dev, uint8_t part)
void | initErrorHalt ()
void | initErrorHalt (const __FlashStringHelper *msg)
void | initErrorHalt (const char *msg)
void | initErrorHalt (Print *pr, const __FlashStringHelper *msg)
void | initErrorHalt (print_t *pr)
void | initErrorHalt (print_t *pr, const char *msg)
void | initErrorPrint ()
void | initErrorPrint (Print *pr)
bool | ls ()
bool | ls (const ExChar_t *path, uint8_t flags=0)
bool | ls (print_t *pr, const ExChar_t *path, uint8_t flags)
bool | ls (print_t *pr, uint8_t flags=0)
bool | ls (uint8_t flags)
bool | mkdir (const ExChar_t *path, bool pFlag=true)
bool | mkdir (const String &path, bool pFlag=true)
ExFile | open (const ExChar_t *path, oflag_t oflag=0X00)
ExFile | open (const String &path, oflag_t oflag=0X00)
void | printFatType (print_t *pr)
void | printSdError (print_t *pr)
bool | remove (const ExChar_t *path)
bool | remove (const String &path)
bool | rename (const ExChar_t *oldPath, const ExChar_t *newPath)
bool | rename (const String &oldPath, const String &newPath)
bool | rmdir (const ExChar_t *path)
bool | rmdir (const String &path)
uint32_t | rootDirectoryCluster ()
uint32_t | rootLength ()
uint8_t | sdErrorCode ()
uint8_t | sdErrorData ()
uint32_t | sectorsPerCluster ()
uint8_t | sectorsPerClusterShift ()
bool | truncate (const ExChar_t *path, uint64_t length)
bool | truncate (const String &path, uint64_t length)
ExFatVolume * | vol ()
bool | volumeBegin ()

## Static Public Member Functions

static ExFatVolume * | cwv ()

## Detailed Description

SD file system class for exFAT volumes.

## Member Function Documentation

## begin() [1/5]

bool ExFatVolume::begin | ( | BlockDevice * | dev,
|  | bool | setCwv = `true`,
|  | uint8_t | part = `1`
| ) |  |

inlineinherited

Initialize an FatVolume object.

Parameters

  [in] | dev | Device block driver.
  [in] | setCwv | Set current working volume if true.
  [in] | part | partition to initialize.

Returns
  true for success or false for failure.

## begin() [2/5]

bool SdBase< ExFatVolume >::begin | ( | SdCsPin_t | csPin,
|  | uint32_t | maxSck
| ) |  |

inlineinherited

Initialize SD card and file system.

Parameters

  [in] | csPin | SD card chip select pin.
  [in] | maxSck | Maximum SCK frequency.

Returns
  true for success or false for failure.

## begin() [3/5]

bool SdBase< ExFatVolume >::begin | ( | SdCsPin_t | csPin = `SS` | ) |

inlineinherited

Initialize SD card and file system.

Parameters

  [in] | csPin | SD card chip select pin.

Returns
  true for success or false for failure.

## begin() [4/5]

bool SdBase< ExFatVolume >::begin | ( | SdioConfig | sdioConfig | ) |

inlineinherited

Initialize SD card and file system for SDIO mode.

Parameters

  [in] | sdioConfig | SDIO configuration.

Returns
  true for success or false for failure.

## begin() [5/5]

bool SdBase< ExFatVolume >::begin | ( | SdSpiConfig | spiConfig | ) |

inlineinherited

Initialize SD card and file system for SPI mode.

Parameters

  [in] | spiConfig | SPI configuration.

Returns
  true for success or false for failure.

## bytesPerCluster()

uint32_t ExFatPartition::bytesPerCluster | ( |  | ) |

inlineinherited

Returns
  the number of bytes in a cluster.

## bytesPerClusterShift()

uint8_t ExFatPartition::bytesPerClusterShift | ( |  | ) |

inlineinherited

Returns
  the power of two for bytesPerCluster.

## bytesPerSector()

uint16_t ExFatPartition::bytesPerSector | ( |  | ) |

inlineinherited

Returns
  the number of bytes in a sector.

## bytesPerSectorShift()

uint8_t ExFatPartition::bytesPerSectorShift | ( |  | ) |

inlineinherited

Returns
  the power of two for bytesPerSector.

## cacheClear()

uint8_t* ExFatPartition::cacheClear | ( |  | ) |

inlineinherited

Clear the cache and returns a pointer to the cache. Not for normal apps.

Returns
  A pointer to the cache buffer or zero if an error occurs.

## card()

SdCard* SdBase< ExFatVolume >::card | ( |  | ) |

inlineinherited

Returns
  Pointer to SD card object.

## cardBegin() [1/2]

bool SdBase< ExFatVolume >::cardBegin | ( | SdioConfig | sdioConfig | ) |

inlineinherited

Initialize SD card in SDIO mode.

Parameters

  [in] | sdioConfig | SDIO configuration.

Returns
  true for success or false for failure.

## cardBegin() [2/2]

bool SdBase< ExFatVolume >::cardBegin | ( | SdSpiConfig | spiConfig | ) |

inlineinherited

Initialize SD card in SPI mode.

Parameters

  [in] | spiConfig | SPI configuration.

Returns
  true for success or false for failure.

## chdir() [1/3]

bool ExFatVolume::chdir | ( |  | ) |

inlineinherited

Set volume working directory to root.

Returns
  true for success or false for failure.

## chdir() [2/3]

bool ExFatVolume::chdir | ( | const ExChar_t * | path | ) |

inherited

Set volume working directory.

Parameters

  [in] | path | Path for volume working directory.

Returns
  true for success or false for failure.

## chdir() [3/3]

bool ExFatVolume::chdir | ( | const String & | path | ) |

inlineinherited

Set volume working directory.

Parameters

  [in] | path | Path for volume working directory.

Returns
  true for success or false for failure.

## chvol()

void ExFatVolume::chvol | ( |  | ) |

inlineinherited

Change global working volume to this volume.

## clusterCount()

uint32_t ExFatPartition::clusterCount | ( |  | ) |

inlineinherited

Returns
  the cluster count for the partition.

## clusterHeapStartSector()

uint32_t ExFatPartition::clusterHeapStartSector | ( |  | ) |

inlineinherited

Returns
  the cluster heap start sector.

## cwv()

static ExFatVolume* ExFatVolume::cwv | ( |  | ) |

inlinestaticinherited

Returns
  current working volume.

## errorHalt() [1/6]

void SdBase< ExFatVolume >::errorHalt | ( |  | ) |

inlineinherited

Print error info to Serial and halt.

## errorHalt() [2/6]

void SdBase< ExFatVolume >::errorHalt | ( | const __FlashStringHelper * | msg | ) |

inlineinherited

Print msg to Serial and halt.

Parameters

  [in] | msg | Message to print.

## errorHalt() [3/6]

void SdBase< ExFatVolume >::errorHalt | ( | const char * | msg | ) |

inlineinherited

Print error info and halt.

Parameters

  [in] | msg | Message to print.

## errorHalt() [4/6]

void SdBase< ExFatVolume >::errorHalt | ( | print_t * | pr | ) |

inlineinherited

Print error info and halt.

Parameters

  [in] | pr | Print destination.

## errorHalt() [5/6]

void SdBase< ExFatVolume >::errorHalt | ( | print_t * | pr,
|  | const __FlashStringHelper * | msg
| ) |  |

inlineinherited

Print msg and halt.

Parameters

  [in] | pr | Print destination.
  [in] | msg | Message to print.

## errorHalt() [6/6]

void SdBase< ExFatVolume >::errorHalt | ( | print_t * | pr,
|  | const char * | msg
| ) |  |

inlineinherited

Print error info and halt.

Parameters

  [in] | pr | Print destination.
  [in] | msg | Message to print.

## errorPrint() [1/5]

void SdBase< ExFatVolume >::errorPrint | ( | const __FlashStringHelper * | msg | ) |

inlineinherited

Print msg, any SD error code.

Parameters

  [in] | msg | Message to print.

## errorPrint() [2/5]

void SdBase< ExFatVolume >::errorPrint | ( | const char * | msg | ) |

inlineinherited

Print msg, any SD error code.

Parameters

  [in] | msg | Message to print.

## errorPrint() [3/5]

void SdBase< ExFatVolume >::errorPrint | ( | Print * | pr,
|  | const __FlashStringHelper * | msg
| ) |  |

inlineinherited

Print msg, any SD error code.

Parameters

  [in] | pr | Print destination.
  [in] | msg | Message to print.

## errorPrint() [4/5]

void SdBase< ExFatVolume >::errorPrint | ( | print_t * | pr | ) |

inlineinherited

Print SD errorCode and errorData.

Parameters

  [in] | pr | Print destination.

## errorPrint() [5/5]

void SdBase< ExFatVolume >::errorPrint | ( | print_t * | pr,
|  | char const * | msg
| ) |  |

inlineinherited

Print msg, any SD error code.

Parameters

  [in] | pr | Print destination.
  [in] | msg | Message to print.

## exists() [1/2]

bool ExFatVolume::exists | ( | const ExChar_t * | path | ) |

inlineinherited

Test for the existence of a file.

Parameters

  [in] | path | Path of the file to be tested for.

Returns
  true if the file exists else false.

## exists() [2/2]

bool ExFatVolume::exists | ( | const String & | path | ) |

inlineinherited

Test for the existence of a file in a directory

Parameters

  [in] | path | Path of the file to be tested for.

Returns
  true if the file exists else false.

## fatLength()

uint32_t ExFatPartition::fatLength | ( |  | ) |

inlineinherited

Returns
  the FAT length in sectors

## fatStartSector()

uint32_t ExFatPartition::fatStartSector | ( |  | ) |

inlineinherited

Returns
  the FAT start sector number.

## fatType()

uint8_t ExFatPartition::fatType | ( |  | ) | const

inlineinherited

Returns
  Type FAT_TYPE_EXFAT for exFAT partition or zero for error.

## format()

bool SdExFat::format | ( | print_t * | pr = `NULL` | ) |

inline

Format a SD card exFAT.

Parameters

  [in] | pr | Optional Print information.

Returns
  true for success or false for failure.

## freeClusterCount()

uint32_t ExFatPartition::freeClusterCount | ( |  | ) |

inherited

Returns
  the free cluster count.

## init()

bool ExFatPartition::init | ( | BlockDevice * | dev,
|  | uint8_t | part
| ) |  |

inherited

Initialize a exFAT partition.

Parameters

  [in] | dev | The blockDevice for the partition.
  [in] | part | The partition to be used. Legal values for part are 1-4 to use the corresponding partition on a device formatted with a MBR, Master Boot Record, or zero if the device is formatted as a super floppy with the FAT boot sector in sector zero.

Returns
  true for success or false for failure.

## initErrorHalt() [1/6]

void SdBase< ExFatVolume >::initErrorHalt | ( |  | ) |

inlineinherited

Print error info and halt.

## initErrorHalt() [2/6]

void SdBase< ExFatVolume >::initErrorHalt | ( | const __FlashStringHelper * | msg | ) |

inlineinherited

Print error info and halt.

Parameters

  [in] | msg | Message to print.

## initErrorHalt() [3/6]

void SdBase< ExFatVolume >::initErrorHalt | ( | const char * | msg | ) |

inlineinherited

Print error info and halt.

Parameters

  [in] | msg | Message to print.

## initErrorHalt() [4/6]

void SdBase< ExFatVolume >::initErrorHalt | ( | Print * | pr,
|  | const __FlashStringHelper * | msg
| ) |  |

inlineinherited

Print error info and halt.

Parameters

  [in] | pr | Print destination.
  [in] | msg | Message to print.

## initErrorHalt() [5/6]

void SdBase< ExFatVolume >::initErrorHalt | ( | print_t * | pr | ) |

inlineinherited

Print error info and halt.

Parameters

  [in] | pr | Print destination.

## initErrorHalt() [6/6]

void SdBase< ExFatVolume >::initErrorHalt | ( | print_t * | pr,
|  | const char * | msg
| ) |  |

inlineinherited

Print error info and halt.

Parameters

  [in] | pr | Print destination.
  [in] | msg | Message to print.

## initErrorPrint() [1/2]

void SdBase< ExFatVolume >::initErrorPrint | ( |  | ) |

inlineinherited

Print error details after begin() fails.

## initErrorPrint() [2/2]

void SdBase< ExFatVolume >::initErrorPrint | ( | Print * | pr | ) |

inlineinherited

Print error details after begin() fails.

Parameters

  [in] | pr | Print destination.

## ls() [1/5]

bool ExFatVolume::ls | ( |  | ) |

inlineinherited

List the directory contents of the root directory to Serial.

Returns
  true for success or false for failure.

## ls() [2/5]

bool ExFatVolume::ls | ( | const ExChar_t * | path,
|  | uint8_t | flags = `0`
| ) |  |

inlineinherited

List the directory contents of a directory to Serial.

Parameters

  [in] | path | directory to list.
  [in] | flags | The inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

Returns
  true for success or false for failure.

## ls() [3/5]

bool ExFatVolume::ls | ( | print_t * | pr,
|  | const ExChar_t * | path,
|  | uint8_t | flags
| ) |  |

inlineinherited

List the contents of a directory.

Parameters

  [in] | pr | Print stream for list.
  [in] | path | directory to list.
  [in] | flags | The inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

Returns
  true for success or false for failure.

## ls() [4/5]

bool ExFatVolume::ls | ( | print_t * | pr,
|  | uint8_t | flags = `0`
| ) |  |

inlineinherited

List the directory contents of the root directory.

Parameters

  [in] | pr | Print stream for list.
  [in] | flags | The inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

Returns
  true for success or false for failure.

## ls() [5/5]

bool ExFatVolume::ls | ( | uint8_t | flags | ) |

inlineinherited

List the directory contents of the volume root to Serial.

Parameters

  [in] | flags | The inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

Returns
  true for success or false for failure.

## mkdir() [1/2]

bool ExFatVolume::mkdir | ( | const ExChar_t * | path,
|  | bool | pFlag = `true`
| ) |  |

inlineinherited

Make a subdirectory in the volume root directory.

Parameters

  [in] | path | A path with a valid 8.3 DOS name for the subdirectory.
  [in] | pFlag | Create missing parent directories if true.

Returns
  true for success or false for failure.

## mkdir() [2/2]

bool ExFatVolume::mkdir | ( | const String & | path,
|  | bool | pFlag = `true`
| ) |  |

inlineinherited

Make a subdirectory in the volume root directory.

Parameters

  [in] | path | A path with a valid 8.3 DOS name for the subdirectory.
  [in] | pFlag | Create missing parent directories if true.

Returns
  true for success or false for failure.

## open() [1/2]

ExFile ExFatVolume::open | ( | const ExChar_t * | path,
|  | oflag_t | oflag = `0X00`
| ) |  |

inlineinherited

open a file

Parameters

  [in] | path | location of file to be opened.
  [in] | oflag | open flags.

Returns
  a ExFile object.

## open() [2/2]

ExFile ExFatVolume::open | ( | const String & | path,
|  | oflag_t | oflag = `0X00`
| ) |  |

inlineinherited

open a file

Parameters

  [in] | path | location of file to be opened.
  [in] | oflag | open oflag flags.

Returns
  a ExFile object.

## printFatType()

void SdBase< ExFatVolume >::printFatType | ( | print_t * | pr | ) |

inlineinherited

Print volume FAT/exFAT type.

Parameters

  [in] | pr | Print destination.

## printSdError()

void SdBase< ExFatVolume >::printSdError | ( | print_t * | pr | ) |

inlineinherited

Print error info and return.

Parameters

  [in] | pr | Print destination.

## remove() [1/2]

bool ExFatVolume::remove | ( | const ExChar_t * | path | ) |

inlineinherited

Remove a file from the volume root directory.

Parameters

  [in] | path | A path with a valid 8.3 DOS name for the file.

Returns
  true for success or false for failure.

## remove() [2/2]

bool ExFatVolume::remove | ( | const String & | path | ) |

inlineinherited

Remove a file from the volume root directory.

Parameters

  [in] | path | A path with a valid name for the file.

Returns
  true for success or false for failure.

## rename() [1/2]

bool ExFatVolume::rename | ( | const ExChar_t * | oldPath,
|  | const ExChar_t * | newPath
| ) |  |

inlineinherited

Rename a file or subdirectory.

Parameters

  [in] | oldPath | Path name to the file or subdirectory to be renamed.
  [in] | newPath | New 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
  true for success or false for failure.

## rename() [2/2]

bool ExFatVolume::rename | ( | const String & | oldPath,
|  | const String & | newPath
| ) |  |

inlineinherited

Rename a file or subdirectory.

Parameters

  [in] | oldPath | Path name to the file or subdirectory to be renamed.
  [in] | newPath | New 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
  true for success or false for failure.

## rmdir() [1/2]

bool ExFatVolume::rmdir | ( | const ExChar_t * | path | ) |

inlineinherited

Remove a subdirectory from the volume's working directory.

Parameters

  [in] | path | A path with a valid 8.3 DOS name for the subdirectory.

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

Returns
  true for success or false for failure.

## rmdir() [2/2]

bool ExFatVolume::rmdir | ( | const String & | path | ) |

inlineinherited

Remove a subdirectory from the volume's working directory.

Parameters

  [in] | path | A path with a valid name for the subdirectory.

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

Returns
  true for success or false for failure.

## rootDirectoryCluster()

uint32_t ExFatPartition::rootDirectoryCluster | ( |  | ) |

inlineinherited

Returns
  the root directory start cluster number.

## rootLength()

uint32_t ExFatPartition::rootLength | ( |  | ) |

inherited

Returns
  the root directory length.

## sdErrorCode()

uint8_t SdBase< ExFatVolume >::sdErrorCode | ( |  | ) |

inlineinherited

Returns
  SD card error code.

## sdErrorData()

uint8_t SdBase< ExFatVolume >::sdErrorData | ( |  | ) |

inlineinherited

Returns
  SD card error data.

## sectorsPerCluster()

uint32_t ExFatPartition::sectorsPerCluster | ( |  | ) |

inlineinherited

Returns
  the number of sectors in a cluster.

## sectorsPerClusterShift()

uint8_t ExFatPartition::sectorsPerClusterShift | ( |  | ) |

inlineinherited

Returns
  the power of two for sectors per cluster.

## truncate() [1/2]

bool ExFatVolume::truncate | ( | const ExChar_t * | path,
|  | uint64_t | length
| ) |  |

inlineinherited

Truncate a file to a specified length. The current file position will be at the new EOF.

Parameters

  [in] | path | A path with a valid 8.3 DOS name for the file.
  [in] | length | The desired length for the file.

Returns
  true for success or false for failure.

## truncate() [2/2]

bool ExFatVolume::truncate | ( | const String & | path,
|  | uint64_t | length
| ) |  |

inlineinherited

Truncate a file to a specified length. The current file position will be at the new EOF.

Parameters

  [in] | path | A path with a valid name for the file.
  [in] | length | The desired length for the file.

Returns
  true for success or false for failure.

## vol()

ExFatVolume * SdBase< ExFatVolume >::vol | ( |  | ) |

inlineinherited

Returns
  pointer to base volume

## volumeBegin()

bool SdBase< ExFatVolume >::volumeBegin | ( |  | ) |

inlineinherited

Initialize file system after call to cardBegin.

Returns
  true for success or false for failure.

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

- ArduinoSdFat/libraries/SdFat/src/SdFat.h