many many small changes
switched to the new logging here and there some cleanups worked on i2S base class for files id3 parsing
This commit is contained in:
@@ -77,7 +77,7 @@ public:
|
||||
for (uint8_t i = 0; ; ++i) {
|
||||
const R1 res = cmd0();
|
||||
if (res.raw == 1) {break;}
|
||||
if (i == 4) {Log::addError(NAME, "init failed"); return false;}
|
||||
if (i == 8) {Log::addError(NAME, "init failed"); return false;}
|
||||
delay(50);
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ private:
|
||||
// NOTE: it is IMPORTANT to send 0xFF to the card while reading its responses!
|
||||
|
||||
// wait for the first byte to arrive and read it
|
||||
for (uint8_t i = 0; i < 8; ++i) {
|
||||
for (uint8_t i = 0; i < 32; ++i) {
|
||||
dst[0] = spi.readWriteByte(0xFF);
|
||||
if ( (dst[0] & 0x80) == 0 ) {break;}
|
||||
}
|
||||
@@ -328,6 +328,8 @@ private:
|
||||
/** most simple read operation: read a single block of 512 bytes, addr = byteAddr/512 */
|
||||
bool readSingleBlock(LBA512 addr, uint8_t* dst) {
|
||||
|
||||
//spi.setSlowdown(0);
|
||||
|
||||
sendCMD(17, addr>>24, addr>>16, addr>>8, addr>>0, 0xFF);
|
||||
R1 res; readResponse(&res.raw, 1);
|
||||
|
||||
@@ -341,7 +343,7 @@ private:
|
||||
uint8_t res = spi.readWriteByte(0xFF);
|
||||
if (res == 0xFE) {break;} // available!
|
||||
if (res != 0xFF) {Log::addError(NAME, "invalid"); endCMD(); return false;} // invalid response
|
||||
if (i > 1024) {Log::addError(NAME, "timeout"); endCMD(); return false;} // timeout
|
||||
if (i > 32768) {Log::addError(NAME, "timeout"); endCMD(); return false;} // timeout
|
||||
}
|
||||
|
||||
// read data
|
||||
@@ -349,6 +351,8 @@ private:
|
||||
dst[i] = spi.readWriteByte(0xFF);
|
||||
}
|
||||
|
||||
//spi.setSlowdown(128);
|
||||
|
||||
// done
|
||||
endCMD();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user