|
17 | 17 | * along with the Arduino Sd2Card Library. If not, see
|
18 | 18 | * <http://www.gnu.org/licenses/>.
|
19 | 19 | */
|
20 |
| -#define USE_SPI_LIB |
| 20 | + |
21 | 21 | #include <Arduino.h>
|
22 | 22 | #include "Sd2Card.h"
|
23 | 23 | //------------------------------------------------------------------------------
|
@@ -267,26 +267,23 @@ int Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
|
267 | 267 | // set pin modes
|
268 | 268 | pinMode(chipSelectPin_, OUTPUT);
|
269 | 269 | chipSelectHigh();
|
270 |
| -<<<<<<< HEAD |
271 |
| - |
272 |
| -#ifdef AVR |
273 |
| -======= |
274 | 270 | #ifndef USE_SPI_LIB
|
275 |
| ->>>>>>> 1.5.1 |
276 | 271 | pinMode(SPI_MISO_PIN, INPUT);
|
277 | 272 | pinMode(SPI_MOSI_PIN, OUTPUT);
|
278 | 273 | pinMode(SPI_SCK_PIN, OUTPUT);
|
279 | 274 | #endif
|
280 | 275 |
|
281 | 276 | #ifndef SOFTWARE_SPI
|
282 | 277 | #ifndef USE_SPI_LIB
|
| 278 | +#ifndef ZPU |
283 | 279 | // SS must be in output mode even it is not chip select
|
284 | 280 | pinMode(SS_PIN, OUTPUT);
|
285 | 281 | digitalWrite(SS_PIN, HIGH); // disable any SPI device using hardware SS pin
|
286 | 282 | // Enable SPI, Master, clock rate f_osc/128
|
287 | 283 | SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0);
|
288 | 284 | // clear double speed
|
289 | 285 | SPSR &= ~(1 << SPI2X);
|
| 286 | +#endif // defined ZPU |
290 | 287 | #else // USE_SPI_LIB
|
291 | 288 | SPI.begin();
|
292 | 289 | #ifdef SPI_CLOCK_DIV128
|
@@ -553,7 +550,7 @@ int Sd2Card::readRegister(unsigned cmd, void* buf) {
|
553 | 550 | * false, is returned for an invalid value of \a sckRateID.
|
554 | 551 | */
|
555 | 552 | uint8_t Sd2Card::setSckRate(uint8_t sckRateID) {
|
556 |
| -#ifdef AVR |
| 553 | +#ifndef ZPU |
557 | 554 | if (sckRateID > 6) {
|
558 | 555 | error(SD_CARD_ERROR_SCK_RATE);
|
559 | 556 | return false;
|
@@ -585,6 +582,7 @@ uint8_t Sd2Card::setSckRate(uint8_t sckRateID) {
|
585 | 582 | #endif // SPI_CLOCK_DIV128
|
586 | 583 | SPI.setClockDivider(v);
|
587 | 584 | #endif // USE_SPI_LIB
|
| 585 | +#endif // defined ZPU |
588 | 586 | return true;
|
589 | 587 | }
|
590 | 588 | //------------------------------------------------------------------------------
|
|
0 commit comments