SdFat

Public Member Functions | Friends | List of all members
FatVolume Class Reference

Access FAT16 and FAT32 volumes on raw file devices. More...

`#include <FatVolume.h>`

Inheritance diagram for FatVolume:
[legend]

## Public Member Functions
uint8_t | blocksPerCluster () const
uint32_t | blocksPerFat () const
cache_t * | cacheClear ()
uint32_t | clusterCount () const
uint8_t | clusterSizeShift () const
uint32_t | dataStartBlock () const
int8_t | dbgFat (uint32_t n, uint32_t *v)
uint8_t | fatCount ()
uint32_t | fatStartBlock () const
uint8_t | fatType () const
| FatVolume ()
int32_t | freeClusterCount ()
bool | init ()
bool | init (uint8_t part)
uint16_t | rootDirEntryCount () const
uint32_t | rootDirStart () const
uint32_t | volumeBlockCount () const
bool | wipe (print_t *pr=0)

## Friends
class | FatCache
| Allow access to FatVolume.
class | FatFile
| Allow access to FatVolume.
class | FatFileSystem
| Allow access to FatVolume.

## Detailed Description

Access FAT16 and FAT32 volumes on raw file devices.

## Constructor & Destructor Documentation

## ◆ FatVolume()

FatVolume::FatVolume | ( |  | ) |
| inline

Create an instance of FatVolume

## Member Function Documentation

## ◆ blocksPerCluster()

uint8_t FatVolume::blocksPerCluster | ( |  | ) | const
| inline

Returns
  The volume's cluster size in blocks.

## ◆ blocksPerFat()

uint32_t FatVolume::blocksPerFat | ( |  | ) | const
| inline

Returns
  The number of blocks in one FAT.

## ◆ cacheClear()

cache_t* FatVolume::cacheClear | ( |  | ) |
| inline

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.

## ◆ clusterCount()

uint32_t FatVolume::clusterCount | ( |  | ) | const
| inline

Returns
  The total number of clusters in the volume.

## ◆ clusterSizeShift()

uint8_t FatVolume::clusterSizeShift | ( |  | ) | const
| inline

Returns
  The shift count required to multiply by blocksPerCluster.

## ◆ dataStartBlock()

uint32_t FatVolume::dataStartBlock | ( |  | ) | const
| inline

Returns
  The logical block number for the start of file data.

## ◆ dbgFat()

int8_t FatVolume::dbgFat | ( | uint32_t | n,
|  | uint32_t * | v
| ) |  |
| inline

Debug access to FAT table

Parameters

  [in] | n | cluster number.
  [out] | v | value of entry

Returns
  -1 error, 0 EOC, else 1.

## ◆ fatCount()

uint8_t FatVolume::fatCount | ( |  | ) |
| inline

Returns
  The number of File Allocation Tables.

## ◆ fatStartBlock()

uint32_t FatVolume::fatStartBlock | ( |  | ) | const
| inline

Returns
  The logical block number for the start of the first FAT.

## ◆ fatType()

uint8_t FatVolume::fatType | ( |  | ) | const
| inline

Returns
  The FAT type of the volume. Values are 12, 16 or 32.

## ◆ freeClusterCount()

int32_t FatVolume::freeClusterCount | ( |  | ) |

Volume free space in clusters.

Returns
  Count of free clusters for success or -1 if an error occurs.

## ◆ init() [1/2]

bool FatVolume::init | ( |  | ) |
| inline

Initialize a FAT volume. Try partition one first then try super floppy format.

Returns
  The value true is returned for success and the value false is returned for failure.

## ◆ init() [2/2]

bool FatVolume::init | ( | uint8_t | part | ) |

Initialize a FAT volume.

Parameters

  [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 block zero.

Returns
  The value true is returned for success and the value false is returned for failure.

## ◆ rootDirEntryCount()

uint16_t FatVolume::rootDirEntryCount | ( |  | ) | const
| inline

Returns
  The number of entries in the root directory for FAT16 volumes.

## ◆ rootDirStart()

uint32_t FatVolume::rootDirStart | ( |  | ) | const
| inline

Returns
  The logical block number for the start of the root directory on FAT16 volumes or the first cluster number on FAT32 volumes.

## ◆ volumeBlockCount()

uint32_t FatVolume::volumeBlockCount | ( |  | ) | const
| inline

Returns
  The number of blocks in the volume

## ◆ wipe()

bool FatVolume::wipe | ( | print_t * | pr = `0` | ) |

Wipe all data from the volume.

Parameters

  [in] | pr | print stream for status dots.

Returns
  true for success else false.

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

- Arduino/libraries/SdFat/src/FatLib/FatVolume.h
- Arduino/libraries/SdFat/src/FatLib/FatVolume.cpp