Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: GPS_6Axis_DataLogger_SD_UDP
Fork of SDFileSystem by
Diff: SDFileSystem.cpp
- Revision:
- 4:fdba0c0ad686
- Parent:
- 3:7b35d1709458
--- a/SDFileSystem.cpp Mon Mar 17 14:34:01 2014 +0000
+++ b/SDFileSystem.cpp Thu Apr 02 20:07:39 2015 +0000
@@ -273,8 +273,8 @@
_spi.write(arg >> 8);
_spi.write(arg >> 0);
_spi.write(0x95);
-
- // wait for the repsonse (response[7] == 0)
+
+ // wait for the repsonse (response[7] == 0)
for (int i = 0; i < SD_COMMAND_TIMEOUT; i++) {
int response = _spi.write(0xFF);
if (!(response & 0x80)) {
@@ -348,10 +348,10 @@
int SDFileSystem::_read(uint8_t *buffer, uint32_t length) {
_cs = 0;
-
+
// read until start byte (0xFF)
while (_spi.write(0xFF) != 0xFE);
-
+
// read data
for (int i = 0; i < length; i++) {
buffer[i] = _spi.write(0xFF);
@@ -412,19 +412,20 @@
uint32_t block_len, mult, blocknr, capacity;
uint32_t hc_c_size;
uint64_t blocks;
-
+
// CMD9, Response R2 (R1 byte + 16-byte block read)
if (_cmdx(9, 0) != 0) {
debug("Didn't get a response from the disk\n");
return 0;
}
+
uint8_t csd[16];
if (_read(csd, 16) != 0) {
debug("Couldn't read csd response from disk\n");
return 0;
}
-
+
// csd_structure : csd[127:126]
// c_size : csd[73:62]
// c_size_mult : csd[49:47]
