File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -106,18 +106,6 @@ void spiSend(uint8_t data) {
106106 sei ();
107107}
108108#endif // SOFTWARE_SPI
109-
110- void spiRec (uint8_t * data, int size) {
111- #ifdef USE_SPI_LIB
112- SDCARD_SPI.transfer (data, size);
113- #else
114- while (size) {
115- *data++ = spiRec ();
116- size--;
117- }
118- #endif
119- }
120-
121109// ------------------------------------------------------------------------------
122110// send command and return error code. Return zero for OK
123111uint8_t Sd2Card::cardCommand (uint8_t cmd, uint32_t arg) {
@@ -442,7 +430,9 @@ uint8_t Sd2Card::readData(uint32_t block,
442430 spiRec ();
443431 }
444432 // transfer data
445- spiRec (dst, count);
433+ for (uint16_t i = 0 ; i < count; i++) {
434+ dst[i] = spiRec ();
435+ }
446436#endif // OPTIMIZE_HARDWARE_SPI
447437
448438 offset_ += count;
@@ -489,7 +479,7 @@ uint8_t Sd2Card::readRegister(uint8_t cmd, void* buf) {
489479 }
490480 if (!waitStartBlock ()) goto fail;
491481 // transfer data
492- spiRec (dst, 16 );
482+ for ( uint16_t i = 0 ; i < 16 ; i++) dst[i] = spiRec ( );
493483 spiRec (); // get first crc byte
494484 spiRec (); // get second crc byte
495485 chipSelectHigh ();
You can’t perform that action at this time.
0 commit comments