SD file system class for FAT volumes.
More...
#include <SdFs.h>
|
bool | begin (BlockDevice *dev, bool setCwv=true, uint8_t part=0) |
|
bool | begin (uint8_t csPin=SS) |
|
bool | begin (uint8_t csPin, SPISettings spiSettings) |
|
bool | begin (SdSpiConfig spiConfig) |
|
bool | begin (SdioConfig sdioConfig) |
|
uint16_t | bytesPerCluster () |
|
uint8_t | bytesPerClusterShift () |
|
uint16_t | bytesPerSector () |
|
uint8_t | bytesPerSectorShift () |
|
cache_t * | cacheClear () |
|
SdCard * | card () |
|
bool | cardBegin (SdSpiConfig spiConfig) |
|
bool | cardBegin (SdioConfig sdioConfig) |
|
bool | chdir () |
|
bool | chdir (const char *path) |
|
void | chvol () |
|
uint32_t | clusterCount () const |
|
uint32_t | dataStartSector () const |
|
int8_t | dbgFat (uint32_t n, uint32_t *v) |
|
void | errorHalt (Print *pr) |
|
void | errorHalt () |
|
void | errorHalt (Print *pr, const char *msg) |
|
void | errorHalt (Print *pr, const __FlashStringHelper *msg) |
|
void | errorHalt (const __FlashStringHelper *msg) |
|
void | errorHalt (const char *msg) |
|
bool | exists (const char *path) |
|
uint8_t | fatCount () |
|
uint32_t | fatStartSector () const |
|
uint8_t | fatType () const |
|
bool | format (print_t *pr=nullptr) |
|
int32_t | freeClusterCount () |
|
bool | init (BlockDevice *dev, uint8_t part) |
|
void | initErrorHalt (Print *pr) |
|
void | initErrorHalt () |
|
void | ls (uint8_t flags=0) |
|
void | ls (const char *path, uint8_t flags=0) |
|
void | ls (print_t *pr, uint8_t flags=0) |
|
void | ls (print_t *pr, const char *path, uint8_t flags) |
|
bool | mkdir (const char *path, bool pFlag=true) |
|
File | open (const String &path, uint8_t mode=O_READ) |
|
File | open (const char *path, uint8_t mode=O_READ) |
|
void | printFatType (Print *pr) |
|
void | printSdError (print_t *pr) |
|
void | printSdErrorCode (Print *pr) |
|
bool | remove (const char *path) |
|
bool | rename (const char *oldPath, const char *newPath) |
|
bool | rmdir (const char *path) |
|
uint16_t | rootDirEntryCount () const |
|
uint32_t | rootDirStart () const |
|
uint8_t | sdErrorCode () |
|
uint8_t | sdErrorData () |
|
uint16_t | sectorMask () |
|
uint8_t | sectorsPerCluster () const |
|
uint8_t | sectorsPerClusterShift () const |
|
uint32_t | sectorsPerFat () const |
|
bool | truncate (const char *path, uint32_t length) |
|
bool | volumeBegin () |
|
uint32_t | volumeSectorCount () const |
|
bool | wipe (print_t *pr=nullptr) |
|
SD file system class for FAT volumes.
bool FatVolume::begin |
( |
BlockDevice * |
dev, |
|
|
bool |
setCwv = true , |
|
|
uint8_t |
part = 0 |
|
) |
| |
|
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
- The value true is returned for success and the value false is returned for failure.
Initialize SD card and file system.
- Parameters
-
[in] | csPin | SD card chip select pin. |
- Returns
- true for success else false.
Initialize SD card and file system.
- Parameters
-
[in] | csPin | SD card chip select pin. |
[in] | spiSettings | SPI speed, mode, and bit order. |
- Returns
- true for success else false.
Initialize SD card and file system for SPI mode.
- Parameters
-
[in] | spiConfig | SPI configuration. |
- Returns
- true for success else false.
Initialize SD card and file system for SDIO mode.
- Parameters
-
[in] | sdioConfig | SDIO configuration. |
- Returns
- true for success else false.
uint16_t FatPartition::bytesPerCluster |
( |
| ) |
|
|
inlineinherited |
- Returns
- Number of bytes in a cluster.
uint8_t FatPartition::bytesPerClusterShift |
( |
| ) |
|
|
inlineinherited |
- Returns
- The shift count required to multiply by bytesPerCluster.
uint16_t FatPartition::bytesPerSector |
( |
| ) |
|
|
inlineinherited |
- Returns
- Number of bytes per sector.
uint8_t FatPartition::bytesPerSectorShift |
( |
| ) |
|
|
inlineinherited |
- Returns
- The shift count required to multiply by bytesPerCluster.
cache_t* FatPartition::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.
- Returns
- Pointer to SD card object.
Initialize SD card in SPI mode.
- Parameters
-
[in] | spiConfig | SPI configuration. |
- Returns
- true for success else false.
Initialize SD card in SDIO mode.
- Parameters
-
[in] | sdioConfig | SDIO configuration. |
- Returns
- true for success else false.
bool FatVolume::chdir |
( |
| ) |
|
|
inlineinherited |
Set volume working directory to root.
- Returns
- true for success else false.
bool FatVolume::chdir |
( |
const char * |
path | ) |
|
|
inherited |
Set volume working directory.
- Parameters
-
[in] | path | Path for volume working directory. |
- Returns
- true for success or false for failure.
void FatVolume::chvol |
( |
| ) |
|
|
inlineinherited |
Change global current working volume to this volume.
uint32_t FatPartition::clusterCount |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The total number of clusters in the volume.
- Returns
- current working volume.
uint32_t FatPartition::dataStartSector |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The logical sector number for the start of file data.
int8_t FatPartition::dbgFat |
( |
uint32_t |
n, |
|
|
uint32_t * |
v |
|
) |
| |
|
inlineinherited |
Debug access to FAT table
- Parameters
-
[in] | n | cluster number. |
[out] | v | value of entry |
- Returns
- true for success or false for failure
Print error info and halt.
- Parameters
-
Print error info to Serial and halt.
Print error info and halt.
- Parameters
-
[in] | pr | Print destination. |
[in] | msg | Message to print. |
void SdBase< FatVolume >::errorHalt |
( |
Print * |
pr, |
|
|
const __FlashStringHelper * |
msg |
|
) |
| |
|
inlineinherited |
Print msg and halt.
- Parameters
-
[in] | pr | Print destination. |
[in] | msg | Message to print. |
Print msg to Serial and halt.
- Parameters
-
Print error info and halt.
- Parameters
-
bool FatVolume::exists |
( |
const char * |
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.
uint8_t FatPartition::fatCount |
( |
| ) |
|
|
inlineinherited |
- Returns
- The number of File Allocation Tables.
uint32_t FatPartition::fatStartSector |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The logical sector number for the start of the first FAT.
uint8_t FatPartition::fatType |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The FAT type of the volume. Values are 12, 16 or 32.
bool SdFat::format |
( |
print_t * |
pr = nullptr | ) |
|
|
inline |
Format a SD card FAT32/FAT16.
- Parameters
-
[in] | pr | Optional Print information. |
- Returns
- true for success else false.
int32_t FatPartition::freeClusterCount |
( |
| ) |
|
|
inherited |
Volume free space in clusters.
- Returns
- Count of free clusters for success or -1 if an error occurs.
bool FatPartition::init |
( |
BlockDevice * |
dev, |
|
|
uint8_t |
part |
|
) |
| |
|
inherited |
Initialize a FAT partition.
- Parameters
-
[in] | dev | BlockDevice for this 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
- The value true is returned for success and the value false is returned for failure.
Print error info and halt.
- Parameters
-
Print error info and halt.
void FatVolume::ls |
( |
uint8_t |
flags = 0 | ) |
|
|
inlineinherited |
List the directory contents of the root directory 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.
void FatVolume::ls |
( |
const char * |
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.
void FatVolume::ls |
( |
print_t * |
pr, |
|
|
uint8_t |
flags = 0 |
|
) |
| |
|
inlineinherited |
List the directory contents of the volume 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.
void FatVolume::ls |
( |
print_t * |
pr, |
|
|
const char * |
path, |
|
|
uint8_t |
flags |
|
) |
| |
|
inlineinherited |
List the directory 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.
bool FatVolume::mkdir |
( |
const char * |
path, |
|
|
bool |
pFlag = true |
|
) |
| |
|
inlineinherited |
Make a subdirectory in the volume root directory.
- Parameters
-
[in] | path | A path with a valid name for the subdirectory. |
[in] | pFlag | Create missing parent directories if true. |
- Returns
- The value true is returned for success and the value false is returned for failure.
File FatVolume::open |
( |
const String & |
path, |
|
|
uint8_t |
mode = O_READ |
|
) |
| |
|
inlineinherited |
open a file
- Parameters
-
[in] | path | location of file to be opened. |
[in] | mode | open mode flags. |
- Returns
- a File object.
File FatVolume::open |
( |
const char * |
path, |
|
|
uint8_t |
mode = O_READ |
|
) |
| |
|
inlineinherited |
open a file
- Parameters
-
[in] | path | location of file to be opened. |
[in] | mode | open mode flags. |
- Returns
- a File object.
Print volume FAT/exFAT type.
- Parameters
-
Print error info and return.
- Parameters
-
Print SD errorCode and errorData.
- Parameters
-
bool FatVolume::remove |
( |
const char * |
path | ) |
|
|
inlineinherited |
Remove a file from the volume root directory.
- Parameters
-
[in] | path | A path with a valid name for the file. |
- Returns
- The value true is returned for success and the value false is returned for failure.
bool FatVolume::rename |
( |
const char * |
oldPath, |
|
|
const char * |
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
- The value true is returned for success and the value false is returned for failure.
bool FatVolume::rmdir |
( |
const char * |
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
- The value true is returned for success and the value false is returned for failure.
uint16_t FatPartition::rootDirEntryCount |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The number of entries in the root directory for FAT16 volumes.
uint32_t FatPartition::rootDirStart |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The logical sector number for the start of the root directory on FAT16 volumes or the first cluster number on FAT32 volumes.
- Returns
- SD card error code.
- Returns
- SD card error data.
uint16_t FatPartition::sectorMask |
( |
| ) |
|
|
inlineinherited |
- Returns
- Mask for sector offset.
uint8_t FatPartition::sectorsPerCluster |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The volume's cluster size in sectors.
uint8_t FatPartition::sectorsPerClusterShift |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The shift count required to multiply by sectorsPerCluster.
uint32_t FatPartition::sectorsPerFat |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The number of sectors in one FAT.
bool FatVolume::truncate |
( |
const char * |
path, |
|
|
uint32_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
- The value true is returned for success and the value false is returned for failure.
Initialize file system after call to cardBegin.
- Returns
- true for success else false.
uint32_t FatPartition::volumeSectorCount |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The number of sectors in the volume
bool FatVolume::wipe |
( |
print_t * |
pr = nullptr | ) |
|
|
inlineinherited |
Wipe all data from the volume. You must reinitialize the volume before accessing it again.
- Parameters
-
[in] | pr | print stream for status dots. |
- Returns
- true for success else false.
The documentation for this class was generated from the following file:
- ArduinoSdFs/libraries/SdFs/src/SdFs.h