Skip to content

Fix: Somehow Software SPI mode for Mega Arduinos was broken #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/SD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,9 @@ boolean SDClass::begin(uint32_t clock, uint8_t csPin) {
if(root.isOpen()) root.close();

return card.init(SPI_HALF_SPEED, csPin) &&
#ifdef USE_SPI_LIB
card.setSpiClock(clock) &&
#endif
volume.init(card) &&
root.openRoot(volume);
}
Expand Down
1 change: 0 additions & 1 deletion src/utility/Sd2Card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* along with the Arduino Sd2Card Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#define USE_SPI_LIB
#include <Arduino.h>
#include "Sd2Card.h"
//------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/utility/Sd2Card.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ uint8_t const SPI_QUARTER_SPEED = 2;
//------------------------------------------------------------------------------
#if MEGA_SOFT_SPI && (defined(__AVR_ATmega1280__)||defined(__AVR_ATmega2560__))
#define SOFTWARE_SPI
#undef USE_SPI_LIB
#endif // MEGA_SOFT_SPI
//------------------------------------------------------------------------------
// SPI pin definitions
Expand Down