Fork for GSP_6Axis_DataLogger_SD_UDP_K64F
Dependents: GPS_6Axis_DataLogger_SD_UDP
Fork of SDFileSystem by
Revision 4:fdba0c0ad686, committed 2015-04-02
- Comitter:
- rlinnmoran
- Date:
- Thu Apr 02 20:07:39 2015 +0000
- Parent:
- 3:7b35d1709458
- Commit message:
- - Improved SD functionality; - added UDP functionality; - made code more robust for error reporting; - added LED status indication; ; To do:; - Document code thoroughly; - Multi levels of debug statements; - Recovery from failure conditions
Changed in this revision
SDFileSystem.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 7b35d1709458 -r fdba0c0ad686 SDFileSystem.cpp --- 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]