Skip to content

Commit

Permalink
Added SparkFun workaround for SdFat library
Browse files Browse the repository at this point in the history
  • Loading branch information
salvestrini committed Dec 8, 2010
1 parent f3d6dfe commit deb0601
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/SdFat/Sd2Card.cpp
Expand Up @@ -218,6 +218,9 @@ uint8_t Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
uint32_t arg;

// set pin modes
#if SPARKFUN_MICROSD_SHIELD_WORKAROUND
pinMode(10, OUTPUT);
#endif
pinMode(chipSelectPin_, OUTPUT);
chipSelectHigh();
pinMode(SPI_MISO_PIN, INPUT);
Expand Down
7 changes: 7 additions & 0 deletions src/SdFat/Sd2Card.h
Expand Up @@ -56,8 +56,15 @@ uint8_t const SPI_QUARTER_SPEED = 2;
* as an output by init(). An avr processor will not function as an SPI
* master unless SS is set to output mode.
*/

#define SPARKFUN_MICROSD_SHIELD_WORKAROUND 1

/** The default chip select pin for the SD card is SS. */
#if SPARKFUN_MICROSD_SHIELD_WORKAROUND
uint8_t const SD_CHIP_SELECT_PIN = 8;
#else
uint8_t const SD_CHIP_SELECT_PIN = SS_PIN;
#endif
// The following three pins must not be redefined for hardware SPI.
/** SPI Master Out Slave In pin */
uint8_t const SPI_MOSI_PIN = MOSI_PIN;
Expand Down

0 comments on commit deb0601

Please sign in to comment.