Table of Contents

Class SDCard

Namespace
nanoFramework.System.IO.FileSystem
Assembly
System.IO.FileSystem.dll

Class to allow a SD memory card to be configured and mounted on the system.

public class SDCard : IDisposable
Inheritance
SDCard
Implements
Inherited Members
Extension Methods

Constructors

SDCard(uint)

Creates an instance of SDcard where parameters have already been defined in firmware.

public SDCard(uint slotIndex = 0)

Parameters

slotIndex uint

SDCard(SDCardMmcParameters, CardDetectParameters)

Create an instance of SDCard for a MMC connected SD card.

public SDCard(SDCardMmcParameters mmcParameters, CardDetectParameters cdParameters = null)

Parameters

mmcParameters SDCardMmcParameters

Connection parameters

cdParameters CardDetectParameters

Card detect parameters

SDCard(SDCardSpiParameters, CardDetectParameters)

Create an instance of SDCard for a SPI connected SD card.

public SDCard(SDCardSpiParameters spiParameters, CardDetectParameters cdParameters = null)

Parameters

spiParameters SDCardSpiParameters

Connection parameters

cdParameters CardDetectParameters

Card detect parameters

Properties

CardDetectEnabled

Return true if Card detection is enabled.

public bool CardDetectEnabled { get; }

Property Value

bool

CardType

Type of interface used by SDCard.

public SDCard.SDInterfaceType CardType { get; }

Property Value

SDCard.SDInterfaceType

CdParameters

The Card detect parameters for SD card.

public CardDetectParameters CdParameters { get; }

Property Value

CardDetectParameters

IsCardDetected

Indicates if SD card has been detected if optional cardDetectPin parameter is enabled with a valid GPIO pin. If not enabled will always return false.

public bool IsCardDetected { get; }

Property Value

bool

Remarks

Not all SD Card modules have a card detect pin or the pin connected to a GPIO pin.

IsMounted

Indicates if the SD card has been mounted.

public bool IsMounted { get; }

Property Value

bool

MmcParameters

The parameters for a MMC connected SD card.

public SDCardMmcParameters MmcParameters { get; }

Property Value

SDCardMmcParameters

SlotIndex

SD card slot index.

public uint SlotIndex { get; }

Property Value

uint

SpiParameters

The parameters for a SPI connected SD card.

public SDCardSpiParameters SpiParameters { get; }

Property Value

SDCardSpiParameters

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Finalize()

protected override void Finalize()

Mount()

Mount the SD memory card device

public void Mount()

Remarks

This will try to mount the SD memory card on the specified interface. If the Card is not present or the card is unable to be read then an exception will be thrown.

Unmount()

Unmount a mounted SD memory card.

public void Unmount()

Events

CardDetectChanged

Event that occurs when SD card detect changes state.

public event CardDetectStateEventHandler CardDetectChanged

Event Type

CardDetectStateEventHandler

Remarks

The SDCard class raises the CardDetectChanged event when an SD Cards is inserted or removed. This is only raised if SD card is configured with a Card Detect pin. Some SD card holders don't have this feature.

You only need to use this event if the CardDetectParameters are configured for a manual mount of card on card detect. The default is automatic.