Go Down

Topic: Clarifying difference between SD.begin(chipSelect) & card.init(SPI_HULL_SPEED, c (Read 2256 times) previous topic - next topic


I'm new to working with the SD library.

Could someone point me to a new user explanation of the differences between initialising a card for use by applying:
Code: [Select]
[as used in the ReadWrite.ino example] as opposed to
Code: [Select]
card.init(SPI_HALF_SPEED, chipSelect)
[as used in the CardInfo.ino example].

I would like to integrate functionality from both examples in one sketch.


SD is a wrapper for SdFat.  When I wrote SdFat I designed three main classes, Sd2Card, SdVolume, and SdFile. 

The Arduino group wrote a wrapper class to simplify I/O to SD cards that contains the three classes.

Since they correctly made these members private:
Code: [Select]

  // These are required for initialization and use of sdfatlib
  Sd2Card card;
  SdVolume volume;
  SdFile root;

You can't easily integrate the functionality of both in one sketch.

You might want to look at SdFat without the wrapper since the version of SdFat in SD.h is very old.  SdFat is here http://code.google.com/p/sdfatlib/downloads/list and betas/extras are here http://code.google.com/p/beta-lib/downloads/list.

Go Up