Skip to main content

IBlockDriver Interface

Namespace: GHIElectronics.TinyCLR.IO.TinyFileSystem · Assembly: GHIElectronics.TinyCLR.IO.TinyFileSystem

Interface to abstract the file system from the physical device.

public interface IBlockDriver : IDisposable

Properties

DeviceSize

int DeviceSize { get; }

Full capacity of the device in bytes.

SectorSize

int SectorSize { get; }

The size in bytes of a sector on the device.

ClusterSize

ushort ClusterSize { get; }

The cluster size in bytes.

Methods

EraseChip()

void EraseChip()

Completely erases the memory chip (fills it with 0xFF, in reality, as it is a Flash memory).

EraseSector(int sectorId)

void EraseSector(int sectorId)

Erases a sector on the device.

ParameterTypeDescription
sectorIdintSector to be erased.

Read(ushort clusterId, int clusterOffset, byte[] data, int index, int count)

void Read(ushort clusterId, int clusterOffset, byte[] data, int index, int count)

Read a block of data from a cluster.

ParameterTypeDescription
clusterIdushortThe cluster to read from.
clusterOffsetintThe offset into the cluster to start reading from.
databyte[]The byte array to fill with the data read from the device.
indexintThe index into the array to start filling the data.
countintThe maximum number of bytes to read.

Write(ushort clusterId, int clusterOffset, byte[] data, int index, int count)

void Write(ushort clusterId, int clusterOffset, byte[] data, int index, int count)

Write a block of data to a cluster.

ParameterTypeDescription
clusterIdushortThe cluster to write to.
clusterOffsetintThe offset into the cluster to start writting to.
databyte[]The byte array containing the data to be written.
indexintThe index into the array to start writting from
countintThe number of bytes to write.