Repetier-Firmware  0.91
Sd2Card Class Reference

Raw access to SD and SDHC flash memory cards. More...

#include <SdFat.h>

Public Member Functions

 Sd2Card ()
uint32_t cardSize ()
bool erase (uint32_t firstBlock, uint32_t lastBlock)
bool eraseSingleBlockEnable ()
void error (uint8_t code)
int errorCode () const
int errorData () const
bool init (uint8_t sckRateID=SPI_FULL_SPEED, uint8_t chipSelectPin=SD_CHIP_SELECT_PIN)
bool readBlock (uint32_t block, uint8_t *dst)
bool readCID (cid_t *cid)
bool readCSD (csd_t *csd)
bool readData (uint8_t *dst)
bool readStart (uint32_t blockNumber)
bool readStop ()
bool setSckRate (uint8_t sckRateID)
int type () const
bool writeBlock (uint32_t blockNumber, const uint8_t *src)
bool writeData (const uint8_t *src)
bool writeStart (uint32_t blockNumber, uint32_t eraseCount)
bool writeStop ()

Private Member Functions

uint8_t cardAcmd (uint8_t cmd, uint32_t arg)
uint8_t cardCommand (uint8_t cmd, uint32_t arg)
bool readData (uint8_t *dst, size_t count)
bool readRegister (uint8_t cmd, void *buf)
void chipSelectHigh ()
void chipSelectLow ()
void type (uint8_t value)
bool waitNotBusy (uint16_t timeoutMillis)
bool writeData (uint8_t token, const uint8_t *src)

Private Attributes

uint8_t chipSelectPin_
uint8_t errorCode_
uint8_t spiRate_
uint8_t status_
uint8_t type_

Detailed Description

Raw access to SD and SDHC flash memory cards.


Constructor & Destructor Documentation

Sd2Card ( ) [inline]

Construct an instance of Sd2Card.


Member Function Documentation

uint8_t cardAcmd ( uint8_t  cmd,
uint32_t  arg 
) [inline, private]
uint8_t cardCommand ( uint8_t  cmd,
uint32_t  arg 
) [private]
uint32_t cardSize ( )
void chipSelectHigh ( ) [private]
void chipSelectLow ( ) [private]
bool erase ( uint32_t  firstBlock,
uint32_t  lastBlock 
)
void error ( uint8_t  code) [inline]

Set SD error code.

Parameters:
[in]codevalue for error code.
int errorCode ( ) const [inline]
Returns:
error code for last error. See Sd2Card.h for a list of error codes.
int errorData ( ) const [inline]
Returns:
error data for last error.
bool init ( uint8_t  sckRateID = SPI_FULL_SPEED,
uint8_t  chipSelectPin = SD_CHIP_SELECT_PIN 
)

Initialize an SD flash memory card with default clock rate and chip select pin. See sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin).

Returns:
true for success or false for failure.
bool readBlock ( uint32_t  block,
uint8_t *  dst 
)
bool readCID ( cid_t *  cid) [inline]

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]cidpointer to area for returned data.
Returns:
true for success or false for failure.
bool readCSD ( csd_t csd) [inline]

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

Parameters:
[out]csdpointer to area for returned data.
Returns:
true for success or false for failure.
bool readData ( uint8_t *  dst)
bool readData ( uint8_t *  dst,
size_t  count 
) [private]
bool readRegister ( uint8_t  cmd,
void *  buf 
) [private]
bool readStart ( uint32_t  blockNumber)
bool readStop ( )
bool setSckRate ( uint8_t  sckRateID)
int type ( ) const [inline]

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

Returns:
0 - SD V1, 1 - SD V2, or 3 - SDHC.
void type ( uint8_t  value) [inline, private]
bool waitNotBusy ( uint16_t  timeoutMillis) [private]
bool writeBlock ( uint32_t  blockNumber,
const uint8_t *  src 
)
bool writeData ( const uint8_t *  src)
bool writeData ( uint8_t  token,
const uint8_t *  src 
) [private]
bool writeStart ( uint32_t  blockNumber,
uint32_t  eraseCount 
)
bool writeStop ( )

Field Documentation

uint8_t chipSelectPin_ [private]
uint8_t errorCode_ [private]
uint8_t spiRate_ [private]
uint8_t status_ [private]
uint8_t type_ [private]

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Defines