Go Down

Topic: What/where is card.init() which is used in the SD card library? (Read 1 time) previous topic - next topic


Hi all

I've been using the adafruit SD card library. Recently I've needed to modify parts of the .cpp file but I'm first trying to figure out what exactly is going on.

In the begin function (SDClass::begin) it calls to card.init() with arguments of SPI_HALF_SPEED, csPin, mosi, miso, sck. Where is this init function being stored? I can't seem to figure it out since the .cpp file only has an include to the header and doesn't include any other files.

Also in the same line, volume.init(card). Where is that? I'm trying to figure out exactly what happens because of some errors with another SPI device which only occurs when the SD card is plugged in too. They're both in the same SPI mode so there shouldn't be any issues there. The error in the results occur when the sd.begin() is called from the sketch.



In SD.h is the declaration (instantiation) of card
Code: [Select]
  Sd2Card card;
In /utility/Sd2Card.cpp is the init function.
Code: [Select]
uint8_t Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {


Thanks Tim, that's pretty much what I was looking for this whole time.

Go Up