Hardware access class for SD flash cards.
More...
#include <SdReader.h>
Hardware access class for SD flash cards.
Supports raw access to SD and SDHC flash memory cards.
◆ SdReader()
SdReader::SdReader |
( |
void |
| ) |
|
|
inline |
◆ cardSize()
uint32_t SdReader::cardSize |
( |
void |
| ) |
|
Determine the size of an SD flash memory card.
- Returns
- The number of 512 byte data blocks in the card
◆ errorCode()
uint8_t SdReader::errorCode |
( |
void |
| ) |
|
|
inline |
- Returns
- error code for last error
◆ errorData()
uint8_t SdReader::errorData |
( |
void |
| ) |
|
|
inline |
- Returns
- error data for last error
◆ init()
Initialize a SD flash memory card.
- Parameters
-
[in] | slow | If slow is false (zero) the SPI bus will be initialize at a speed of 8 Mhz. If slow is true (nonzero) the SPI bus will be initialize a speed of 4 Mhz. This may be helpful for some SD cards with Version 1.0 of the Adafruit Wave Shield. |
- Returns
- The value one, true, is returned for success and the value zero, false, is returned for failure.
◆ partialBlockRead()
void SdReader::partialBlockRead |
( |
uint8_t |
value | ) |
|
|
inline |
Enable or disable partial block reads.
Enabling partial block reads improves performance by allowing a block to be read over the SPI bus as several sub-blocks. Errors will occur if the time between reads is too long since the SD card will timeout.
Use this for applications like the Adafruit Wave Shield.
- Parameters
-
[in] | value | The value TRUE (non-zero) or FALSE (zero).) |
◆ readBlock()
uint8_t SdReader::readBlock |
( |
uint32_t |
block, |
|
|
uint8_t * |
dst |
|
) |
| |
|
inline |
Read a 512 byte block from a SD card device.
- Parameters
-
[in] | block | Logical block to be read. |
[out] | dst | Pointer to the location that will receive the data. |
- Returns
- The value one, true, is returned for success and the value zero, false, is returned for failure.
◆ readData()
uint8_t SdReader::readData |
( |
uint32_t |
block, |
|
|
uint16_t |
offset, |
|
|
uint8_t * |
dst, |
|
|
uint16_t |
count |
|
) |
| |
Read part of a 512 byte block from a SD card.
- Parameters
-
[in] | block | Logical block to be read. |
[in] | offset | Number of bytes to skip at start of block |
[out] | dst | Pointer to the location that will receive the data. |
[in] | count | Number of bytes to read |
- Returns
- The value one, true, is returned for success and the value zero, false, is returned for failure.
◆ readCID()
uint8_t SdReader::readCID |
( |
cid_t & |
cid | ) |
|
|
inline |
Read a cards CID register. The CID contains card identification information such as Manufacturer ID, Product name, Product serial number and Manufacturing date.
Read a cards CID register. The CID contains card identification information such as Manufacturer ID, Product name, Product serial number and Manufacturing date.
- Parameters
-
cid | the pointer to the cid struct the data should be placed in |
- Returns
- the return code after the read
◆ readCSD()
uint8_t SdReader::readCSD |
( |
csd_t & |
csd | ) |
|
|
inline |
Read a cards CSD register. The CSD contains Card-Specific Data that provides information regarding access to the card contents.
- Parameters
-
csd | pointer to the struct the data should be placed in. |
- Returns
- the return code after the read.
◆ readEnd()
void SdReader::readEnd |
( |
void |
| ) |
|
Skip remaining data in a block when in partial block read mode.
◆ type()
uint8_t SdReader::type |
( |
| ) |
|
|
inline |
Return the card type: SD V1, SD V2 or SDHC.
- Returns
- the type
The documentation for this class was generated from the following files: