127 #if MEGA_SOFT_SPI && (defined(__AVR_ATmega1280__)||defined(__AVR_ATmega2560__))
129 #elif USE_SOFTWARE_SPI
153 bool erase(uint32_t firstBlock, uint32_t lastBlock);
159 void error(uint8_t code) {errorCode_ = code;}
173 bool readBlock(uint32_t block, uint8_t* dst);
184 return readRegister(CMD10, cid);
195 return readRegister(CMD9, csd);
204 int type()
const {
return type_;}
205 bool writeBlock(uint32_t blockNumber,
const uint8_t* src);
207 bool writeStart(uint32_t blockNumber, uint32_t eraseCount);
211 uint8_t
readExtMemory(uint8_t mio, uint8_t func, uint32_t addr, uint16_t count, uint8_t* dst);
213 void setFlashAirCompatible(
bool flashAirCompatible) { flash_air_compatible_ = flashAirCompatible; }
214 bool getFlashAirCompatible()
const {
return flash_air_compatible_; }
222 bool flash_air_compatible_;
224 uint8_t cardAcmd(uint8_t cmd, uint32_t arg) {
225 cardCommand(CMD55, 0);
226 return cardCommand(cmd, arg);
228 uint8_t cardCommand(uint8_t cmd, uint32_t arg);
230 bool readData(uint8_t* dst, uint16_t count);
231 bool readRegister(uint8_t cmd,
void* buf);
232 void chipSelectHigh();
233 void chipSelectLow();
234 void type(uint8_t value) {type_ = value;}
235 bool waitNotBusy(uint16_t timeoutMillis);
236 bool writeData(uint8_t token,
const uint8_t* src);
240 uint8_t waitStartBlock(
void);
241 uint8_t readExt(uint32_t arg, uint8_t* dst, uint16_t count);
uint8_t const SD_CARD_ERROR_ERASE_SINGLE_BLOCK
Definition: Sd2Card.h:80
uint16_t const SD_READ_TIMEOUT
Definition: Sd2Card.h:50
uint8_t const SD_CARD_ERROR_WRITE_PROGRAMMING
Definition: Sd2Card.h:98
uint8_t const SD_CARD_ERROR_BAD_CSD
Definition: Sd2Card.h:76
uint8_t const SD_CARD_ERROR_CMD58
Definition: Sd2Card.h:70
uint8_t const SD_CARD_ERROR_CMD18
Definition: Sd2Card.h:64
uint8_t const SD_CARD_TYPE_SD2
Definition: Sd2Card.h:120
uint8_t const SD_CARD_ERROR_CMD8
Definition: Sd2Card.h:58
uint8_t const SD_CARD_ERROR_CMD17
Definition: Sd2Card.h:62
uint8_t const SD_CARD_ERROR_WRITE_MULTIPLE
Definition: Sd2Card.h:96
uint8_t const SD_CARD_ERROR_WRITE_BLOCK_ZERO
Definition: Sd2Card.h:94
uint8_t const SD_CARD_ERROR_CMD0
Definition: Sd2Card.h:56
uint8_t const SD_CARD_TYPE_SDHC
Definition: Sd2Card.h:122
uint8_t const SD_CARD_ERROR_CMD49
Definition: Sd2Card.h:113
uint8_t const SD_CARD_ERROR_CMD25
Definition: Sd2Card.h:68
uint8_t const SD_CARD_ERROR_READ_TIMEOUT
Definition: Sd2Card.h:88
uint8_t const SD_CARD_ERROR_ACMD41
Definition: Sd2Card.h:74
uint8_t const SD_CARD_ERROR_FF_TIMEOUT
Definition: Sd2Card.h:108
uint8_t const SPI_FULL_SPEED
Definition: Sd2Card.h:35
uint8_t const SD_CARD_ERROR_ERASE
Definition: Sd2Card.h:78
uint8_t const SPI_SIXTEENTH_SPEED
Definition: Sd2Card.h:43
uint8_t const SPI_SCK_PIN
Definition: Sd2Card.h:141
uint8_t const SD_CARD_ERROR_ERASE_TIMEOUT
Definition: Sd2Card.h:82
uint8_t const SD_CARD_ERROR_STOP_TRAN
Definition: Sd2Card.h:90
uint8_t const SD_CARD_ERROR_WRITE
Definition: Sd2Card.h:92
uint16_t const SD_WRITE_TIMEOUT
Definition: Sd2Card.h:52
uint8_t const SD_CARD_ERROR_SCK_RATE
Definition: Sd2Card.h:102
uint8_t const SD_CARD_ERROR_ACMD23
Definition: Sd2Card.h:72
uint8_t const SD_CARD_ERROR_INIT_NOT_CALLED
Definition: Sd2Card.h:104
uint16_t const SD_INIT_TIMEOUT
Definition: Sd2Card.h:46
uint8_t const SD_CARD_ERROR_CMD48
Definition: Sd2Card.h:111
uint8_t const SPI_MOSI_PIN
Definition: Sd2Card.h:137
uint8_t const SPI_HALF_SPEED
Definition: Sd2Card.h:37
uint8_t const SPI_EIGHTH_SPEED
Definition: Sd2Card.h:41
uint8_t const SPI_QUARTER_SPEED
Definition: Sd2Card.h:39
uint8_t const SD_CARD_ERROR_READ
Definition: Sd2Card.h:84
uint8_t const SD_CARD_ERROR_CMD24
Definition: Sd2Card.h:66
uint8_t const SPI_MISO_PIN
Definition: Sd2Card.h:139
uint8_t const SD_CARD_ERROR_WRITE_TIMEOUT
Definition: Sd2Card.h:100
uint8_t const SD_CARD_ERROR_CMD12
Definition: Sd2Card.h:60
uint8_t const SD_CARD_ERROR_READ_REG
Definition: Sd2Card.h:86
uint8_t const SD_CARD_TYPE_SD1
Definition: Sd2Card.h:118
uint8_t const SD_CARD_ERROR_CRC
Definition: Sd2Card.h:106
uint16_t const SD_ERASE_TIMEOUT
Definition: Sd2Card.h:48
configuration definitions
uint8_t const SOFT_SPI_MOSI_PIN
Definition: SdFatConfig.h:100
uint8_t const SOFT_SPI_SCK_PIN
Definition: SdFatConfig.h:104
uint8_t const SOFT_SPI_MISO_PIN
Definition: SdFatConfig.h:102
Raw access to SD and SDHC flash memory cards.
Definition: Sd2Card.h:148
bool writeStart(uint32_t blockNumber, uint32_t eraseCount)
Definition: Sd2Card.cpp:708
Sd2Card()
Definition: Sd2Card.h:151
bool readCSD(csd_t *csd)
Definition: Sd2Card.h:194
uint32_t cardSize()
Definition: Sd2Card.cpp:187
bool init(uint8_t sckRateID=SPI_FULL_SPEED)
Definition: Sd2Card.cpp:286
bool erase(uint32_t firstBlock, uint32_t lastBlock)
Definition: Sd2Card.cpp:231
bool readStart(uint32_t blockNumber)
Definition: Sd2Card.cpp:558
bool readBlock(uint32_t block, uint8_t *dst)
Definition: Sd2Card.cpp:393
bool readData(uint8_t *dst)
Definition: Sd2Card.cpp:438
bool writeStop()
Definition: Sd2Card.cpp:733
uint8_t readExtMemory(uint8_t mio, uint8_t func, uint32_t addr, uint16_t count, uint8_t *dst)
Definition: Sd2Card.cpp:818
int type() const
Definition: Sd2Card.h:204
uint8_t errorCode() const
Definition: Sd2Card.h:163
uint8_t errorData() const
Definition: Sd2Card.h:165
bool readCID(cid_t *cid)
Definition: Sd2Card.h:183
bool eraseSingleBlockEnable()
Definition: Sd2Card.cpp:271
bool writeBlock(uint32_t blockNumber, const uint8_t *src)
Definition: Sd2Card.cpp:632
bool setSckRate(uint8_t sckRateID)
Definition: Sd2Card.cpp:603
bool readStop()
Definition: Sd2Card.cpp:577
void error(uint8_t code)
Definition: Sd2Card.h:159
bool writeData(const uint8_t *src)
Definition: Sd2Card.cpp:664