File tree 1 file changed +13
-1
lines changed 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -354,7 +354,7 @@ namespace SDLib {
354
354
volume.init (card) &&
355
355
root.openRoot (volume);
356
356
}
357
-
357
+ # ifndef SOFTWARE_SPI // Added compiler directive so that MEGA works with this code
358
358
bool SDClass::begin (uint32_t clock, uint8_t csPin) {
359
359
if (root.isOpen ()) {
360
360
root.close ();
@@ -365,7 +365,19 @@ namespace SDLib {
365
365
volume.init (card) &&
366
366
root.openRoot (volume);
367
367
}
368
+ #else
369
+ bool SDClass::begin (uint32_t clock, uint8_t csPin) {
370
+ if (root.isOpen ()) {
371
+ root.close ();
372
+ }
368
373
374
+ return card.init (SPI_HALF_SPEED, csPin) &&
375
+ card.setSpiClock (clock ) &&
376
+ volume.init (card) &&
377
+ root.openRoot (volume);
378
+ }
379
+ #endif // SOFTWARE_SPI
380
+
369
381
// call this when a card is removed. It will allow you to insert and initialise a new card.
370
382
void SDClass::end () {
371
383
root.close ();
You can’t perform that action at this time.
0 commit comments