Pages: [1]   Go Down
Author Topic: Clarifying difference between SD.begin(chipSelect) & card.init(SPI_HULL_SPEED, c  (Read 997 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
SD.begin(chipSelect)
[as used in the ReadWrite.ino example] as opposed to
Code:
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.
Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
private:
  // 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.
Logged

Pages: [1]   Go Up
Jump to: