SdFat: FatPartition Class Reference

SdFat

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

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

`#include <FatPartition.h>`

Inheritance diagram for FatPartition:
[legend]

## Public Member Functions
uint16_t | bytesPerCluster () const
uint8_t | bytesPerClusterShift () const
uint16_t | bytesPerSector () const
uint8_t | bytesPerSectorShift () const
uint8_t * | cacheClear ()
uint32_t | clusterCount () const
uint32_t | dataStartSector () const
int8_t | dbgFat (uint32_t n, uint32_t *v)
uint8_t | fatCount () const
| FatPartition ()
uint32_t | fatStartSector () const
uint8_t | fatType () const
int32_t | freeClusterCount ()
bool | init (BlockDevice *dev, uint8_t part=1)
bool | isBusy ()
uint16_t | rootDirEntryCount () const
uint32_t | rootDirStart () const
uint16_t | sectorMask () const
uint8_t | sectorsPerCluster () const
uint8_t | sectorsPerClusterShift () const
uint32_t | sectorsPerFat () const
uint32_t | volumeSectorCount () const

## Friends
class | FatFile

## Detailed Description

Access FAT16 and FAT32 partitions on raw file devices.

## Constructor & Destructor Documentation

## ◆ FatPartition()

FatPartition::FatPartition | ( |  | ) |
| inline

Create an instance of FatPartition

## Member Function Documentation

## ◆ bytesPerCluster()

uint16_t FatPartition::bytesPerCluster | ( |  | ) | const
| inline

Returns
  Number of bytes in a cluster.

## ◆ bytesPerClusterShift()

uint8_t FatPartition::bytesPerClusterShift | ( |  | ) | const
| inline

Returns
  The shift count required to multiply by bytesPerCluster.

## ◆ bytesPerSector()

uint16_t FatPartition::bytesPerSector | ( |  | ) | const
| inline

Returns
  Number of bytes per sector.

## ◆ bytesPerSectorShift()

uint8_t FatPartition::bytesPerSectorShift | ( |  | ) | const
| inline

Returns
  The shift count required to multiply by bytesPerCluster.

## ◆ cacheClear()

uint8_t* FatPartition::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 FatPartition::clusterCount | ( |  | ) | const
| inline

Returns
  The total number of clusters in the volume.

## ◆ dataStartSector()

uint32_t FatPartition::dataStartSector | ( |  | ) | const
| inline

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

## ◆ dbgFat()

int8_t FatPartition::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 FatPartition::fatCount | ( |  | ) | const
| inline

Returns
  The number of File Allocation Tables.

## ◆ fatStartSector()

uint32_t FatPartition::fatStartSector | ( |  | ) | const
| inline

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

## ◆ fatType()

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

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

## ◆ freeClusterCount()

int32_t FatPartition::freeClusterCount | ( |  | ) |

Volume free space in clusters.

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

## ◆ init()

bool FatPartition::init | ( | BlockDevice * | dev,
|  | uint8_t | part = `1`
| ) |  |

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
  true for success or false for failure.

## ◆ isBusy()

bool FatPartition::isBusy | ( |  | ) |
| inline

Check for BlockDevice busy.

Returns
  true if busy else false.

## ◆ rootDirEntryCount()

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

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

## ◆ rootDirStart()

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

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

## ◆ sectorMask()

uint16_t FatPartition::sectorMask | ( |  | ) | const
| inline

Returns
  Mask for sector offset.

## ◆ sectorsPerCluster()

uint8_t FatPartition::sectorsPerCluster | ( |  | ) | const
| inline

Returns
  The volume's cluster size in sectors.

## ◆ sectorsPerClusterShift()

uint8_t FatPartition::sectorsPerClusterShift | ( |  | ) | const
| inline

Returns
  The shift count required to multiply by sectorsPerCluster.

## ◆ sectorsPerFat()

uint32_t FatPartition::sectorsPerFat | ( |  | ) | const
| inline

Returns
  The number of sectors in one FAT.

## ◆ volumeSectorCount()

uint32_t FatPartition::volumeSectorCount | ( |  | ) | const
| inline

Returns
  The number of sectors in the volume

## Friends And Related Function Documentation

## ◆ FatFile

friend class FatFile
| friend

FatFile allowed access to private members.

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

- ArduinoSdFat/libraries/SdFat/src/FatLib/FatPartition.h
- ArduinoSdFat/libraries/SdFat/src/FatLib/FatPartition.cpp