Raw access to SD and SDHC flash memory cards.
More...
#include <Sd2Card.h>
List of all members.
Detailed Description
Raw access to SD and SDHC flash memory cards.
Constructor & Destructor Documentation
Sd2Card::Sd2Card |
( |
void |
|
) |
[inline]
|
Member Function Documentation
uint32_t Sd2Card::cardSize |
( |
void |
|
) |
|
Determine the size of a SD flash memory card.
-
Returns:
- The number of 512 byte data blocks in the card
uint8_t Sd2Card::erase |
( |
uint32_t |
firstBlock, |
|
|
uint32_t |
lastBlock
|
|
|
) |
|
|
|
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 one, true, is returned for success and the value zero, false, is returned for failure.
uint8_t Sd2Card::eraseSingleBlockEnable |
( |
void |
|
) |
|
Determine if card supports single block erase.
-
Returns:
- The value one, true, is returned if single block erase is supported. The value zero, false, is returned if single block erase is not supported.
uint8_t Sd2Card::errorCode |
( |
void |
|
) |
[inline]
|
-
Returns:
- error code for last error
uint8_t Sd2Card::errorData |
( |
void |
|
) |
[inline]
|
-
Returns:
- error data for last error
uint8_t Sd2Card::init |
( |
uint8_t |
slow = 0
|
) |
|
Initialize a SD flash memory card.
-
Parameters:
-
[in] |
slow |
Set SPI Frequency F_CPU/4 if true else F_CPU/2. |
-
Returns:
- The value one, true, is returned for success and the value zero, false, is returned for failure.
uint8_t Sd2Card::partialBlockRead |
( |
void |
|
) |
[inline]
|
Returns the current value, true or false, for partial block read.
void Sd2Card::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 may occur if the time between reads is too long since the SD card may timeout.
Use this for applications like the Adafruit Wave Shield.
-
Parameters:
-
[in] |
value |
The value TRUE (non-zero) or FALSE (zero).) |
uint8_t Sd2Card::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.
uint8_t Sd2Card::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.
uint8_t Sd2Card::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.
uint8_t Sd2Card::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.
void Sd2Card::readEnd |
( |
void |
|
) |
|
Skip remaining data in a block when in partial block read mode.
uint8_t Sd2Card::type |
( |
void |
|
) |
[inline]
|
Return the card type: SD V1, SD V2 or SDHC
uint8_t Sd2Card::writeBlock |
( |
uint32_t |
blockNumber, |
|
|
uint8_t * |
src
|
|
|
) |
|
|
|
Writes a 512 byte block to a SD card.
-
Parameters:
-
[in] |
blockNumber |
Logical block to be written. |
[in] |
src |
Pointer to the location of the data to be written. |
-
Returns:
- The value one, true, is returned for success and the value zero, false, is returned for failure.
uint8_t Sd2Card::writeData |
( |
uint8_t * |
src
|
) |
[inline]
|
Write one data block in a multiple block write sequence
uint8_t Sd2Card::writeStart |
( |
uint32_t |
blockNumber, |
|
|
uint32_t |
eraseCount
|
|
|
) |
|
|
|
Start a write multiple blocks sequence.
-
Parameters:
-
[in] |
blockNumber |
Address of first block in sequence. |
[in] |
eraseCount |
The number of blocks to be pre-erased. |
-
Note:
- This function is used with writeData() and writeStop() for optimized multiple block writes.
-
Returns:
- The value one, true, is returned for success and the value zero, false, is returned for failure.
uint8_t Sd2Card::writeStop |
( |
void |
|
) |
|
End a write multiple blocks sequence.
-
Returns:
- The value one, true, is returned for success and the value zero, false, is returned for failure.
The documentation for this class was generated from the following files:
- Arduino/libraries/SdFat/Sd2Card.h
- Arduino/libraries/SdFat/Sd2Card.cpp
Generated on Wed Dec 23 08:22:21 2009 for SdFat by
1.6.1
|