Skip to content

Commit c674f01

Browse files
committed
🎨 Misc. SPI cleanup
1 parent f7680f3 commit c674f01

File tree

7 files changed

+18
-24
lines changed

7 files changed

+18
-24
lines changed

Marlin/src/HAL/DUE/inc/SanityCheck.h

+6-7
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,15 @@
6868
* Usually the hardware SPI pins are only available to the LCD. This makes the DUE hard SPI used at the same time
6969
* as the TMC2130 soft SPI the most common setup.
7070
*/
71-
#define _IS_HW_SPI(P) (defined(TMC_SPI_##P) && (TMC_SPI_##P == SD_MOSI_PIN || TMC_SPI_##P == SD_MISO_PIN || TMC_SPI_##P == SD_SCK_PIN))
72-
7371
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
74-
#if ENABLED(TMC_USE_SW_SPI)
75-
#if DISABLED(DUE_SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
76-
#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."
77-
#endif
78-
#elif ENABLED(DUE_SOFTWARE_SPI)
72+
#define _IS_HW_SPI(P) (defined(TMC_SPI_##P) && (TMC_SPI_##P == SD_MOSI_PIN || TMC_SPI_##P == SD_MISO_PIN || TMC_SPI_##P == SD_SCK_PIN))
73+
#if DISABLED(DUE_SOFTWARE_SPI) && ENABLED(TMC_USE_SW_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
74+
#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."
75+
#endif
76+
#if ENABLED(DUE_SOFTWARE_SPI) && DISABLED(TMC_USE_SW_SPI)
7977
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
8078
#endif
79+
#undef _IS_HW_SPI
8180
#endif
8281

8382
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY

Marlin/src/HAL/DUE/spi_pins.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/**
2525
* Define SPI Pins: SCK, MISO, MOSI, SS
2626
*
27-
* Available chip select pins for HW SPI are 4 10 52 77
27+
* Available chip select pins for HW SPI are 4 10 52 77 87
2828
*/
2929
#if SDSS == 4 || SDSS == 10 || SDSS == 52 || SDSS == 77 || SDSS == 87
3030
#if SDSS == 4

Marlin/src/HAL/LINUX/spi_pins.h

-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@
3131
// spiBeginTransaction.
3232
#endif
3333

34-
// Onboard SD
35-
//#define SD_SCK_PIN P0_07
36-
//#define SD_MISO_PIN P0_08
37-
//#define SD_MOSI_PIN P0_09
38-
//#define SD_SS_PIN P0_06
39-
4034
// External SD
4135
#ifndef SD_SCK_PIN
4236
#define SD_SCK_PIN 50

Marlin/src/HAL/LPC1768/spi_pins.h

+7-6
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
// spiBeginTransaction.
3131
#endif
3232

33-
/** onboard SD card */
34-
//#define SD_SCK_PIN P0_07
35-
//#define SD_MISO_PIN P0_08
36-
//#define SD_MOSI_PIN P0_09
37-
//#define SD_SS_PIN P0_06
38-
/** external */
33+
// Onboard SD
34+
//#define SD_SCK_PIN P0_07
35+
//#define SD_MISO_PIN P0_08
36+
//#define SD_MOSI_PIN P0_09
37+
//#define SD_SS_PIN P0_06
38+
39+
// External SD
3940
#ifndef SD_SCK_PIN
4041
#define SD_SCK_PIN P0_15
4142
#endif

Marlin/src/sd/Sd2Card.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ uint8_t const SD_CARD_TYPE_SD1 = 1, // Standard capacity V1 SD card
7878
/**
7979
* Define SOFTWARE_SPI to use bit-bang SPI
8080
*/
81-
#if ANY(MEGA_SOFT_SPI, USE_SOFTWARE_SPI)
81+
#if ANY(MEGA_SOFT_SPI, SDFAT_USE_SOFTWARE_SPI)
8282
#define SOFTWARE_SPI
8383
#endif
8484

Marlin/src/sd/SdFatConfig.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@
8888
*/
8989
#define MEGA_SOFT_SPI 0
9090

91-
// Set USE_SOFTWARE_SPI nonzero to ALWAYS use Software SPI.
92-
#define USE_SOFTWARE_SPI 0
91+
// Set SDFAT_USE_SOFTWARE_SPI nonzero to ALWAYS use Software SPI.
92+
#define SDFAT_USE_SOFTWARE_SPI 0
9393

9494
/**
9595
* The __cxa_pure_virtual function is an error handler that is invoked when

Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/**
3434
* Define SOFTWARE_SPI to use bit-bang SPI
3535
*/
36-
#if ANY(MEGA_SOFT_SPI, USE_SOFTWARE_SPI)
36+
#if ANY(MEGA_SOFT_SPI, SDFAT_USE_SOFTWARE_SPI)
3737
#define SOFTWARE_SPI
3838
#endif
3939

0 commit comments

Comments
 (0)