Skip to content

Commit

Permalink
♻️ SDSS => SD_SS_PIN
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jan 23, 2025
1 parent 253132c commit 3a95525
Show file tree
Hide file tree
Showing 187 changed files with 213 additions and 282 deletions.
4 changes: 2 additions & 2 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@
*
* SCLK, MOSI, MISO --> SCLK, MOSI, MISO
* INT --> SD_DETECT_PIN [1]
* SS --> SDSS
* SS --> SD_SS_PIN
*
* [1] On AVR an interrupt-capable pin is best for UHS3 compatibility.
*/
Expand All @@ -1896,7 +1896,7 @@
//#define USE_OTG_USB_HOST

#if DISABLED(USE_OTG_USB_HOST)
#define USB_CS_PIN SDSS
#define USB_CS_PIN SD_SS_PIN
#define USB_INTR_PIN SD_DETECT_PIN
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/DUE/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ uint16_t MarlinHAL::adc_result;

void MarlinHAL::init() {
#if HAS_MEDIA
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
OUT_WRITE(SD_SS_PIN, HIGH); // Try to set SDSS inactive before any other SPI users start up
#endif
usb_task_init(); // Initialize the USB stack
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler
Expand Down
7 changes: 3 additions & 4 deletions Marlin/src/HAL/DUE/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,8 @@
OUT_WRITE(SPI_EEPROM1_CS_PIN, HIGH);
OUT_WRITE(SPI_EEPROM2_CS_PIN, HIGH);
OUT_WRITE(SPI_FLASH_CS_PIN, HIGH);
WRITE(SD_SS_PIN, HIGH);

OUT_WRITE(SDSS, LOW);
OUT_WRITE(SD_SS_PIN, HIGH);
WRITE(SD_SS_PIN, LOW);

PIO_Configure(
g_APinDescription[SPI_PIN].pPort,
Expand Down Expand Up @@ -767,7 +766,7 @@

// Disable PIO on A26 and A27
REG_PIOA_PDR = 0x0C000000;
OUT_WRITE(SDSS, HIGH);
OUT_WRITE(SD_SS_PIN, HIGH);

// Reset SPI0 (from sam lib)
SPI0->SPI_CR = SPI_CR_SPIDIS;
Expand Down
3 changes: 0 additions & 3 deletions Marlin/src/HAL/DUE/spi_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,3 @@
#define SD_MOSI_PIN 51
#endif
#endif

/* A.28, A.29, B.21, C.26, C.29 */
#define SD_SS_PIN SDSS
2 changes: 1 addition & 1 deletion Marlin/src/HAL/ESP32/spi_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
#pragma once

#define PIN_SPI_SS SDSS
#define PIN_SPI_SS -1
#define PIN_SPI_SCK 18
#define PIN_SPI_MISO 19
#define PIN_SPI_MOSI 23
Expand Down
3 changes: 0 additions & 3 deletions Marlin/src/HAL/LINUX/spi_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,3 @@
#ifndef SD_SS_PIN
#define SD_SS_PIN 53
#endif
#ifndef SDSS
#define SDSS SD_SS_PIN
#endif
4 changes: 0 additions & 4 deletions Marlin/src/HAL/LPC1768/spi_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,3 @@
#ifndef SD_SS_PIN
#define SD_SS_PIN P1_23
#endif
#if !defined(SDSS) || SDSS == P_NC // gets defaulted in pins.h
#undef SDSS
#define SDSS SD_SS_PIN
#endif
3 changes: 0 additions & 3 deletions Marlin/src/HAL/NATIVE_SIM/spi_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,3 @@
#ifndef SD_SS_PIN
#define SD_SS_PIN 53
#endif
#ifndef SDSS
#define SDSS SD_SS_PIN
#endif
7 changes: 2 additions & 5 deletions Marlin/src/HAL/RP2040/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ void MarlinHAL::init() {
constexpr int cpuFreq = F_CPU;
UNUSED(cpuFreq);

#undef SDSS
#define SDSS 2
#define PIN_EXISTS_(P1,P2) (defined(P1##P2) && P1##P2 >= 0)
#if HAS_MEDIA && DISABLED(SDIO_SUPPORT) && PIN_EXISTS_(SDSS,)
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
#if HAS_MEDIA && DISABLED(SDIO_SUPPORT) && PIN_EXISTS(SD_SS)
OUT_WRITE(SD_SS_PIN, HIGH); // Try to set SD_SS_PIN inactive before any other SPI users start up
#endif

#if PIN_EXISTS(LED)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/SAMD21/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void MarlinHAL::init() {
#if HAS_SD_DETECT && SD_CONNECTION_IS(ONBOARD)
SET_INPUT_PULLUP(SD_DETECT_PIN);
#endif
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
OUT_WRITE(SD_SS_PIN, HIGH); // Try to set SDSS inactive before any other SPI users start up
#endif
}

Expand Down
6 changes: 1 addition & 5 deletions Marlin/src/HAL/SAMD21/spi_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
#ifndef SD_MOSI_PIN
#define SD_MOSI_PIN 37
#endif
#ifndef SDSS
#define SDSS 18
#endif

#ifndef SD_SS_PIN
#define SD_SS_PIN SDSS
#define SD_SS_PIN 18
#endif
2 changes: 1 addition & 1 deletion Marlin/src/HAL/SAMD51/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ void MarlinHAL::init() {
#if HAS_SD_DETECT && SD_CONNECTION_IS(ONBOARD)
SET_INPUT_PULLUP(SD_DETECT_PIN);
#endif
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
OUT_WRITE(SD_SS_PIN, HIGH); // Try to set SDSS inactive before any other SPI users start up
#endif
}

Expand Down
6 changes: 2 additions & 4 deletions Marlin/src/HAL/SAMD51/spi_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@
#ifndef SD_MOSI_PIN
#define SD_MOSI_PIN 51
#endif
#ifndef SDSS
#define SDSS 53
#ifndef SD_SS_PIN
#define SD_SS_PIN 53
#endif

#else

#error "Unsupported board!"

#endif

#define SD_SS_PIN SDSS
4 changes: 2 additions & 2 deletions Marlin/src/HAL/STM32/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ void MarlinHAL::init() {
constexpr int cpuFreq = F_CPU;
UNUSED(cpuFreq);

#if HAS_MEDIA && DISABLED(ONBOARD_SDIO) && (defined(SDSS) && SDSS != -1)
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
#if HAS_MEDIA && DISABLED(ONBOARD_SDIO) && PIN_EXISTS(SD_SS)
OUT_WRITE(SD_SS_PIN, HIGH); // Try to set SDSS inactive before any other SPI users start up
#endif

#if PIN_EXISTS(LED)
Expand Down
2 changes: 0 additions & 2 deletions Marlin/src/HAL/STM32F1/spi_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
#ifndef SD_SS_PIN
#define SD_SS_PIN PA4
#endif
#undef SDSS
#define SDSS SD_SS_PIN

#ifndef SPI_DEVICE
#define SPI_DEVICE 1
Expand Down
10 changes: 10 additions & 0 deletions Marlin/src/inc/Changes.h
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,18 @@
#error "MMU2_DEBUG is now MMU_DEBUG."
#elif defined(FTM_SHAPING_DEFAULT_X_FREQ) || defined(FTM_SHAPING_DEFAULT_Y_FREQ)
#error "FTM_SHAPING_DEFAULT_[XY]_FREQ is now FTM_SHAPING_DEFAULT_FREQ_[XY]."
#elif defined(SDSS)
#error "SDSS is now SD_SS_PIN."
#endif

// SDSS renamed to SD_SS_PIN
#undef SDSS
#define SDSS 8675309
#if USB_CS_PIN == SDSS
#error "SDSS is now SD_SS_PIN."
#endif
#undef SDSS

// Changes to Probe Temp Compensation (#17392)
#if HAS_PTC && TEMP_SENSOR_PROBE && TEMP_SENSOR_BED
#if defined(PTC_PARK_POS_X) || defined(PTC_PARK_POS_Y) || defined(PTC_PARK_POS_Z)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/ftdi_eve_touch_ui/pin_mappings.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
#define CLCD_SPI_CS BTN_EN1
#define CLCD_MOD_RESET BTN_EN2
#if MB(EINSY_RAMBO, EINSY_RETRO) && !HAS_MEDIA
#define CLCD_SPI_EXTRA_CS SDSS
#define CLCD_SPI_EXTRA_CS SD_SS_PIN
#endif

#endif
2 changes: 1 addition & 1 deletion Marlin/src/pins/esp32/pins_E4D.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@
#define SD_MOSI_PIN 23
#define SD_MISO_PIN 19
#define SD_SCK_PIN 18
#define SDSS 5
#define SD_SS_PIN 5
#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers
2 changes: 1 addition & 1 deletion Marlin/src/pins/esp32/pins_ESP32.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@
#define HEATER_BED_PIN 4

// SPI
#define SDSS 5
#define SD_SS_PIN 5
2 changes: 1 addition & 1 deletion Marlin/src/pins/esp32/pins_ESPA_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@
#define SD_MOSI_PIN 23
#define SD_MISO_PIN 19
#define SD_SCK_PIN 18
#define SDSS 5
#define SD_SS_PIN 5
#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers
2 changes: 1 addition & 1 deletion Marlin/src/pins/esp32/pins_GODI_CONTROLLER_V1_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
#define SD_MOSI_PIN 23
#define SD_MISO_PIN 19
#define SD_SCK_PIN 18
#define SDSS 5
#define SD_SS_PIN 5
#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers

#if HAS_TMC_UART
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/esp32/pins_MKS_TINYBEE.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
//#define SD_SCK_PIN EXP2_02_PIN // uses esp32 default 18

// TODO: Migrate external SD Card to pins/lcd
#define SDSS EXP2_04_PIN
#define SD_SS_PIN EXP2_04_PIN
#define SD_DETECT_PIN EXP2_07_PIN // IO34 default is SD_DET signal (Jump to SDDET)
#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/esp32/pins_MM_JOKER.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
#define SD_MOSI_PIN 23
#define SD_MISO_PIN 19
#define SD_SCK_PIN 18
#define SDSS 5
#define SD_SS_PIN 5
#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers

//
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/esp32/pins_MRR_ESPE.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
#define SD_MOSI_PIN 23
#define SD_MISO_PIN 19
#define SD_SCK_PIN 18
#define SDSS 5
#define SD_SS_PIN 5
#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers

//
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/esp32/pins_PANDA_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
#define SD_MOSI_PIN EXP2_06_PIN
#define SD_MISO_PIN EXP2_01_PIN
#define SD_SCK_PIN EXP2_02_PIN
#define SDSS EXP2_04_PIN
#define SD_SS_PIN EXP2_04_PIN
#define SD_DETECT_PIN EXP2_07_PIN
#endif

Expand Down
4 changes: 1 addition & 3 deletions Marlin/src/pins/gd32f1/pins_TRIGORILLA_V006.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
// SPI
//
#define SPI_DEVICE -1 // Maple
#define SDSS -1
#define SD_SS_PIN -1
#define SD_SCK_PIN -1
#define SD_MISO_PIN -1
Expand All @@ -142,8 +141,7 @@

#else

#define SDSS PC11 // SDIO_D3_PIN
#define SD_SS_PIN SDSS
#define SD_SS_PIN PC11 // SDIO_D3_PIN
#define SD_SCK_PIN PC12 // SDIO_CK_PIN
#define SD_MISO_PIN PC8 // SDIO_D0_PIN
#define SD_MOSI_PIN PD2 // SDIO_CMD_PIN
Expand Down
1 change: 0 additions & 1 deletion Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
#define SD_MISO_PIN P0_16 // EXP1-4
#define SD_MOSI_PIN P0_18 // EXP1-3
#define SD_SS_PIN P1_30 // EXP1-2
#define SDSS SD_SS_PIN
#endif

/**
Expand Down
5 changes: 1 addition & 4 deletions Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,11 @@
* Hardware SPI can't be used because P0_17 (MISO) is not brought out on this board.
*/
#if HAS_MEDIA

#define SD_SCK_PIN P0_15 // EXP1-5
#define SD_MISO_PIN P0_16 // EXP1-4
#define SD_MOSI_PIN P0_18 // EXP1-3
#define SD_SS_PIN P1_30 // EXP1-2
#define SDSS SD_SS_PIN

#endif // HAS_MEDIA
#endif

/**
* PWMS
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
#define BTN_ENC P2_11

#define SD_DETECT_PIN P1_18
#define SDSS P1_21
#define SD_SS_PIN P1_21

#define STAT_LED_RED_PIN P1_19
#define STAT_LED_BLUE_PIN P1_20
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
#define BTN_ENC P1_30

#define SD_DETECT_PIN P1_18
#define SDSS P1_21
#define SD_SS_PIN P1_21

#define STAT_LED_RED_PIN P1_19
#define STAT_LED_BLUE_PIN P1_20
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/mega/pins_CHEAPTRONICv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
#define BEEPER_PIN 44

#if HAS_MEDIA
#define SDSS 53
#define SD_SS_PIN 53
#define SD_DETECT_PIN 49
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/mega/pins_CNCONTROLS_11.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
//
// Misc. Functions
//
#define SDSS 53
#define SD_SS_PIN 53
#define SD_DETECT_PIN 13

// Tools
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/mega/pins_CNCONTROLS_12.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
//
// Misc. Functions
//
#define SDSS 53
#define SD_SS_PIN 53
#define SD_DETECT_PIN 15

// Tools
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/mega/pins_CNCONTROLS_15.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
//
// Misc. Functions
//
#define SDSS 53
#define SD_SS_PIN 53
#define SD_DETECT_PIN 40

// Common I/O
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/mega/pins_EINSTART-S.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
//
// Misc. Functions
//
#define SDSS 53
#define SD_SS_PIN 53
#define LED_PIN 4

//
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/mega/pins_ELEFU_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

#if ENABLED(RA_CONTROL_PANEL)

#define SDSS 53
#define SD_SS_PIN 53
#define SD_DETECT_PIN 28

#define BTN_EN1 14
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/mega/pins_GT2560_REV_A.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
#define EXP2_07_PIN 38 // SD_DET
#define EXP2_08_PIN -1 // RESET

#define SDSS EXP2_04_PIN
#define SD_SS_PIN EXP2_04_PIN
#define LED_PIN 13

#if HAS_WIRED_LCD
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/mega/pins_GT2560_V3.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
// Misc. Functions
//
#define SD_DETECT_PIN 38
#define SDSS 53
#define SD_SS_PIN 53
#define LED_PIN 13 // Use 6 (case light) for external LED. 13 is internal (yellow) LED.
#define PS_ON_PIN 12

Expand Down
Loading

0 comments on commit 3a95525

Please sign in to comment.