1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

fix SPI clock for SD library

This commit is contained in:
ficeto
2015-05-08 11:44:45 +03:00
parent 7be94cb51e
commit b15808e60f
2 changed files with 3 additions and 7 deletions

View File

@ -270,11 +270,7 @@ uint8_t Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
SPSR &= ~(1 << SPI2X); SPSR &= ~(1 << SPI2X);
#else // USE_SPI_LIB #else // USE_SPI_LIB
SPI.begin(); SPI.begin();
#ifdef ESP8266
settings = SPISettings(SPI_CLOCK_DIV64, MSBFIRST, SPI_MODE0);
#else
settings = SPISettings(250000, MSBFIRST, SPI_MODE0); settings = SPISettings(250000, MSBFIRST, SPI_MODE0);
#endif
#endif // USE_SPI_LIB #endif // USE_SPI_LIB
#endif // SOFTWARE_SPI #endif // SOFTWARE_SPI

View File

@ -28,9 +28,9 @@
#ifdef ESP8266 #ifdef ESP8266
#include "SPI.h" #include "SPI.h"
uint32_t const SPI_FULL_SPEED = SPI_CLOCK_DIV2; uint32_t const SPI_FULL_SPEED = 4000000;
uint32_t const SPI_HALF_SPEED = SPI_CLOCK_DIV4; uint32_t const SPI_HALF_SPEED = 2000000;
uint32_t const SPI_QUARTER_SPEED = SPI_CLOCK_DIV8; uint32_t const SPI_QUARTER_SPEED = 1000000;
#else #else
/** Set SCK to max rate of F_CPU/2. See Sd2Card::setSckRate(). */ /** Set SCK to max rate of F_CPU/2. See Sd2Card::setSckRate(). */
uint8_t const SPI_FULL_SPEED = 0; uint8_t const SPI_FULL_SPEED = 0;