mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-03-22 22:26:18 +00:00
🎨 Misc. SPI cleanup
This commit is contained in:
parent
f7680f3f73
commit
c674f01c01
7 changed files with 18 additions and 24 deletions
|
@ -68,16 +68,15 @@
|
||||||
* Usually the hardware SPI pins are only available to the LCD. This makes the DUE hard SPI used at the same time
|
* Usually the hardware SPI pins are only available to the LCD. This makes the DUE hard SPI used at the same time
|
||||||
* as the TMC2130 soft SPI the most common setup.
|
* as the TMC2130 soft SPI the most common setup.
|
||||||
*/
|
*/
|
||||||
#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))
|
|
||||||
|
|
||||||
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
|
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
|
||||||
#if ENABLED(TMC_USE_SW_SPI)
|
#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))
|
||||||
#if DISABLED(DUE_SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
|
#if DISABLED(DUE_SOFTWARE_SPI) && ENABLED(TMC_USE_SW_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
|
||||||
#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."
|
#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."
|
||||||
#endif
|
#endif
|
||||||
#elif ENABLED(DUE_SOFTWARE_SPI)
|
#if ENABLED(DUE_SOFTWARE_SPI) && DISABLED(TMC_USE_SW_SPI)
|
||||||
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
|
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
|
||||||
#endif
|
#endif
|
||||||
|
#undef _IS_HW_SPI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
|
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
/**
|
/**
|
||||||
* Define SPI Pins: SCK, MISO, MOSI, SS
|
* Define SPI Pins: SCK, MISO, MOSI, SS
|
||||||
*
|
*
|
||||||
* Available chip select pins for HW SPI are 4 10 52 77
|
* Available chip select pins for HW SPI are 4 10 52 77 87
|
||||||
*/
|
*/
|
||||||
#if SDSS == 4 || SDSS == 10 || SDSS == 52 || SDSS == 77 || SDSS == 87
|
#if SDSS == 4 || SDSS == 10 || SDSS == 52 || SDSS == 77 || SDSS == 87
|
||||||
#if SDSS == 4
|
#if SDSS == 4
|
||||||
|
|
|
@ -31,12 +31,6 @@
|
||||||
// spiBeginTransaction.
|
// spiBeginTransaction.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Onboard SD
|
|
||||||
//#define SD_SCK_PIN P0_07
|
|
||||||
//#define SD_MISO_PIN P0_08
|
|
||||||
//#define SD_MOSI_PIN P0_09
|
|
||||||
//#define SD_SS_PIN P0_06
|
|
||||||
|
|
||||||
// External SD
|
// External SD
|
||||||
#ifndef SD_SCK_PIN
|
#ifndef SD_SCK_PIN
|
||||||
#define SD_SCK_PIN 50
|
#define SD_SCK_PIN 50
|
||||||
|
|
|
@ -30,12 +30,13 @@
|
||||||
// spiBeginTransaction.
|
// spiBeginTransaction.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** onboard SD card */
|
// Onboard SD
|
||||||
//#define SD_SCK_PIN P0_07
|
//#define SD_SCK_PIN P0_07
|
||||||
//#define SD_MISO_PIN P0_08
|
//#define SD_MISO_PIN P0_08
|
||||||
//#define SD_MOSI_PIN P0_09
|
//#define SD_MOSI_PIN P0_09
|
||||||
//#define SD_SS_PIN P0_06
|
//#define SD_SS_PIN P0_06
|
||||||
/** external */
|
|
||||||
|
// External SD
|
||||||
#ifndef SD_SCK_PIN
|
#ifndef SD_SCK_PIN
|
||||||
#define SD_SCK_PIN P0_15
|
#define SD_SCK_PIN P0_15
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -78,7 +78,7 @@ uint8_t const SD_CARD_TYPE_SD1 = 1, // Standard capacity V1 SD card
|
||||||
/**
|
/**
|
||||||
* Define SOFTWARE_SPI to use bit-bang SPI
|
* Define SOFTWARE_SPI to use bit-bang SPI
|
||||||
*/
|
*/
|
||||||
#if ANY(MEGA_SOFT_SPI, USE_SOFTWARE_SPI)
|
#if ANY(MEGA_SOFT_SPI, SDFAT_USE_SOFTWARE_SPI)
|
||||||
#define SOFTWARE_SPI
|
#define SOFTWARE_SPI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,8 @@
|
||||||
*/
|
*/
|
||||||
#define MEGA_SOFT_SPI 0
|
#define MEGA_SOFT_SPI 0
|
||||||
|
|
||||||
// Set USE_SOFTWARE_SPI nonzero to ALWAYS use Software SPI.
|
// Set SDFAT_USE_SOFTWARE_SPI nonzero to ALWAYS use Software SPI.
|
||||||
#define USE_SOFTWARE_SPI 0
|
#define SDFAT_USE_SOFTWARE_SPI 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The __cxa_pure_virtual function is an error handler that is invoked when
|
* The __cxa_pure_virtual function is an error handler that is invoked when
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
/**
|
/**
|
||||||
* Define SOFTWARE_SPI to use bit-bang SPI
|
* Define SOFTWARE_SPI to use bit-bang SPI
|
||||||
*/
|
*/
|
||||||
#if ANY(MEGA_SOFT_SPI, USE_SOFTWARE_SPI)
|
#if ANY(MEGA_SOFT_SPI, SDFAT_USE_SOFTWARE_SPI)
|
||||||
#define SOFTWARE_SPI
|
#define SOFTWARE_SPI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue