diff --git a/Marlin/src/HAL/HAL_STM32/Sd2Card_sdio_stm32duino.cpp b/Marlin/src/HAL/HAL_STM32/Sd2Card_sdio_stm32duino.cpp new file mode 100644 index 0000000000..ebe15f9391 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/Sd2Card_sdio_stm32duino.cpp @@ -0,0 +1,274 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDIO_SUPPORT) && !defined(STM32GENERIC) + +#include +#include + +//#include "SdMscDriver.h" + +//#include "usbd_msc_bot.h" +//#include "usbd_msc_scsi.h" +//#include "usbd_msc_composite.h" +//#include "usbd_msc_cdc_composite.h" + +//#include "usbd_msc_data.h" + +#if defined(STM32F103xE) || defined(STM32F103xG) + #include + #include +#elif defined(STM32F4xx) + #include + #include + #include + #include +#elif defined(STM32F7xx) + #include + #include + #include + #include +#else + #error "ERROR - Only STM32F103xE, STM32F103xG, STM32F4xx or STM32F7xx CPUs supported" +#endif + +SD_HandleTypeDef hsd; // create SDIO structure + +#define TRANSFER_CLOCK_DIV ((uint8_t)SDIO_INIT_CLK_DIV/40) + +#ifndef USBD_OK + #define USBD_OK 0 +#endif + +void go_to_transfer_speed() { + + SD_InitTypeDef Init; + + /* Default SDIO peripheral configuration for SD card initialization */ + Init.ClockEdge = hsd.Init.ClockEdge; + Init.ClockBypass = hsd.Init.ClockBypass; + Init.ClockPowerSave = hsd.Init.ClockPowerSave; + Init.BusWide = hsd.Init.BusWide; + Init.HardwareFlowControl = hsd.Init.HardwareFlowControl; + Init.ClockDiv = TRANSFER_CLOCK_DIV; + + /* Initialize SDIO peripheral interface with default configuration */ + SDIO_Init(hsd.Instance, Init); +} + +void SD_LowLevel_Init(void) { + + uint32_t tempreg; + + GPIO_InitTypeDef GPIO_InitStruct; + + __HAL_RCC_GPIOC_CLK_ENABLE(); //enable GPIO clocks + __HAL_RCC_GPIOD_CLK_ENABLE(); //enable GPIO clocks + + GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_12; // D0 & SCK + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = 1; //GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF12_SDIO; + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + + #if defined(SDIO_D1_PIN) && defined(SDIO_D2_PIN) && defined(SDIO_D3_PIN) // define D1-D3 only if have a four bit wide SDIO bus + GPIO_InitStruct.Pin = GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11; // D1-D3 + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = 1; //GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF12_SDIO; + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + #endif + + // Configure PD.02 CMD line + GPIO_InitStruct.Pin = GPIO_PIN_2; + HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); + + RCC->APB2RSTR &= ~RCC_APB2RSTR_SDIORST_Msk; // take SDIO out of reset + RCC->APB2ENR |= RCC_APB2RSTR_SDIORST_Msk; // enable SDIO clock + + // Enable the DMA2 Clock + + //Initialize the SDIO (with initial <400Khz Clock) + tempreg = 0; //Reset value + tempreg |= SDIO_CLKCR_CLKEN; //Clock is enabled + tempreg |= (uint32_t)0x76; //Clock Divider. Clock = 48000/(118+2) = 400Khz + //Keep the rest at 0 => HW_Flow Disabled, Rising Clock Edge, Disable CLK ByPass, Bus Width = 0, Power save Disable + SDIO->CLKCR = tempreg; + + //Power up the SDIO + SDIO->POWER = 0x03; +} + + +void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { // application specific init + UNUSED(hsd); /* Prevent unused argument(s) compilation warning */ + __HAL_RCC_SDIO_CLK_ENABLE(); // turn on SDIO clock +} + +constexpr uint8_t SD_RETRY_COUNT = (1 + #if ENABLED(SD_CHECK_AND_RETRY) + + 2 + #endif +); + +bool SDIO_Init() { + //init SDIO and get SD card info + + uint8_t retryCnt = SD_RETRY_COUNT; + + bool status; + hsd.Instance = SDIO; + hsd.State = (HAL_SD_StateTypeDef) 0; // HAL_SD_STATE_RESET + SD_LowLevel_Init(); + + uint8_t retry_Cnt = retryCnt; + for (;;) { + status = (bool) HAL_SD_Init(&hsd); + if (!status) break; + if (!--retry_Cnt) return false; // return failing status if retries are exhausted + } + + go_to_transfer_speed(); + + #if defined(SDIO_D1_PIN) && defined(SDIO_D2_PIN) && defined(SDIO_D3_PIN) // go to 4 bit wide mode if pins are defined + retry_Cnt = retryCnt; + for (;;) { + if (!HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B)) break; // some cards are only 1 bit wide so a pass here is not required + if (!--retry_Cnt) break; + } + if (!retry_Cnt) { // wide bus failed, go back to one bit wide mode + hsd.State = (HAL_SD_StateTypeDef) 0; // HAL_SD_STATE_RESET + SD_LowLevel_Init(); + retry_Cnt = retryCnt; + for (;;) { + status = (bool) HAL_SD_Init(&hsd); + if (!status) break; + if (!--retry_Cnt) return false; // return failing status if retries are exhausted + } + } + #endif + + return true; +} + +void init_SDIO_pins(void) { + GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /**SDIO GPIO Configuration + PC8 ------> SDIO_D0 + PC12 ------> SDIO_CK + PD2 ------> SDIO_CMD + */ + GPIO_InitStruct.Pin = GPIO_PIN_8; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF12_SDIO; + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = GPIO_PIN_12; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF12_SDIO; + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = GPIO_PIN_2; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF12_SDIO; + HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); +} + +//bool SDIO_init() { return (bool) (SD_SDIO_Init() ? 1 : 0);} +//bool SDIO_Init_C() { return (bool) (SD_SDIO_Init() ? 1 : 0);} + +bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) { + bool status; + + hsd.Instance = SDIO; + + uint8_t retryCnt = SD_RETRY_COUNT; + + for (;;) { + bool status = (bool) HAL_SD_ReadBlocks(&hsd, (uint8_t*)dst, block, 1, 1000); // read one 512 byte block with 500mS timeout + status |= (bool) HAL_SD_GetCardState(&hsd); // make sure all is OK + if (!status) return false; // return passing status + if (!--retryCnt) return true; // return failing status if retries are exhausted + } + + /* + return (bool) ((status_read | status_card) ? 1 : 0); + + if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false; + if (blockAddress >= SdCard.LogBlockNbr) return false; + if ((0x03 & (uint32_t)data)) return false; // misaligned data + + if (SdCard.CardType != CARD_SDHC_SDXC) { blockAddress *= 512U; } + + if (!SDIO_CmdReadSingleBlock(blockAddress)) { + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS); + dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); + return false; + } + + while (!SDIO_GET_FLAG(SDIO_STA_DATAEND | SDIO_STA_TRX_ERROR_FLAGS)) {} + + dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); + + if (SDIO->STA & SDIO_STA_RXDAVL) { + while (SDIO->STA & SDIO_STA_RXDAVL) (void)SDIO->FIFO; + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS); + return false; + } + + if (SDIO_GET_FLAG(SDIO_STA_TRX_ERROR_FLAGS)) { + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS); + return false; + } + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS); + */ + + return true; +} + +bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) { + bool status; + + hsd.Instance = SDIO; + + uint8_t retryCnt = SD_RETRY_COUNT; + + for (;;) { + status = (bool) HAL_SD_WriteBlocks(&hsd, (uint8_t*)src, block, 1, 500); // write one 512 byte block with 500mS timeout + status |= (bool) HAL_SD_GetCardState(&hsd); // make sure all is OK + if (!status) return (bool) status; // return passing status + if (!--retryCnt) return (bool) status; // return failing status if retries are exhausted + } +} + +#endif // SDIO_SUPPORT diff --git a/Marlin/src/HAL/HAL_STM32F1/timers.h b/Marlin/src/HAL/HAL_STM32F1/timers.h index d7fe11470c..e5733cc563 100644 --- a/Marlin/src/HAL/HAL_STM32F1/timers.h +++ b/Marlin/src/HAL/HAL_STM32F1/timers.h @@ -70,7 +70,7 @@ typedef uint16_t hal_timer_t; //#define TEMP_TIMER_NUM 4 // 2->4, Timer 2 for Stepper Current PWM #define PULSE_TIMER_NUM STEP_TIMER_NUM -#if MB(BTT_SKR_MINI_E3_V1_0, BIGTREE_SKR_E3_DIP, BTT_SKR_MINI_E3_V1_2, MKS_ROBIN_LITE) +#if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_E3_DIP, BTT_SKR_MINI_E3_V1_2, MKS_ROBIN_LITE) // SKR Mini E3 boards use PA8 as FAN_PIN, so TIMER 1 is used for Fan PWM. #ifdef STM32_HIGH_DENSITY #define SERVO0_TIMER_NUM 8 // tone.cpp uses Timer 4 diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 43cc3111ec..df79e2e2e1 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -208,9 +208,9 @@ #define BOARD_BIQU_B300_V1_0 2009 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver) #define BOARD_MKS_SGEN_L 2010 // MKS-SGen-L (Power outputs: Hotend0, Hotend1, Bed, Fan) #define BOARD_GMARSH_X6_REV1 2011 // GMARSH X6 board, revision 1 prototype -#define BOARD_BIGTREE_SKR_V1_1 2012 // BigTreeTech SKR v1.1 (Power outputs: Hotend0, Hotend1, Fan, Bed) -#define BOARD_BIGTREE_SKR_V1_3 2013 // BigTreeTech SKR v1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed) -#define BOARD_BIGTREE_SKR_V1_4 2014 // BigTreeTech SKR v1.4 (Power outputs: Hotend0, Hotend1, Fan, Bed) +#define BOARD_BTT_SKR_V1_1 2012 // BigTreeTech SKR v1.1 (Power outputs: Hotend0, Hotend1, Fan, Bed) +#define BOARD_BTT_SKR_V1_3 2013 // BigTreeTech SKR v1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed) +#define BOARD_BTT_SKR_V1_4 2014 // BigTreeTech SKR v1.4 (Power outputs: Hotend0, Hotend1, Fan, Bed) // // LPC1769 ARM Cortex M3 @@ -224,7 +224,7 @@ #define BOARD_COHESION3D_MINI 2505 // Cohesion3D Mini #define BOARD_SMOOTHIEBOARD 2506 // Smoothieboard #define BOARD_TH3D_EZBOARD 2507 // TH3D EZBoard v1.0 -#define BOARD_BIGTREE_SKR_V1_4_TURBO 2508 // BigTreeTech SKR v1.4 TURBO (Power outputs: Hotend0, Hotend1, Fan, Bed) +#define BOARD_BTT_SKR_V1_4_TURBO 2508 // BigTreeTech SKR v1.4 TURBO (Power outputs: Hotend0, Hotend1, Fan, Bed) // // SAM3X8E ARM Cortex M3 @@ -281,10 +281,10 @@ #define BOARD_MKS_ROBIN_LITE 4009 // MKS Robin Lite/Lite2 (STM32F103RCT6) #define BOARD_MKS_ROBIN_LITE3 4010 // MKS Robin Lite3 (STM32F103RCT6) #define BOARD_MKS_ROBIN_PRO 4011 // MKS Robin Pro (STM32F103ZET6) -#define BOARD_BIGTREE_SKR_MINI_V1_1 4012 // BigTreeTech SKR Mini v1.1 (STM32F103RC) +#define BOARD_BTT_SKR_MINI_V1_1 4012 // BigTreeTech SKR Mini v1.1 (STM32F103RC) #define BOARD_BTT_SKR_MINI_E3_V1_0 4013 // BigTreeTech SKR Mini E3 (STM32F103RC) #define BOARD_BTT_SKR_MINI_E3_V1_2 4014 // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC) -#define BOARD_BIGTREE_SKR_E3_DIP 4015 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE) +#define BOARD_BTT_SKR_E3_DIP 4015 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE) #define BOARD_JGAURORA_A5S_A1 4016 // JGAurora A5S A1 (STM32F103ZET6) #define BOARD_FYSETC_AIO_II 4017 // FYSETC AIO_II #define BOARD_FYSETC_CHEETAH 4018 // FYSETC Cheetah @@ -313,14 +313,15 @@ #define BOARD_BLACK_STM32F407VE 4204 // BLACK_STM32F407VE #define BOARD_BLACK_STM32F407ZE 4205 // BLACK_STM32F407ZE #define BOARD_STEVAL_3DP001V1 4206 // STEVAL-3DP001V1 3D PRINTER BOARD -#define BOARD_BIGTREE_SKR_PRO_V1_1 4207 // BigTreeTech SKR Pro v1.1 (STM32F407ZG) -#define BOARD_BIGTREE_BTT002_V1_0 4208 // BigTreeTech BTT002 v1.0 (STM32F407VE) -#define BOARD_LERDGE_K 4209 // Lerdge K (STM32F407ZG) -#define BOARD_LERDGE_X 4210 // Lerdge X (STM32F407VE) -#define BOARD_VAKE403D 4211 // VAkE 403D (STM32F446VET6) -#define BOARD_FYSETC_S6 4212 // FYSETC S6 board -#define BOARD_FLYF407ZG 4213 // FLYF407ZG board (STM32F407ZG) -#define BOARD_MKS_ROBIN2 4214 // MKS_ROBIN2 (STM32F407ZE) +#define BOARD_BTT_SKR_PRO_V1_1 4207 // BigTreeTech SKR Pro v1.1 (STM32F407ZG) +#define BOARD_BTT_BTT002_V1_0 4208 // BigTreeTech BTT002 v1.0 (STM32F407VE) +#define BOARD_BTT_GTR_V1_0 4209 // BigTreeTech GTR v1.0 (STM32F407IGT) +#define BOARD_LERDGE_K 4210 // Lerdge K (STM32F407ZG) +#define BOARD_LERDGE_X 4211 // Lerdge X (STM32F407VE) +#define BOARD_VAKE403D 4212 // VAkE 403D (STM32F446VET6) +#define BOARD_FYSETC_S6 4213 // FYSETC S6 board +#define BOARD_FLYF407ZG 4214 // FLYF407ZG board (STM32F407ZG) +#define BOARD_MKS_ROBIN2 4215 // MKS_ROBIN2 (STM32F407ZE) // // ARM Cortex M7 diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index 9699585c1e..5e0797d67c 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -196,12 +196,14 @@ #define EITHER(V1,V2) ANY(V1,V2) // Macros to support pins/buttons exist testing -#define _PINEX_1(PN) (defined(PN##_PIN) && PN##_PIN >= 0) -#define PIN_EXISTS(V...) DO(PINEX,&&,V) +#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0) +#define _PINEX_1 PIN_EXISTS +#define PINS_EXIST(V...) DO(PINEX,&&,V) #define ANY_PIN(V...) DO(PINEX,||,V) -#define _BTNEX_1(BN) (defined(BTN_##BN) && BTN_##BN >= 0) -#define BUTTON_EXISTS(V...) DO(BTNEX,&&,V) +#define BUTTON_EXISTS(BN) (defined(BTN_##BN) && BTN_##BN >= 0) +#define _BTNEX_1 BUTTON_EXISTS +#define BUTTONS_EXIST(V...) DO(BTNEX,&&,V) #define ANY_BUTTON(V...) DO(BTNEX,||,V) #define WITHIN(N,L,H) ((N) >= (L) && (N) <= (H)) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 3668e63341..ed5ddce34d 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -927,7 +927,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #elif TOOLCHANGE_ZRAISE < 0 #error "TOOLCHANGE_ZRAISE must be 0 or higher." #elif ENABLED(PARKING_EXTRUDER) - #if !PIN_EXISTS(SOL0, SOL1) + #if !PINS_EXIST(SOL0, SOL1) #error "PARKING_EXTRUDER requires SOL0_PIN and SOL1_PIN." #elif !defined(PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE) || !WITHIN(PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE, LOW, HIGH) #error "PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE must be defined as HIGH or LOW." @@ -1515,9 +1515,9 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "HEATER_0_PIN not defined for this board." #elif !ANY_PIN(TEMP_0, MAX6675_SS) #error "TEMP_0_PIN not defined for this board." -#elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && !PIN_EXISTS(E0_STEP, E0_DIR)) +#elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && !PINS_EXIST(E0_STEP, E0_DIR)) #error "E0_STEP_PIN or E0_DIR_PIN not defined for this board." -#elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PIN_EXISTS(E0_STEP, E0_DIR) || !HAS_E0_ENABLE)) +#elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PINS_EXIST(E0_STEP, E0_DIR) || !HAS_E0_ENABLE)) #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board." #elif EXTRUDERS && TEMP_SENSOR_0 == 0 #error "TEMP_SENSOR_0 is required with any extruders." @@ -1709,35 +1709,35 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS */ #if DISABLED(MK2_MULTIPLEXER) // MK2_MULTIPLEXER uses E0 stepper only #if E_STEPPERS - #if !(PIN_EXISTS(E0_STEP, E0_DIR) && HAS_E0_ENABLE) + #if !(PINS_EXIST(E0_STEP, E0_DIR) && HAS_E0_ENABLE) #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board." #endif #if E_STEPPERS > 1 - #if !(PIN_EXISTS(E1_STEP, E1_DIR) && HAS_E1_ENABLE) + #if !(PINS_EXIST(E1_STEP, E1_DIR) && HAS_E1_ENABLE) #error "E1_STEP_PIN, E1_DIR_PIN, or E1_ENABLE_PIN not defined for this board." #endif #if E_STEPPERS > 2 - #if !(PIN_EXISTS(E2_STEP, E2_DIR) && HAS_E2_ENABLE) + #if !(PINS_EXIST(E2_STEP, E2_DIR) && HAS_E2_ENABLE) #error "E2_STEP_PIN, E2_DIR_PIN, or E2_ENABLE_PIN not defined for this board." #endif #if E_STEPPERS > 3 - #if !(PIN_EXISTS(E3_STEP, E3_DIR) && HAS_E3_ENABLE) + #if !(PINS_EXIST(E3_STEP, E3_DIR) && HAS_E3_ENABLE) #error "E3_STEP_PIN, E3_DIR_PIN, or E3_ENABLE_PIN not defined for this board." #endif #if E_STEPPERS > 4 - #if !(PIN_EXISTS(E4_STEP, E4_DIR) && HAS_E4_ENABLE) + #if !(PINS_EXIST(E4_STEP, E4_DIR) && HAS_E4_ENABLE) #error "E4_STEP_PIN, E4_DIR_PIN, or E4_ENABLE_PIN not defined for this board." #endif #if E_STEPPERS > 5 - #if !(PIN_EXISTS(E5_STEP, E5_DIR) && HAS_E5_ENABLE) + #if !(PINS_EXIST(E5_STEP, E5_DIR) && HAS_E5_ENABLE) #error "E5_STEP_PIN, E5_DIR_PIN, or E5_ENABLE_PIN not defined for this board." #endif #if E_STEPPERS > 6 - #if !(PIN_EXISTS(E6_STEP, E6_DIR) && HAS_E6_ENABLE) + #if !(PINS_EXIST(E6_STEP, E6_DIR) && HAS_E6_ENABLE) #error "E6_STEP_PIN, E6_DIR_PIN, or E6_ENABLE_PIN not defined for this board." #endif #if E_STEPPERS > 7 - #if !(PIN_EXISTS(E7_STEP, E7_DIR) && HAS_E7_ENABLE) + #if !(PINS_EXIST(E7_STEP, E7_DIR) && HAS_E7_ENABLE) #error "E7_STEP_PIN, E7_DIR_PIN, or E7_ENABLE_PIN not defined for this board." #endif #endif // E_STEPPERS > 7 @@ -1926,7 +1926,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * RGB_LED Requirements */ -#define _RGB_TEST (PIN_EXISTS(RGB_LED_R, RGB_LED_G, RGB_LED_B)) +#define _RGB_TEST (PINS_EXIST(RGB_LED_R, RGB_LED_G, RGB_LED_B)) #if ENABLED(PRINTER_EVENT_LEDS) && !HAS_COLOR_LEDS #error "PRINTER_EVENT_LEDS requires BLINKM, PCA9533, PCA9632, RGB_LED, RGBW_LED or NEOPIXEL_LED." #elif ENABLED(RGB_LED) @@ -2080,7 +2080,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Check existing RX/TX pins against enable TMC UART drivers. */ -#define INVALID_TMC_UART(ST) (AXIS_HAS_UART(ST) && !(defined(ST##_HARDWARE_SERIAL) || (PIN_EXISTS(ST##_SERIAL_RX, ST##_SERIAL_TX)))) +#define INVALID_TMC_UART(ST) (AXIS_HAS_UART(ST) && !(defined(ST##_HARDWARE_SERIAL) || (PINS_EXIST(ST##_SERIAL_RX, ST##_SERIAL_TX)))) #if INVALID_TMC_UART(X) #error "TMC2208 or TMC2209 on X requires X_HARDWARE_SERIAL or X_SERIAL_(RX|TX)_PIN." #elif INVALID_TMC_UART(X2) @@ -2442,7 +2442,7 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) #error "PRINTCOUNTER requires EEPROM_SETTINGS. Please update your Configuration." #endif -#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !PIN_EXISTS(USB_CS, USB_INTR) +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !PINS_EXIST(USB_CS, USB_INTR) #error "USB_CS_PIN and USB_INTR_PIN are required for USB_FLASH_DRIVE_SUPPORT." #endif diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index 3317ac805b..8a328c4b91 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -28,7 +28,7 @@ #endif #define HAS_ENCODER_ACTION (HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY)) -#define HAS_ENCODER_WHEEL ((!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) || BUTTON_EXISTS(EN1, EN2)) +#define HAS_ENCODER_WHEEL ((!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) || BUTTONS_EXIST(EN1, EN2)) #define HAS_DIGITAL_BUTTONS (HAS_ENCODER_WHEEL || ANY_BUTTON(ENC, BACK, UP, DWN, LFT, RT)) #define HAS_SHIFT_ENCODER (!HAS_ADC_BUTTONS && (ENABLED(REPRAPWORLD_KEYPAD) || (HAS_SPI_LCD && DISABLED(NEWPANEL)))) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 16635b39bd..f07f943213 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -59,7 +59,7 @@ ); #endif -#define MAX6675_SEPARATE_SPI (EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) && PIN_EXISTS(MAX6675_SCK, MAX6675_DO)) +#define MAX6675_SEPARATE_SPI (EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) && PINS_EXIST(MAX6675_SCK, MAX6675_DO)) #if MAX6675_SEPARATE_SPI #include "../libs/private_spi.h" diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 9b49b3956c..1515440e71 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -361,11 +361,11 @@ #include "lpc1768/pins_BIQU_B300_V1.0.h" // LPC1768 env:LPC1768 #elif MB(GMARSH_X6_REV1) #include "lpc1768/pins_GMARSH_X6_REV1.h" // LPC1768 env:LPC1768 -#elif MB(BIGTREE_SKR_V1_1) +#elif MB(BTT_SKR_V1_1) #include "lpc1768/pins_BTT_SKR_V1_1.h" // LPC1768 env:LPC1768 -#elif MB(BIGTREE_SKR_V1_3) +#elif MB(BTT_SKR_V1_3) #include "lpc1768/pins_BTT_SKR_V1_3.h" // LPC1768 env:LPC1768 -#elif MB(BIGTREE_SKR_V1_4) +#elif MB(BTT_SKR_V1_4) #include "lpc1768/pins_BTT_SKR_V1_4.h" // LPC1768 env:LPC1768 // @@ -388,7 +388,7 @@ #include "lpc1769/pins_SMOOTHIEBOARD.h" // LPC1769 env:LPC1769 #elif MB(TH3D_EZBOARD) #include "lpc1769/pins_TH3D_EZBOARD.h" // LPC1769 env:LPC1769 -#elif MB(BIGTREE_SKR_V1_4_TURBO) +#elif MB(BTT_SKR_V1_4_TURBO) #include "lpc1769/pins_BTT_SKR_V1_4_TURBO.h" // LPC1769 env:LPC1769 // @@ -484,13 +484,13 @@ #include "stm32/pins_MKS_ROBIN_NANO.h" // STM32F1 env:mks_robin_nano #elif MB(MKS_ROBIN_LITE) #include "stm32/pins_MKS_ROBIN_LITE.h" // STM32F1 env:mks_robin_lite -#elif MB(BIGTREE_SKR_MINI_V1_1) +#elif MB(BTT_SKR_MINI_V1_1) #include "stm32/pins_BTT_SKR_MINI_V1_1.h" // STM32F1 env:STM32F103RC_bigtree env:STM32F103RC_bigtree_512K env:STM32F103RC_bigtree_USB env:STM32F103RC_bigtree_512K_USB #elif MB(BTT_SKR_MINI_E3_V1_0) #include "stm32/pins_BTT_SKR_MINI_E3_V1_0.h" // STM32F1 env:STM32F103RC_bigtree env:STM32F103RC_bigtree_512K env:STM32F103RC_bigtree_USB env:STM32F103RC_bigtree_512K_USB #elif MB(BTT_SKR_MINI_E3_V1_2) #include "stm32/pins_BTT_SKR_MINI_E3_V1_2.h" // STM32F1 env:STM32F103RC_bigtree env:STM32F103RC_bigtree_512K env:STM32F103RC_bigtree_USB env:STM32F103RC_bigtree_512K_USB -#elif MB(BIGTREE_SKR_E3_DIP) +#elif MB(BTT_SKR_E3_DIP) #include "stm32/pins_BTT_SKR_E3_DIP.h" // STM32F1 env:STM32F103RE_bigtree env:STM32F103RE_bigtree_USB env:STM32F103RC_bigtree env:STM32F103RC_bigtree_512K env:STM32F103RC_bigtree_USB env:STM32F103RC_bigtree_512K_USB #elif MB(JGAURORA_A5S_A1) #include "stm32/pins_JGAURORA_A5S_A1.h" // STM32F1 env:jgaurora_a5s_a1 @@ -527,16 +527,16 @@ #elif MB(ARMED) #include "stm32/pins_ARMED.h" // STM32F4 env:ARMED #elif MB(RUMBA32) - #include "stm32/pins_RUMBA32.h" // STM32F4 env:RUMBA32 + #include "stm32/pins_RUMBA32.h" // STM32F4 env:rumba32_f446ve env:mks_rumba32 #elif MB(BLACK_STM32F407VE) #include "stm32/pins_BLACK_STM32F407VE.h" // STM32F4 env:STM32F407VE_black #elif MB(STEVAL_3DP001V1) #include "stm32/pins_STEVAL_3DP001V1.h" // STM32F4 env:STM32F401VE_STEVAL -#elif MB(BIGTREE_SKR_PRO_V1_1) +#elif MB(BTT_SKR_PRO_V1_1) #include "stm32/pins_BTT_SKR_PRO_V1_1.h" // STM32F4 env:BIGTREE_SKR_PRO -#elif MB(BIGTREE_GTR_V1_0) - #include "stm32/pins_BTT_GTR_V1_0.h" // STM32F4 env:BIGTREE_GTR -#elif MB(BIGTREE_BTT002_V1_0) +#elif MB(BTT_GTR_V1_0) + #include "stm32/pins_BTT_GTR_V1_0.h" // STM32F4 env:BIGTREE_GTR_V1_0 +#elif MB(BTT_BTT002_V1_0) #include "stm32/pins_BTT_BTT002_V1_0.h" // STM32F4 env:BIGTREE_BTT002 #elif MB(LERDGE_K) #include "stm32/pins_LERDGE_K.h" // STM32F4 env:STM32F4 @@ -587,16 +587,24 @@ // Obsolete or unknown board // - #define BOARD_MKS_13 -1000 - #define BOARD_TRIGORILLA -1001 - #define BOARD_RURAMPS4D -1002 - #define BOARD_FORMBOT_TREX2 -1003 - #define BOARD_BIQU_SKR_V1_1 -1004 - #define BOARD_STM32F1R -1005 - #define BOARD_STM32F103R -1006 - #define BOARD_ESP32 -1007 - #define BOARD_BIGTREE_SKR_MINI_E3 -1008 - #define BOARD_STEVAL -1009 + #define BOARD_MKS_13 -1000 + #define BOARD_TRIGORILLA -1001 + #define BOARD_RURAMPS4D -1002 + #define BOARD_FORMBOT_TREX2 -1003 + #define BOARD_BIQU_SKR_V1_1 -1004 + #define BOARD_STM32F1R -1005 + #define BOARD_STM32F103R -1006 + #define BOARD_ESP32 -1007 + #define BOARD_STEVAL -1008 + #define BOARD_BIGTREE_SKR_V1_1 -1009 + #define BOARD_BIGTREE_SKR_V1_3 -1010 + #define BOARD_BIGTREE_SKR_V1_4 -1011 + #define BOARD_BIGTREE_SKR_V1_4_TURBO -1012 + #define BOARD_BIGTREE_BTT002_V1_0 -1013 + #define BOARD_BIGTREE_SKR_PRO_V1_1 -1014 + #define BOARD_BIGTREE_SKR_MINI_V1_1 -1015 + #define BOARD_BIGTREE_SKR_MINI_E3 -1016 + #define BOARD_BIGTREE_SKR_E3_DIP -1017 #if MB(MKS_13) #error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration." @@ -607,15 +615,33 @@ #elif MB(FORMBOT_TREX2) #error "FORMBOT_TREX2 has been renamed BOARD_FORMBOT_TREX2PLUS. Please update your configuration." #elif MB(BIQU_SKR_V1_1) - #error "BOARD_BIQU_SKR_V1_1 has been renamed BOARD_BIGTREE_SKR_V1_1. Please update your configuration." + #error "BOARD_BIQU_SKR_V1_1 has been renamed BOARD_BTT_SKR_V1_1. Please update your configuration." + #elif MB(BIGTREE_SKR_V1_1) + #error "BOARD_BIGTREE_SKR_V1_1 has been renamed BOARD_BTT_SKR_V1_1. Please update your configuration." + #elif MB(BIGTREE_SKR_V2_2) + #error "BOARD_BIGTREE_SKR_V1_2 has been renamed BOARD_BTT_SKR_V1_2. Please update your configuration." + #elif MB(BIGTREE_SKR_V1_3) + #error "BOARD_BIGTREE_SKR_V1_3 has been renamed BOARD_BTT_SKR_V1_3. Please update your configuration." + #elif MB(BIGTREE_SKR_V1_4) + #error "BOARD_BIGTREE_SKR_V1_4 has been renamed BOARD_BTT_SKR_V1_4. Please update your configuration." + #elif MB(BIGTREE_SKR_V1_4_TURBO) + #error "BOARD_BIGTREE_SKR_V1_4_TURBO has been renamed BOARD_BTT_SKR_V1_4_TURBO. Please update your configuration." + #elif MB(BIGTREE_BTT002_V1_0) + #error "BOARD_BIGTREE_BTT002_V1_0 has been renamed BOARD_BTT_BTT002_V1_0. Please update your configuration." + #elif MB(BIGTREE_SKR_PRO_V1_1) + #error "BOARD_BIGTREE_SKR_PRO_V1_1 has been renamed BOARD_BTT_SKR_PRO_V1_1. Please update your configuration." + #elif MB(BIGTREE_SKR_MINI_V1_1) + #error "BOARD_BIGTREE_SKR_MINI_V1_1 has been renamed BOARD_BTT_SKR_MINI_V1_1. Please update your configuration." + #elif MB(BIGTREE_SKR_MINI_E3) + #error "BOARD_BIGTREE_SKR_MINI_E3 has been renamed BOARD_BTT_SKR_MINI_E3_V1_0. Please update your configuration." + #elif MB(BIGTREE_SKR_E3_DIP) + #error "BOARD_BIGTREE_SKR_E3_DIP has been renamed BOARD_BTT_SKR_E3_DIP. Please update your configuration." #elif MB(STM32F1R) #error "BOARD_STM32F1R has been renamed BOARD_STM32F103RE. Please update your configuration." #elif MB(STM32F103R) #error "BOARD_STM32F103R has been renamed BOARD_STM32F103RE. Please update your configuration." #elif MOTHERBOARD == BOARD_ESP32 #error "BOARD_ESP32 has been renamed BOARD_ESPRESSIF_ESP32. Please update your configuration." - #elif MB(BIGTREE_SKR_MINI_E3) - #error "BOARD_BIGTREE_SKR_MINI_E3 has been renamed BOARD_BTT_SKR_MINI_E3_V1_0. Please update your configuration." #elif MB(STEVAL) #error "BOARD_STEVAL has been renamed BOARD_STEVAL_3DP001V1. Please update your configuration." #else @@ -630,8 +656,16 @@ #undef BOARD_STM32F1R #undef BOARD_STM32F103R #undef BOARD_ESP32 - #undef BOARD_BIGTREE_SKR_MINI_E3 #undef BOARD_STEVAL + #undef BOARD_BIGTREE_SKR_MINI_E3 + #undef BOARD_BIGTREE_SKR_V1_1 + #undef BOARD_BIGTREE_SKR_V1_3 + #undef BOARD_BIGTREE_SKR_V1_4 + #undef BOARD_BIGTREE_SKR_V1_4_TURBO + #undef BOARD_BIGTREE_BTT002_V1_0 + #undef BOARD_BIGTREE_SKR_PRO_V1_1 + #undef BOARD_BIGTREE_SKR_MINI_V1_1 + #undef BOARD_BIGTREE_SKR_E3_DIP #endif diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index 9e6159ee09..2006bb8bc3 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -168,7 +168,7 @@ const PinInfo pin_array[] PROGMEM = { #endif #include "pinsDebug_list.h" - #line 98 + #line 172 }; diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index 37f3c528be..dae4bde450 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -26,425 +26,72 @@ #line 28 // set __LINE__ to a known value for both passes -// Undefine pins to suppress warnings -#if !PIN_EXISTS(X_MS1) - #undef X_MS1_PIN -#endif -#if !PIN_EXISTS(X_MS2) - #undef X_MS2_PIN -#endif -#if !PIN_EXISTS(X_MS3) - #undef X_MS3_PIN -#endif -#if !PIN_EXISTS(X2_MS1) - #undef X2_MS1_PIN -#endif -#if !PIN_EXISTS(X2_MS2) - #undef X2_MS2_PIN -#endif -#if !PIN_EXISTS(X2_MS3) - #undef X2_MS3_PIN -#endif -#if !PIN_EXISTS(Y_MS1) - #undef Y_MS1_PIN -#endif -#if !PIN_EXISTS(Y_MS2) - #undef Y_MS2_PIN -#endif -#if !PIN_EXISTS(Y_MS3) - #undef Y_MS3_PIN -#endif -#if !PIN_EXISTS(Y2_MS1) - #undef Y2_MS1_PIN -#endif -#if !PIN_EXISTS(Y2_MS2) - #undef Y2_MS2_PIN -#endif -#if !PIN_EXISTS(Y2_MS3) - #undef Y2_MS3_PIN -#endif -#if !PIN_EXISTS(Z_MS1) - #undef Z_MS1_PIN -#endif -#if !PIN_EXISTS(Z_MS2) - #undef Z_MS2_PIN -#endif -#if !PIN_EXISTS(Z_MS3) - #undef Z_MS3_PIN -#endif -#if !PIN_EXISTS(Z2_MS1) - #undef Z2_MS1_PIN -#endif -#if !PIN_EXISTS(Z2_MS2) - #undef Z2_MS2_PIN -#endif -#if !PIN_EXISTS(Z2_MS3) - #undef Z2_MS3_PIN -#endif -#if !PIN_EXISTS(Z3_MS1) - #undef Z3_MS1_PIN -#endif -#if !PIN_EXISTS(Z3_MS2) - #undef Z3_MS2_PIN -#endif -#if !PIN_EXISTS(Z3_MS3) - #undef Z3_MS3_PIN -#endif -#if !PIN_EXISTS(Z4_MS1) - #undef Z4_MS1_PIN -#endif -#if !PIN_EXISTS(Z4_MS2) - #undef Z4_MS2_PIN -#endif -#if !PIN_EXISTS(Z4_MS3) - #undef Z4_MS3_PIN -#endif -#if !PIN_EXISTS(E0_MS1) - #undef E0_MS1_PIN -#endif -#if !PIN_EXISTS(E0_MS2) - #undef E0_MS2_PIN -#endif -#if !PIN_EXISTS(E0_MS3) - #undef E0_MS3_PIN -#endif -#if !PIN_EXISTS(E1_MS1) - #undef E1_MS1_PIN -#endif -#if !PIN_EXISTS(E1_MS2) - #undef E1_MS2_PIN -#endif -#if !PIN_EXISTS(E1_MS3) - #undef E1_MS3_PIN -#endif -#if !PIN_EXISTS(E2_MS1) - #undef E2_MS1_PIN -#endif -#if !PIN_EXISTS(E2_MS2) - #undef E2_MS2_PIN -#endif -#if !PIN_EXISTS(E2_MS3) - #undef E2_MS3_PIN -#endif -#if !PIN_EXISTS(E3_MS1) - #undef E3_MS1_PIN -#endif -#if !PIN_EXISTS(E3_MS2) - #undef E3_MS2_PIN -#endif -#if !PIN_EXISTS(E3_MS3) - #undef E3_MS3_PIN -#endif -#if !PIN_EXISTS(E4_MS1) - #undef E4_MS1_PIN -#endif -#if !PIN_EXISTS(E4_MS2) - #undef E4_MS2_PIN -#endif -#if !PIN_EXISTS(E4_MS3) - #undef E4_MS3_PIN -#endif -#if !PIN_EXISTS(E5_MS1) - #undef E5_MS1_PIN -#endif -#if !PIN_EXISTS(E5_MS2) - #undef E5_MS2_PIN -#endif -#if !PIN_EXISTS(E5_MS3) - #undef E5_MS3_PIN -#endif -#if !PIN_EXISTS(E6_MS1) - #undef E6_MS1_PIN -#endif -#if !PIN_EXISTS(E6_MS2) - #undef E6_MS2_PIN -#endif -#if !PIN_EXISTS(E6_MS3) - #undef E6_MS3_PIN -#endif -#if !PIN_EXISTS(E7_MS1) - #undef E7_MS1_PIN -#endif -#if !PIN_EXISTS(E7_MS2) - #undef E7_MS2_PIN -#endif -#if !PIN_EXISTS(E7_MS3) - #undef E7_MS3_PIN -#endif - -#if !PIN_EXISTS(E0_STEP) - #undef E0_STEP_PIN -#endif -#if !PIN_EXISTS(E0_DIR) - #undef E0_DIR_PIN -#endif -#if !PIN_EXISTS(E0_ENABLE) - #undef E0_ENABLE_PIN -#endif -#if !PIN_EXISTS(E1_STEP) - #undef E1_STEP_PIN -#endif -#if !PIN_EXISTS(E1_DIR) - #undef E1_DIR_PIN -#endif -#if !PIN_EXISTS(E1_ENABLE) - #undef E1_ENABLE_PIN -#endif -#if !PIN_EXISTS(E2_STEP) - #undef E2_STEP_PIN -#endif -#if !PIN_EXISTS(E2_DIR) - #undef E2_DIR_PIN -#endif -#if !PIN_EXISTS(E2_ENABLE) - #undef E2_ENABLE_PIN -#endif -#if !PIN_EXISTS(E3_STEP) - #undef E3_STEP_PIN -#endif -#if !PIN_EXISTS(E3_DIR) - #undef E3_DIR_PIN -#endif -#if !PIN_EXISTS(E3_ENABLE) - #undef E3_ENABLE_PIN -#endif -#if !PIN_EXISTS(E4_STEP) - #undef E4_STEP_PIN -#endif -#if !PIN_EXISTS(E4_DIR) - #undef E4_DIR_PIN -#endif -#if !PIN_EXISTS(E4_ENABLE) - #undef E4_ENABLE_PIN -#endif -#if !PIN_EXISTS(E5_STEP) - #undef E5_STEP_PIN -#endif -#if !PIN_EXISTS(E5_DIR) - #undef E5_DIR_PIN -#endif -#if !PIN_EXISTS(E5_ENABLE) - #undef E5_ENABLE_PIN -#endif -#if !PIN_EXISTS(E6_STEP) - #undef E6_STEP_PIN -#endif -#if !PIN_EXISTS(E6_DIR) - #undef E6_DIR_PIN -#endif -#if !PIN_EXISTS(E6_ENABLE) - #undef E6_ENABLE_PIN -#endif -#if !PIN_EXISTS(E7_STEP) - #undef E7_STEP_PIN -#endif -#if !PIN_EXISTS(E7_DIR) - #undef E7_DIR_PIN -#endif -#if !PIN_EXISTS(E7_ENABLE) - #undef E7_ENABLE_PIN -#endif - -#if !PIN_EXISTS(X_CS) - #undef X_CS_PIN -#endif -#if !PIN_EXISTS(Y_CS) - #undef Y_CS_PIN -#endif -#if !PIN_EXISTS(Z_CS) - #undef Z_CS_PIN -#endif -#if !PIN_EXISTS(E0_CS) - #undef E0_CS_PIN -#endif -#if !PIN_EXISTS(E1_CS) - #undef E1_CS_PIN -#endif -#if !PIN_EXISTS(E2_CS) - #undef E2_CS_PIN -#endif -#if !PIN_EXISTS(E3_CS) - #undef E3_CS_PIN -#endif -#if !PIN_EXISTS(E4_CS) - #undef E4_CS_PIN -#endif -#if !PIN_EXISTS(E5_CS) - #undef E5_CS_PIN -#endif -#if !PIN_EXISTS(E6_CS) - #undef E6_CS_PIN -#endif -#if !PIN_EXISTS(E7_CS) - #undef E7_CS_PIN -#endif - -#if !PIN_EXISTS(FAN) - #undef FAN_PIN -#endif -#define FAN0_PIN FAN_PIN -#if !PIN_EXISTS(FAN1) - #undef FAN1_PIN -#endif -#if !PIN_EXISTS(FAN2) - #undef FAN2_PIN -#endif -#if !PIN_EXISTS(FAN3) - #undef FAN3_PIN -#endif -#if !PIN_EXISTS(FAN4) - #undef FAN4_PIN -#endif -#if !PIN_EXISTS(FAN5) - #undef FAN5_PIN -#endif -#if !PIN_EXISTS(FAN6) - #undef FAN6_PIN -#endif -#if !PIN_EXISTS(FAN7) - #undef FAN7_PIN -#endif -#if !PIN_EXISTS(CONTROLLER_FAN) - #undef CONTROLLER_FAN_PIN -#endif - -#if !PIN_EXISTS(FANMUX0) - #undef FANMUX0_PIN -#endif -#if !PIN_EXISTS(FANMUX1) - #undef FANMUX1_PIN -#endif -#if !PIN_EXISTS(FANMUX2) - #undef FANMUX2_PIN -#endif - -#if !PIN_EXISTS(HEATER_0) - #undef HEATER_0_PIN -#endif -#if !PIN_EXISTS(HEATER_1) - #undef HEATER_1_PIN -#endif -#if !PIN_EXISTS(HEATER_2) - #undef HEATER_2_PIN -#endif -#if !PIN_EXISTS(HEATER_3) - #undef HEATER_3_PIN -#endif -#if !PIN_EXISTS(HEATER_4) - #undef HEATER_4_PIN -#endif -#if !PIN_EXISTS(HEATER_5) - #undef HEATER_5_PIN -#endif -#if !PIN_EXISTS(HEATER_6) - #undef HEATER_6_PIN -#endif -#if !PIN_EXISTS(HEATER_7) - #undef HEATER_7_PIN -#endif -#if !PIN_EXISTS(HEATER_BED) - #undef HEATER_BED_PIN -#endif - -#if !PIN_EXISTS(TEMP_0) - #undef TEMP_0_PIN -#endif -#if !PIN_EXISTS(TEMP_1) - #undef TEMP_1_PIN -#endif -#if !PIN_EXISTS(TEMP_2) - #undef TEMP_2_PIN -#endif -#if !PIN_EXISTS(TEMP_3) - #undef TEMP_3_PIN -#endif -#if !PIN_EXISTS(TEMP_4) - #undef TEMP_4_PIN -#endif -#if !PIN_EXISTS(TEMP_5) - #undef TEMP_5_PIN -#endif -#if !PIN_EXISTS(TEMP_6) - #undef TEMP_6_PIN -#endif -#if !PIN_EXISTS(TEMP_7) - #undef TEMP_7_PIN -#endif -#if !PIN_EXISTS(TEMP_BED) - #undef TEMP_BED_PIN -#endif - -#if !PIN_EXISTS(SD_DETECT) - #undef SD_DETECT_PIN -#endif -#if !PIN_EXISTS(SDPOWER) - #undef SDPOWER_PIN -#endif - // // Analog Pin Assignments // -#if defined(EXT_AUX_A0) && EXT_AUX_A0 >= 0 && EXT_AUX_A0 < NUM_ANALOG_INPUTS +#define ANALOG_OK(PN) ((PN) >= 0 && (PN) < NUM_ANALOG_PINS) + +#if defined(EXT_AUX_A0) && ANALOG_OK(EXT_AUX_A0) REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A0) #endif -#if defined(EXT_AUX_A1) && EXT_AUX_A1 >= 0 && EXT_AUX_A1 < NUM_ANALOG_INPUTS +#if defined(EXT_AUX_A1) && ANALOG_OK(EXT_AUX_A0) REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A1) #endif -#if defined(EXT_AUX_A2) && EXT_AUX_A2 >= 0 && EXT_AUX_A2 < NUM_ANALOG_INPUTS +#if defined(EXT_AUX_A2) && ANALOG_OK(EXT_AUX_A0) REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A2) #endif -#if defined(EXT_AUX_A3) && EXT_AUX_A3 >= 0 && EXT_AUX_A3 < NUM_ANALOG_INPUTS +#if defined(EXT_AUX_A3) && ANALOG_OK(EXT_AUX_A0) REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A3) #endif -#if defined(EXT_AUX_A4) && EXT_AUX_A4 >= 0 && EXT_AUX_A4 < NUM_ANALOG_INPUTS +#if defined(EXT_AUX_A4) && ANALOG_OK(EXT_AUX_A0) REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A4) #endif -#if PIN_EXISTS(FILWIDTH) && FILWIDTH_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(FILWIDTH) && ANALOG_OK(FILWIDTH_PIN) REPORT_NAME_ANALOG(__LINE__, FILWIDTH_PIN) #endif -#if PIN_EXISTS(MAIN_VOLTAGE_MEASURE) && MAIN_VOLTAGE_MEASURE_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(MAIN_VOLTAGE_MEASURE) && ANALOG_OK(MAIN_VOLTAGE_MEASURE_PIN) REPORT_NAME_ANALOG(__LINE__, MAIN_VOLTAGE_MEASURE_PIN) #endif -#if !defined(ARDUINO_ARCH_SAM) && !defined(ARDUINO_ARCH_SAMD) //TC1 & TC2 are macros in the SAM/SAMD tool chain - #if defined(TC1) && TC1 >= 0 && TC1 < NUM_ANALOG_INPUTS +#if !defined(ARDUINO_ARCH_SAM) && !defined(ARDUINO_ARCH_SAMD) // TC1 & TC2 are macros in the SAM/SAMD tool chain + #if defined(TC1) && ANALOG_OK(TC1) REPORT_NAME_ANALOG(__LINE__, TC1) #endif - #if defined(TC2) && TC2 >= 0 && TC2 < NUM_ANALOG_INPUTS + #if defined(TC2) && ANALOG_OK(TC1) REPORT_NAME_ANALOG(__LINE__, TC2) #endif #endif -#if PIN_EXISTS(TEMP_0) && TEMP_0_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(TEMP_0) && ANALOG_OK(TEMP_0_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_0_PIN) #endif -#if PIN_EXISTS(TEMP_1) && TEMP_1_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(TEMP_1) && ANALOG_OK(TEMP_1_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_1_PIN) #endif -#if PIN_EXISTS(TEMP_2) && TEMP_2_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(TEMP_2) && ANALOG_OK(TEMP_2_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_2_PIN) #endif -#if PIN_EXISTS(TEMP_3) && TEMP_3_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(TEMP_3) && ANALOG_OK(TEMP_3_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_3_PIN) #endif -#if PIN_EXISTS(TEMP_4) && TEMP_4_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(TEMP_4) && ANALOG_OK(TEMP_4_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_4_PIN) #endif -#if PIN_EXISTS(TEMP_5) && TEMP_5_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(TEMP_5) && ANALOG_OK(TEMP_5_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_5_PIN) #endif -#if PIN_EXISTS(TEMP_6) && TEMP_6_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(TEMP_6) && ANALOG_OK(TEMP_6_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_6_PIN) #endif -#if PIN_EXISTS(TEMP_7) && TEMP_7_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(TEMP_7) && ANALOG_OK(TEMP_7_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_7_PIN) #endif -#if PIN_EXISTS(TEMP_BED) && TEMP_BED_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(TEMP_BED) && ANALOG_OK(TEMP_BED_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_BED_PIN) #endif -#if PIN_EXISTS(TEMP_CHAMBER) && TEMP_CHAMBER_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(TEMP_CHAMBER) && ANALOG_OK(TEMP_CHAMBER_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_CHAMBER_PIN) #endif -#if PIN_EXISTS(ADC_KEYPAD) && ADC_KEYPAD_PIN < NUM_ANALOG_INPUTS +#if PIN_EXISTS(ADC_KEYPAD) && ANALOG_OK(ADC_KEYPAD_PIN) REPORT_NAME_ANALOG(__LINE__, ADC_KEYPAD_PIN) #endif diff --git a/Marlin/src/pins/stm32/pins_ARMED.h b/Marlin/src/pins/stm32/pins_ARMED.h index 23ccccdc03..03f267a3a4 100644 --- a/Marlin/src/pins/stm32/pins_ARMED.h +++ b/Marlin/src/pins/stm32/pins_ARMED.h @@ -19,6 +19,9 @@ * along with this program. If not, see . * */ + +// https://github.com/ktand/Armed + #pragma once #ifndef STM32F4 diff --git a/Marlin/src/pins/stm32/pins_BLACK_STM32F407VE.h b/Marlin/src/pins/stm32/pins_BLACK_STM32F407VE.h index 869e74f5e3..d0edf897f4 100644 --- a/Marlin/src/pins/stm32/pins_BLACK_STM32F407VE.h +++ b/Marlin/src/pins/stm32/pins_BLACK_STM32F407VE.h @@ -108,7 +108,6 @@ // // Misc. Functions // -#define SDSS PB12 #define LED_PIN PA6 //#define LED_PIN PA7 #define KILL_PIN PB1 @@ -116,7 +115,7 @@ // // LCD / Controller // -#define SD_DETECT_PIN PC5 +//#define SD_DETECT_PIN PC5 //#define SD_DETECT_PIN PA8 // SDIO SD_DETECT_PIN, external SDIO card reader only #define BEEPER_PIN PD10 @@ -132,3 +131,25 @@ #define DOGLCD_CS LCD_PINS_D5 #define DOGLCD_A0 LCD_PINS_D6 + +// +// Onboard SD support +// +#define SDIO_D0_PIN PC8 +#define SDIO_D1_PIN PC9 +#define SDIO_D2_PIN PC10 +#define SDIO_D3_PIN PC11 +#define SDIO_CK_PIN PC12 +#define SDIO_CMD_PIN PD2 + +#if !defined(SDCARD_CONNECTION) || SDCARD_CONNECTION == ONBOARD + #define SDIO_SUPPORT // Use SDIO for onboard SD + + #ifndef SDIO_SUPPORT + #define SOFTWARE_SPI // Use soft SPI for onboard SD + #define SDSS SDIO_D3_PIN + #define SCK_PIN SDIO_CK_PIN + #define MISO_PIN SDIO_D0_PIN + #define MOSI_PIN SDIO_CMD_PIN + #endif +#endif diff --git a/Marlin/src/pins/stm32/pins_BTT_SKR_PRO_V1_1.h b/Marlin/src/pins/stm32/pins_BTT_SKR_PRO_V1_1.h index 8eb7d354b3..b523874cb9 100644 --- a/Marlin/src/pins/stm32/pins_BTT_SKR_PRO_V1_1.h +++ b/Marlin/src/pins/stm32/pins_BTT_SKR_PRO_V1_1.h @@ -181,7 +181,21 @@ // // Misc. Functions // -#define SDSS PB12 + +// +// Onboard SD card +// NOT compatible with LCD +// +#if SDCARD_CONNECTION == ONBOARD && !defined(HAS_SPI_LCD) + #define SOFTWARE_SPI // Use soft SPI for onboard SD + #define SDSS PA4 + #define SCK_PIN PA5 + #define MISO_PIN PA6 + #define MOSI_PIN PB5 +#else + #define SDSS PB12 +#endif + /** * _____ _____ diff --git a/Marlin/src/pins/stm32/pins_FLYF407ZG.h b/Marlin/src/pins/stm32/pins_FLYF407ZG.h index 94b67769c7..97aaf3fdfc 100644 --- a/Marlin/src/pins/stm32/pins_FLYF407ZG.h +++ b/Marlin/src/pins/stm32/pins_FLYF407ZG.h @@ -152,6 +152,30 @@ #define FAN4_PIN PE13 #define FAN5_PIN PB11 +// +// Onboard SD support +// + +#define SDIO_D0_PIN PC8 +#define SDIO_D1_PIN PC9 +//#define SD_CARD_DETECT_PIN PC13 +#define SDIO_D2_PIN PC10 +#define SDIO_D3_PIN PC11 +#define SDIO_CK_PIN PC12 +#define SDIO_CMD_PIN PD2 + +#if !defined(SDCARD_CONNECTION) || SDCARD_CONNECTION == ONBOARD + #define SDIO_SUPPORT // Use SDIO for onboard SD + + #ifndef SDIO_SUPPORT + #define SOFTWARE_SPI // Use soft SPI for onboard SD + #define SDSS SDIO_D3_PIN + #define SCK_PIN SDIO_CK_PIN + #define MISO_PIN SDIO_D0_PIN + #define MOSI_PIN SDIO_CMD_PIN + #endif +#endif + // // Trinamic Software SPI // diff --git a/Marlin/src/pins/stm32/pins_STEVAL_3DP001V1.h b/Marlin/src/pins/stm32/pins_STEVAL_3DP001V1.h index fcfd35e4fe..e65367971a 100644 --- a/Marlin/src/pins/stm32/pins_STEVAL_3DP001V1.h +++ b/Marlin/src/pins/stm32/pins_STEVAL_3DP001V1.h @@ -226,22 +226,27 @@ // 22 // PB3 JTAG_TDO/SWO // -// SD support +// Onboard SD support // -//#define SDIO_SUPPORT -// 23 // PC8 SDIO_D0 -// 24 // PC9 SDIO_D1 -// 25 // PA15 SD_CARD_DETECT -// 26 // PC10 SDIO_D2 -// 27 // PC11 SDIO_D3 -// 28 // PC12 SDIO_CK -// 29 // PD2 SDIO_CMD +#define SDIO_D0_PIN 23 // PC8 SDIO_D0 +#define SDIO_D1_PIN 24 // PC9 SDIO_D1 +//#define SD_CARD_DETECT_PIN 25 // PA15 SD_CARD_DETECT +#define SDIO_D2_PIN 26 // PC10 SDIO_D2 +#define SDIO_D3_PIN 27 // PC11 SDIO_D3 +#define SDIO_CK_PIN 28 // PC12 SDIO_CK +#define SDIO_CMD_PIN 29 // PD2 SDIO_CMD -#define SOFTWARE_SPI // Use soft SPI for onboard SD -#define SDSS 27 // PC11 SDIO_D3 -#define SCK_PIN 28 // PC12 SDIO_CK -#define MISO_PIN 23 // PC8 SDIO_D0 -#define MOSI_PIN 29 // PD2 SDIO_CMD +#if !defined(SDCARD_CONNECTION) || SDCARD_CONNECTION == ONBOARD + #define SDIO_SUPPORT // Use SDIO for onboard SD + + #ifndef SDIO_SUPPORT + #define SOFTWARE_SPI // Use soft SPI for onboard SD + #define SDSS SDIO_D3_PIN + #define SCK_PIN SDIO_CK_PIN + #define MISO_PIN SDIO_D0_PIN + #define MOSI_PIN SDIO_CMD_PIN + #endif +#endif // OTG // 30 // PA11 OTG_DM diff --git a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h index 5cee7888b9..ffdb81a636 100644 --- a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h +++ b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h @@ -195,7 +195,7 @@ extern "C" { #define PIN_SERIAL2_RX PD6 #define PIN_SERIAL2_TX PD5 #else - #error'Invaqlid setting for SERIAL_UART_INSTANCE' + #error'Invalid setting for SERIAL_UART_INSTANCE' #endif // Timer Definitions diff --git a/buildroot/share/tests/BIGTREE_BTT002-tests b/buildroot/share/tests/BIGTREE_BTT002-tests index 45366e3f5a..858957154d 100644 --- a/buildroot/share/tests/BIGTREE_BTT002-tests +++ b/buildroot/share/tests/BIGTREE_BTT002-tests @@ -10,7 +10,7 @@ set -e # Build with the default configurations # restore_configs -opt_set MOTHERBOARD BOARD_BIGTREE_BTT002_V1_0 +opt_set MOTHERBOARD BOARD_BTT_BTT002_V1_0 opt_set SERIAL_PORT 1 exec_test $1 $2 "BigTreeTech BTT002 Default Configuration" diff --git a/buildroot/share/tests/BIGTREE_SKR_PRO-tests b/buildroot/share/tests/BIGTREE_SKR_PRO-tests index ef4dc60610..094e01d9c7 100644 --- a/buildroot/share/tests/BIGTREE_SKR_PRO-tests +++ b/buildroot/share/tests/BIGTREE_SKR_PRO-tests @@ -10,7 +10,7 @@ set -e # Build with the default configurations # restore_configs -opt_set MOTHERBOARD BOARD_BIGTREE_SKR_PRO_V1_1 +opt_set MOTHERBOARD BOARD_BTT_SKR_PRO_V1_1 opt_set SERIAL_PORT 1 exec_test $1 $2 "BigTreeTech SKR Pro Default Configuration" diff --git a/buildroot/share/tests/STM32F103RC_bigtree_USB-tests b/buildroot/share/tests/STM32F103RC_bigtree_USB-tests index 06b7465a66..8f7fff0b32 100644 --- a/buildroot/share/tests/STM32F103RC_bigtree_USB-tests +++ b/buildroot/share/tests/STM32F103RC_bigtree_USB-tests @@ -10,7 +10,7 @@ set -e # Build with the default configurations # restore_configs -opt_set MOTHERBOARD BOARD_BIGTREE_SKR_MINI_V1_1 +opt_set MOTHERBOARD BOARD_BTT_SKR_MINI_V1_1 opt_set SERIAL_PORT 1 opt_set SERIAL_PORT_2 -1 exec_test $1 $2 "BigTreeTech SKR Mini v1.1 - Basic Configuration" diff --git a/buildroot/share/tests/STM32F103RE_bigtree-tests b/buildroot/share/tests/STM32F103RE_bigtree-tests index e516b96aac..77751d776e 100644 --- a/buildroot/share/tests/STM32F103RE_bigtree-tests +++ b/buildroot/share/tests/STM32F103RE_bigtree-tests @@ -10,7 +10,7 @@ set -e # Build with the default configurations # restore_configs -opt_set MOTHERBOARD BOARD_BIGTREE_SKR_E3_DIP +opt_set MOTHERBOARD BOARD_BTT_SKR_E3_DIP opt_set SERIAL_PORT 1 opt_set SERIAL_PORT_2 -1 exec_test $1 $2 "BigTreeTech SKR E3 DIP v1.0 - Basic Configuration" diff --git a/buildroot/share/tests/STM32F103RE_bigtree_USB-tests b/buildroot/share/tests/STM32F103RE_bigtree_USB-tests index e516b96aac..77751d776e 100644 --- a/buildroot/share/tests/STM32F103RE_bigtree_USB-tests +++ b/buildroot/share/tests/STM32F103RE_bigtree_USB-tests @@ -10,7 +10,7 @@ set -e # Build with the default configurations # restore_configs -opt_set MOTHERBOARD BOARD_BIGTREE_SKR_E3_DIP +opt_set MOTHERBOARD BOARD_BTT_SKR_E3_DIP opt_set SERIAL_PORT 1 opt_set SERIAL_PORT_2 -1 exec_test $1 $2 "BigTreeTech SKR E3 DIP v1.0 - Basic Configuration"