SdFat: SdioCardEX Class Reference

SdFat

Public Member Functions | List of all members
SdioCardEX Class Reference

Extended SD I/O block driver. More...

`#include <SdioCard.h>`

Inheritance diagram for SdioCardEX:
[legend]
Collaboration diagram for SdioCardEX:
[legend]

## Public Member Functions

bool | begin ()
uint32_t | cardSize ()
bool | erase (uint32_t firstBlock, uint32_t lastBlock)
uint8_t | errorCode ()
uint32_t | errorData ()
uint32_t | errorLine ()
bool | isBusy ()
uint32_t | kHzSdClk ()
bool | readBlock (uint32_t block, uint8_t *dst)
bool | readBlocks (uint32_t block, uint8_t *dst, size_t nb)
bool | readCID (void *cid)
bool | readCSD (void *csd)
bool | readData (uint8_t *dst)
bool | readOCR (uint32_t *ocr)
bool | readStart (uint32_t lba)
bool | readStart (uint32_t lba, uint32_t count)
bool | readStop ()
bool | syncBlocks ()
uint8_t | type ()
bool | writeBlock (uint32_t block, const uint8_t *src)
bool | writeBlocks (uint32_t block, const uint8_t *src, size_t nb)
bool | writeData (const uint8_t *src)
bool | writeStart (uint32_t lba)
bool | writeStart (uint32_t lba, uint32_t count)
bool | writeStop ()

## Detailed Description

Extended SD I/O block driver.

## Member Function Documentation

## ◆ begin()

bool SdioCardEX::begin | ( |  | ) |

inline

Initialize the SD card

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

## ◆ cardSize()

uint32_t SdioCard::cardSize | ( |  | ) |

inherited

Determine the size of an SD flash memory card.

Returns
  The number of 512 byte data blocks in the card or zero if an error occurs.

## ◆ erase()

bool SdioCardEX::erase | ( | uint32_t | firstBlock,
|  | uint32_t | lastBlock
| ) |  |

inline

Erase a range of blocks.

Parameters

  [in] | firstBlock | The address of the first block in the range.
  [in] | lastBlock | The address of the last block in the range.

Note
  This function requests the SD card to do a flash erase for a range of blocks. The data on the card after an erase operation is either 0 or 1, depends on the card vendor. The card must support single block erase.

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

## ◆ errorCode()

uint8_t SdioCard::errorCode | ( |  | ) |

inherited

Returns
  code for the last error. See SdInfo.h for a list of error codes.

## ◆ errorData()

uint32_t SdioCard::errorData | ( |  | ) |

inherited

Returns
  error data for last error.

## ◆ errorLine()

uint32_t SdioCard::errorLine | ( |  | ) |

inherited

Returns
  error line for last error. Tmp function for debug.

## ◆ isBusy()

bool SdioCard::isBusy | ( |  | ) |

inherited

Check for busy with CMD13.

Returns
  true if busy else false.

## ◆ kHzSdClk()

uint32_t SdioCard::kHzSdClk | ( |  | ) |

inherited

Returns
  the SD clock frequency in kHz.

## ◆ readBlock()

bool SdioCardEX::readBlock | ( | uint32_t | block,
|  | uint8_t * | dst
| ) |  |

virtual

Read a 512 byte block from an SD card.

Parameters

  [in] | block | Logical block to be read.
  [out] | dst | Pointer to the location that will receive the data.

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

Reimplemented from SdioCard.

## ◆ readBlocks()

bool SdioCardEX::readBlocks | ( | uint32_t | block,
|  | uint8_t * | dst,
|  | size_t | nb
| ) |  |

virtual

Read multiple 512 byte blocks from an SD card.

Parameters

  [in] | block | Logical block to be read.
  [in] | nb | Number of blocks to be read.
  [out] | dst | Pointer to the location that will receive the data.

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

Reimplemented from SdioCard.

## ◆ readCID()

bool SdioCard::readCID | ( | void * | cid | ) |

inherited

Read a card's CID register. The CID contains card identification information such as Manufacturer ID, Product name, Product serial number and Manufacturing date.

Parameters

  [out] | cid | pointer to area for returned data.

Returns
  true for success or false for failure.

## ◆ readCSD()

bool SdioCard::readCSD | ( | void * | csd | ) |

inherited

Read a card's CSD register. The CSD contains Card-Specific Data that provides information regarding access to the card's contents.

Parameters

  [out] | csd | pointer to area for returned data.

Returns
  true for success or false for failure.

## ◆ readData()

bool SdioCard::readData | ( | uint8_t * | dst | ) |

inherited

Read one data block in a multiple block read sequence

Parameters

  [out] | dst | Pointer to the location for the data to be read.

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

## ◆ readOCR()

bool SdioCard::readOCR | ( | uint32_t * | ocr | ) |

inherited

Read OCR register.

Parameters

  [out] | ocr | Value of OCR register.

Returns
  true for success else false.

## ◆ readStart() [1/2]

bool SdioCard::readStart | ( | uint32_t | lba | ) |

inherited

Start a read multiple blocks sequence.

Parameters

  [in] | lba | Address of first block in sequence.

Note
  This function is used with readData() and readStop() for optimized multiple block reads. SPI chipSelect must be low for the entire sequence.

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

## ◆ readStart() [2/2]

bool SdioCard::readStart | ( | uint32_t | lba,
|  | uint32_t | count
| ) |  |

inherited

Start a read multiple blocks sequence.

Parameters

  [in] | lba | Address of first block in sequence.
  [in] | count | Maximum block count.

Note
  This function is used with readData() and readStop() for optimized multiple block reads. SPI chipSelect must be low for the entire sequence.

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

## ◆ readStop()

bool SdioCard::readStop | ( |  | ) |

inherited

End a read multiple blocks sequence.

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

## ◆ syncBlocks()

bool SdioCardEX::syncBlocks | ( |  | ) |

virtual

End multi-block transfer and go to idle state.

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

Reimplemented from SdioCard.

## ◆ type()

uint8_t SdioCard::type | ( |  | ) |

inherited

Return the card type: SD V1, SD V2 or SDHC

Returns
  0 - SD V1, 1 - SD V2, or 3 - SDHC.

## ◆ writeBlock()

bool SdioCardEX::writeBlock | ( | uint32_t | block,
|  | const uint8_t * | src
| ) |  |

virtual

Writes a 512 byte block to an SD card.

Parameters

  [in] | block | Logical block to be written.
  [in] | src | Pointer to the location of the data to be written.

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

Reimplemented from SdioCard.

## ◆ writeBlocks()

bool SdioCardEX::writeBlocks | ( | uint32_t | block,
|  | const uint8_t * | src,
|  | size_t | nb
| ) |  |

virtual

Write multiple 512 byte blocks to an SD card.

Parameters

  [in] | block | Logical block to be written.
  [in] | nb | Number of blocks to be written.
  [in] | src | Pointer to the location of the data to be written.

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

Reimplemented from SdioCard.

## ◆ writeData()

bool SdioCard::writeData | ( | const uint8_t * | src | ) |

inherited

Write one data block in a multiple block write sequence.

Parameters

  [in] | src | Pointer to the location of the data to be written.

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

## ◆ writeStart() [1/2]

bool SdioCard::writeStart | ( | uint32_t | lba | ) |

inherited

Start a write multiple blocks sequence.

Parameters

  [in] | lba | Address of first block in sequence.

Note
  This function is used with writeData() and writeStop() for optimized multiple block writes.

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

## ◆ writeStart() [2/2]

bool SdioCard::writeStart | ( | uint32_t | lba,
|  | uint32_t | count
| ) |  |

inherited

Start a write multiple blocks sequence.

Parameters

  [in] | lba | Address of first block in sequence.
  [in] | count | Maximum block count.

Note
  This function is used with writeData() and writeStop() for optimized multiple block writes.

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

## ◆ writeStop()

bool SdioCard::writeStop | ( |  | ) |

inherited

End a write multiple blocks sequence.

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

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

- Arduino/libraries/SdFat/src/SdCard/SdioCard.h
- Arduino/libraries/SdFat/src/SdCard/SdioCardEX.cpp