Classes | Defines | Variables
D:/DRISSI/arduino-0022/arduino-0022/libraries/SD/utility/Sd2Card.h File Reference

Sd2Card class. More...

#include "Sd2PinMap.h"
#include "SdInfo.h"

Go to the source code of this file.

Classes

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

Defines

#define MEGA_SOFT_SPI   0
 Define MEGA_SOFT_SPI non-zero to use software SPI on Mega Arduinos.
#define OPTIMIZE_HARDWARE_SPI
 optimize loops for hardware SPI
#define SD_PROTECT_BLOCK_ZERO   1
 Protect block zero from write if nonzero.

Variables

uint8_t const SPI_FULL_SPEED = 0
 Set SCK to max rate of F_CPU/2.
uint8_t const SPI_HALF_SPEED = 1
 Set SCK rate to F_CPU/4.
uint8_t const SPI_QUARTER_SPEED = 2
 Set SCK rate to F_CPU/8.
uint8_t const SD_CHIP_SELECT_PIN = SS_PIN
 SD Chip Select pin.
uint8_t const SPI_MOSI_PIN = MOSI_PIN
 SPI Master Out Slave In pin.
uint8_t const SPI_MISO_PIN = MISO_PIN
 SPI Master In Slave Out pin.
uint8_t const SPI_SCK_PIN = SCK_PIN
 SPI Clock pin.
uint16_t const SD_INIT_TIMEOUT = 2000
 init timeout ms
uint16_t const SD_ERASE_TIMEOUT = 10000
 erase timeout ms
uint16_t const SD_READ_TIMEOUT = 300
 read timeout ms
uint16_t const SD_WRITE_TIMEOUT = 600
 write time out ms
uint8_t const SD_CARD_ERROR_CMD0 = 0X1
 timeout error for command CMD0
uint8_t const SD_CARD_ERROR_CMD8 = 0X2
 CMD8 was not accepted - not a valid SD card.
uint8_t const SD_CARD_ERROR_CMD17 = 0X3
 card returned an error response for CMD17 (read block)
uint8_t const SD_CARD_ERROR_CMD24 = 0X4
 card returned an error response for CMD24 (write block)
uint8_t const SD_CARD_ERROR_CMD25 = 0X05
 WRITE_MULTIPLE_BLOCKS command failed.
uint8_t const SD_CARD_ERROR_CMD58 = 0X06
 card returned an error response for CMD58 (read OCR)
uint8_t const SD_CARD_ERROR_ACMD23 = 0X07
 SET_WR_BLK_ERASE_COUNT failed.
uint8_t const SD_CARD_ERROR_ACMD41 = 0X08
 card's ACMD41 initialization process timeout
uint8_t const SD_CARD_ERROR_BAD_CSD = 0X09
 card returned a bad CSR version field
uint8_t const SD_CARD_ERROR_ERASE = 0X0A
 erase block group command failed
uint8_t const SD_CARD_ERROR_ERASE_SINGLE_BLOCK = 0X0B
 card not capable of single block erase
uint8_t const SD_CARD_ERROR_ERASE_TIMEOUT = 0X0C
 Erase sequence timed out.
uint8_t const SD_CARD_ERROR_READ = 0X0D
 card returned an error token instead of read data
uint8_t const SD_CARD_ERROR_READ_REG = 0X0E
 read CID or CSD failed
uint8_t const SD_CARD_ERROR_READ_TIMEOUT = 0X0F
 timeout while waiting for start of read data
uint8_t const SD_CARD_ERROR_STOP_TRAN = 0X10
 card did not accept STOP_TRAN_TOKEN
uint8_t const SD_CARD_ERROR_WRITE = 0X11
 card returned an error token as a response to a write operation
uint8_t const SD_CARD_ERROR_WRITE_BLOCK_ZERO = 0X12
 attempt to write protected block zero
uint8_t const SD_CARD_ERROR_WRITE_MULTIPLE = 0X13
 card did not go ready for a multiple block write
uint8_t const SD_CARD_ERROR_WRITE_PROGRAMMING = 0X14
 card returned an error to a CMD13 status check after a write
uint8_t const SD_CARD_ERROR_WRITE_TIMEOUT = 0X15
 timeout occurred during write programming
uint8_t const SD_CARD_ERROR_SCK_RATE = 0X16
 incorrect rate selected
uint8_t const SD_CARD_TYPE_SD1 = 1
 Standard capacity V1 SD card.
uint8_t const SD_CARD_TYPE_SD2 = 2
 Standard capacity V2 SD card.
uint8_t const SD_CARD_TYPE_SDHC = 3
 High Capacity SD card.

Detailed Description

Sd2Card class.

Definition in file Sd2Card.h.


Define Documentation

#define MEGA_SOFT_SPI   0

Define MEGA_SOFT_SPI non-zero to use software SPI on Mega Arduinos.

Pins used are SS 10, MOSI 11, MISO 12, and SCK 13.

MEGA_SOFT_SPI allows an unmodified Adafruit GPS Shield to be used on Mega Arduinos. Software SPI works well with GPS Shield V1.1 but many SD cards will fail with GPS Shield V1.0.

Definition at line 42 of file Sd2Card.h.


Variable Documentation

uint8_t const SD_CHIP_SELECT_PIN = SS_PIN

SD Chip Select pin.

Warning if this pin is redefined the hardware SS will pin will be enabled as an output by init(). An avr processor will not function as an SPI master unless SS is set to output mode. The default chip select pin for the SD card is SS.

Definition at line 60 of file Sd2Card.h.

uint8_t const SPI_FULL_SPEED = 0

Set SCK to max rate of F_CPU/2.

See Sd2Card::setSckRate().

Definition at line 29 of file Sd2Card.h.

uint8_t const SPI_HALF_SPEED = 1

Set SCK rate to F_CPU/4.

See Sd2Card::setSckRate().

Definition at line 31 of file Sd2Card.h.

uint8_t const SPI_QUARTER_SPEED = 2

Set SCK rate to F_CPU/8.

Sd2Card::setSckRate().

Definition at line 33 of file Sd2Card.h.