|
@@ -532,7 +532,7 @@
|
532
|
532
|
(void) spiTransferTx(token);
|
533
|
533
|
spiTxBlock(buf,512);
|
534
|
534
|
WRITE(SS_PIN, HIGH);
|
535
|
|
-
|
|
535
|
+
|
536
|
536
|
#else // let calling routine control SDSS
|
537
|
537
|
void spiBegin() {
|
538
|
538
|
SET_OUTPUT(SS_PIN);
|
|
@@ -564,7 +564,7 @@
|
564
|
564
|
spiTxBlock(buf,512);
|
565
|
565
|
|
566
|
566
|
#endif
|
567
|
|
-
|
|
567
|
+
|
568
|
568
|
}
|
569
|
569
|
|
570
|
570
|
/**
|
|
@@ -602,7 +602,7 @@
|
602
|
602
|
|
603
|
603
|
#if MB(ALLIGATOR)
|
604
|
604
|
WRITE(SS_PIN, HIGH);
|
605
|
|
- #endif
|
|
605
|
+ #endif
|
606
|
606
|
WRITE(MOSI_PIN, HIGH);
|
607
|
607
|
WRITE(SCK_PIN, LOW);
|
608
|
608
|
}
|
|
@@ -616,11 +616,11 @@
|
616
|
616
|
|
617
|
617
|
#else
|
618
|
618
|
|
619
|
|
- #if MB(ALLIGATOR)
|
620
|
|
-
|
|
619
|
+ #if MB(ALLIGATOR)
|
|
620
|
+
|
621
|
621
|
// slave selects controlled by SPI controller
|
622
|
622
|
// doesn't support changing SPI speeds for SD card
|
623
|
|
-
|
|
623
|
+
|
624
|
624
|
// --------------------------------------------------------------------------
|
625
|
625
|
// hardware SPI
|
626
|
626
|
// --------------------------------------------------------------------------
|
|
@@ -666,15 +666,15 @@
|
666
|
666
|
WRITE(SPI_FLASH_CS, HIGH );
|
667
|
667
|
WRITE(SS_PIN, HIGH );
|
668
|
668
|
#endif // MB(ALLIGATOR)
|
669
|
|
-
|
|
669
|
+
|
670
|
670
|
OUT_WRITE(SDSS,0);
|
671
|
|
-
|
|
671
|
+
|
672
|
672
|
PIO_Configure(
|
673
|
673
|
g_APinDescription[SPI_PIN].pPort,
|
674
|
674
|
g_APinDescription[SPI_PIN].ulPinType,
|
675
|
675
|
g_APinDescription[SPI_PIN].ulPin,
|
676
|
676
|
g_APinDescription[SPI_PIN].ulPinConfiguration);
|
677
|
|
-
|
|
677
|
+
|
678
|
678
|
spiInit(1);
|
679
|
679
|
spiInitMaded = true;
|
680
|
680
|
}
|
|
@@ -824,7 +824,7 @@
|
824
|
824
|
}
|
825
|
825
|
|
826
|
826
|
#else // U8G compatible hardware SPI
|
827
|
|
-
|
|
827
|
+
|
828
|
828
|
void spiInit(uint8_t spiRate = 6 ) { // default to slowest rate if not specified)
|
829
|
829
|
// 8.4 MHz, 4 MHz, 2 MHz, 1 MHz, 0.5 MHz, 0.329 MHz, 0.329 MHz
|
830
|
830
|
int spiDueDividors[] = { 10, 21, 42, 84, 168, 255, 255 };
|
|
@@ -849,7 +849,7 @@
|
849
|
849
|
|
850
|
850
|
/* SPI mode 0, 8 Bit data transfer, baud rate */
|
851
|
851
|
SPI0->SPI_CSR[0] = SPI_CSR_SCBR(spiDueDividors[spiRate]) | 1;
|
852
|
|
- }
|
|
852
|
+ }
|
853
|
853
|
|
854
|
854
|
static uint8_t spiTransfer(uint8_t data) {
|
855
|
855
|
|
|
@@ -897,8 +897,8 @@
|
897
|
897
|
spiTransfer(token);
|
898
|
898
|
for (uint16_t i = 0; i < 512; i++)
|
899
|
899
|
spiTransfer(buf[i]);
|
900
|
|
- }
|
901
|
|
-
|
|
900
|
+ }
|
|
901
|
+
|
902
|
902
|
#endif //MB(ALLIGATOR)
|
903
|
903
|
#endif // ENABLED(SOFTWARE_SPI)
|
904
|
904
|
|