Skip to content

Commit ea88740

Browse files
Use passed-in SPI on SD.end(true) (#2040)
Fixes #2034
1 parent 77209a1 commit ea88740

File tree

1 file changed

+3
-1
lines changed
  • libraries/SD/src

1 file changed

+3
-1
lines changed

libraries/SD/src/SD.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
class SDClass {
3333
public:
3434
bool begin(uint8_t csPin, HardwareSPI &spi) {
35+
_spi = &spi;
3536
SDFS.setConfig(SDFSConfig(csPin, SPI_HALF_SPEED, spi));
3637
return SDFS.begin();
3738
}
@@ -43,7 +44,7 @@ class SDClass {
4344
void end(bool endSPI = true) {
4445
SDFS.end();
4546
if (endSPI) {
46-
SPI.end();
47+
_spi->end();
4748
}
4849
}
4950

@@ -204,6 +205,7 @@ class SDClass {
204205
return time(nullptr);
205206
}
206207

208+
HardwareSPI *_spi;
207209
};
208210

209211

0 commit comments

Comments
 (0)