From ce5dece3b57ad2fe36347530a6de79a3848736f4 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Sun, 6 Jun 2021 02:59:19 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9A=B0=EF=B8=8F=20Remove=20obsolete=20CUSTOM?= =?UTF-8?q?=5FSPI=5FPINS=20(#22058)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/STM32/HAL_SPI.cpp | 8 ++-- Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h | 3 ++ .../stm32f1/pins_BTT_SKR_MINI_E3_common.h | 13 ++--- .../pins/stm32f1/pins_MKS_ROBIN_E3_common.h | 1 - .../src/pins/stm32f4/pins_BTT_BTT002_V1_0.h | 11 ++--- Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h | 2 - .../pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h | 1 - .../pins/stm32f4/pins_BTT_SKR_V2_0_common.h | 1 - .../src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h | 34 ++++++-------- .../src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h | 47 ++++++++----------- 10 files changed, 49 insertions(+), 72 deletions(-) diff --git a/Marlin/src/HAL/STM32/HAL_SPI.cpp b/Marlin/src/HAL/STM32/HAL_SPI.cpp index 80347e115d..bd36562de9 100644 --- a/Marlin/src/HAL/STM32/HAL_SPI.cpp +++ b/Marlin/src/HAL/STM32/HAL_SPI.cpp @@ -163,11 +163,9 @@ static SPISettings spiConfig; } spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0); - #if ENABLED(CUSTOM_SPI_PINS) - SPI.setMISO(SD_MISO_PIN); - SPI.setMOSI(SD_MOSI_PIN); - SPI.setSCLK(SD_SCK_PIN); - #endif + SPI.setMISO(SD_MISO_PIN); + SPI.setMOSI(SD_MOSI_PIN); + SPI.setSCLK(SD_SCK_PIN); SPI.begin(); } diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h index 35224ebdd0..27aa84e44f 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h @@ -276,6 +276,9 @@ #if SD_CONNECTION_IS(ONBOARD) #define SD_DETECT_PIN PC4 + #define SD_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PA7 #elif SD_CONNECTION_IS(LCD) && BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) #define SD_DETECT_PIN PA15 #define SD_SS_PIN PA10 diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h index bb356485cb..5850f11ef0 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h @@ -280,11 +280,8 @@ #define ONBOARD_SPI_DEVICE 1 // SPI1 -> used only by HAL/STM32F1... #define ONBOARD_SD_CS_PIN PA4 // Chip select for "System" SD card -#define CUSTOM_SPI_PINS // TODO: needed because is the only way to set SPI for SD on STM32 (for now) -#if ENABLED(CUSTOM_SPI_PINS) - #define ENABLE_SPI1 - #define SDSS ONBOARD_SD_CS_PIN - #define SD_SCK_PIN PA5 - #define SD_MISO_PIN PA6 - #define SD_MOSI_PIN PA7 -#endif +#define ENABLE_SPI1 +#define SDSS ONBOARD_SD_CS_PIN +#define SD_SCK_PIN PA5 +#define SD_MISO_PIN PA6 +#define SD_MOSI_PIN PA7 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h index 6369fcd31b..b482065666 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h @@ -186,7 +186,6 @@ // TODO: This is the only way to set SPI for SD on STM32 (for now) #define ENABLE_SPI2 -#define CUSTOM_SPI_PINS #define SD_SCK_PIN PB13 #define SD_MISO_PIN PB14 #define SD_MOSI_PIN PB15 diff --git a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h index 9fb13c84fe..408048bfe2 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h @@ -205,13 +205,10 @@ #define EXP2_10_PIN PA6 // HAL SPI1 pins -#define CUSTOM_SPI_PINS -#if ENABLED(CUSTOM_SPI_PINS) - #define SD_SCK_PIN EXP2_09_PIN // SPI1 SCLK - #define SD_SS_PIN EXP2_07_PIN // SPI1 SSEL - #define SD_MISO_PIN EXP2_10_PIN // SPI1 MISO - #define SD_MOSI_PIN EXP2_05_PIN // SPI1 MOSI -#endif +#define SD_SCK_PIN EXP2_09_PIN // SPI1 SCLK +#define SD_SS_PIN EXP2_07_PIN // SPI1 SSEL +#define SD_MISO_PIN EXP2_10_PIN // SPI1 MISO +#define SD_MOSI_PIN EXP2_05_PIN // SPI1 MOSI #define SDSS EXP2_07_PIN diff --git a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h index 8f19b1915d..850b23db66 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h @@ -357,8 +357,6 @@ #elif SD_CONNECTION_IS(ONBOARD) - // Instruct the STM32 HAL to override the default SPI pins from the variant.h file - #define CUSTOM_SPI_PINS #define SDSS PA4 #define SD_SS_PIN SDSS #define SD_SCK_PIN PA5 diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h index cce21fbe8f..2cf1ee1447 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -356,7 +356,6 @@ #define SD_DETECT_PIN PC14 #elif SD_CONNECTION_IS(LCD) - #define CUSTOM_SPI_PINS #define SDSS PA4 #define SD_SS_PIN SDSS #define SD_SCK_PIN PA5 diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h index c46e0f03f0..d465bb23c7 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h @@ -348,7 +348,6 @@ #elif SD_CONNECTION_IS(LCD) - #define CUSTOM_SPI_PINS #define SDSS PA4 #define SD_SS_PIN SDSS #define SD_SCK_PIN PA5 diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h index 726e9a6586..1146582a5b 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h @@ -217,37 +217,31 @@ // // detect pin dont work when ONBOARD and NO_SD_HOST_DRIVE disabled #if SD_CONNECTION_IS(ONBOARD) - #define CUSTOM_SPI_PINS // TODO: needed because is the only way to set SPI3 for SD on STM32 (by now) - #if ENABLED(CUSTOM_SPI_PINS) - #define ENABLE_SPI3 - #define SD_SS_PIN -1 - #define SDSS PC9 - #define SD_SCK_PIN PC10 - #define SD_MISO_PIN PC11 - #define SD_MOSI_PIN PC12 - #define SD_DETECT_PIN PD12 - #endif + #define ENABLE_SPI3 + #define SD_SS_PIN -1 + #define SDSS PC9 + #define SD_SCK_PIN PC10 + #define SD_MISO_PIN PC11 + #define SD_MOSI_PIN PC12 + #define SD_DETECT_PIN PD12 #endif // // LCD SD // #if SD_CONNECTION_IS(LCD) - #define CUSTOM_SPI_PINS - #if ENABLED(CUSTOM_SPI_PINS) - #define ENABLE_SPI1 - #define SDSS PE10 - #define SD_SCK_PIN PA5 - #define SD_MISO_PIN PA6 - #define SD_MOSI_PIN PA7 - #define SD_DETECT_PIN PE12 - #endif + #define ENABLE_SPI1 + #define SDSS PE10 + #define SD_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PA7 + #define SD_DETECT_PIN PE12 #endif // // LCD / Controller #define SPI_FLASH -#define HAS_SPI_FLASH 1 +#define HAS_SPI_FLASH 1 #define SPI_DEVICE 2 #define SPI_FLASH_SIZE 0x1000000 #if ENABLED(SPI_FLASH) diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h index 1000326dad..2b0df002d3 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h @@ -31,7 +31,7 @@ #define BOARD_INFO_NAME "MKS Robin PRO V2" // Avoid conflict with TIMER_TONE -#define STEP_TIMER 10 +#define STEP_TIMER 10 // Use one of these or SDCard-based Emulation will be used //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation @@ -50,7 +50,7 @@ // // Note: MKS Robin board is using SPI2 interface. // -//#define SPI_MODULE 2 +//#define SPI_MODULE 2 // // Servos @@ -203,7 +203,7 @@ //#define LED_PIN PB2 #ifndef SDCARD_CONNECTION - #define SDCARD_CONNECTION ONBOARD + #define SDCARD_CONNECTION ONBOARD #endif //#define USE_NEW_SPI_API 1 @@ -214,21 +214,17 @@ // // detect pin dont work when ONBOARD and NO_SD_HOST_DRIVE disabled #if !defined(SDCARD_CONNECTION) || SDCARD_CONNECTION == ONBOARD - #define CUSTOM_SPI_PINS - #if ENABLED(CUSTOM_SPI_PINS) - - #if USE_NEW_SPI_API - #define SD_SPI MARLIN_SPI(HardwareSPI3, PC9) - #else - #define ENABLE_SPI3 - #define SD_SS_PIN -1 - #define SDSS PC9 - #define SD_SCK_PIN PC10 - #define SD_MISO_PIN PC11 - #define SD_MOSI_PIN PC12 - #endif - #define SD_DETECT_PIN PD12 + #if USE_NEW_SPI_API + #define SD_SPI MARLIN_SPI(HardwareSPI3, PC9) + #else + #define ENABLE_SPI3 + #define SD_SS_PIN -1 + #define SDSS PC9 + #define SD_SCK_PIN PC10 + #define SD_MISO_PIN PC11 + #define SD_MOSI_PIN PC12 #endif + #define SD_DETECT_PIN PD12 #endif /* @@ -236,22 +232,19 @@ // LCD SD // #if SDCARD_CONNECTION == LCD - #define CUSTOM_SPI_PINS - #if ENABLED(CUSTOM_SPI_PINS) - #define ENABLE_SPI1 - #define SDSS PE10 - #define SD_SCK_PIN PA5 - #define SD_MISO_PIN PA6 - #define SD_MOSI_PIN PA7 - #define SD_DETECT_PIN PE12 - #endif + #define ENABLE_SPI1 + #define SDSS PE10 + #define SD_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PA7 + #define SD_DETECT_PIN PE12 #endif */ // // LCD / Controller #define SPI_FLASH -#define HAS_SPI_FLASH 1 +#define HAS_SPI_FLASH 1 #define SPI_DEVICE 2 #define SPI_FLASH_SIZE 0x1000000 #if ENABLED(SPI_FLASH)