|
@@ -25,13 +25,28 @@
|
25
|
25
|
*/
|
26
|
26
|
|
27
|
27
|
/**
|
28
|
|
- * Require gcc 4.7 or newer (first included with Arduino 1.6.8) for C++11 features.
|
|
28
|
+ * HARDWARE VS. SOFTWARE SPI COMPATIBILITY
|
|
29
|
+ *
|
|
30
|
+ * DUE selects hardware vs. software SPI depending on whether one of the hardware-controllable SDSS pins is in use.
|
|
31
|
+ *
|
|
32
|
+ * The hardware SPI controller doesn't allow software SPIs to control any shared pins.
|
|
33
|
+ *
|
|
34
|
+ * When DUE software SPI is used then Trinamic drivers must use the TMC softSPI.
|
|
35
|
+ *
|
|
36
|
+ * When DUE hardware SPI is used then a Trinamic driver can use either its hardware SPI or, if there are no shared
|
|
37
|
+ * pins, its software SPI.
|
|
38
|
+ *
|
|
39
|
+ * Usually the hardware SPI pins are only available to the LCD. This makes the DUE hard SPI used at the same time
|
|
40
|
+ * as the TMC2130 soft SPI the most common setup.
|
29
|
41
|
*/
|
|
42
|
+#define _IS_HW_SPI(P) (defined(P) && (P == MOSI_PIN || P == MISO_PIN || P == SCK_PIN))
|
30
|
43
|
|
31
|
44
|
#if ENABLED(SDSUPPORT) && ENABLED(HAVE_TMC2130)
|
32
|
|
- #if ENABLED(DUE_SOFTWARE_SPI) && !ENABLED(TMC_USE_SW_SPI)
|
33
|
|
- #error "DUE software SPI is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
|
34
|
|
- #elif !ENABLED(DUE_SOFTWARE_SPI) && ENABLED(TMC_USE_SW_SPI)
|
35
|
|
- #error "DUE hardware SPI is incompatible with TMC2130 software SPI. Disable TMC_USE_SW_SPI to fix."
|
|
45
|
+ #if ENABLED(TMC_USE_SW_SPI)
|
|
46
|
+ #if DISABLED(DUE_SOFTWARE_SPI) && (_IS_HW_SPI(TMC_SW_MOSI) || _IS_HW_SPI(TMC_SW_MISO) || _IS_HW_SPI(TMC_SW_SCK))
|
|
47
|
+ #error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs."
|
|
48
|
+ #endif
|
|
49
|
+ #elif ENABLED(DUE_SOFTWARE_SPI)
|
|
50
|
+ #error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
|
36
|
51
|
#endif
|
37
|
52
|
#endif
|