From ae3b00db74c63e51e6e73e4a452468dda9abab1f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 21 May 2023 17:35:41 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fall=20back?= =?UTF-8?q?=20to=20SPI0=20with=20YHCB2004=20(#25856)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/fastio/fastio_1280.h | 49 +++++++++---------- Marlin/src/HAL/AVR/fastio/fastio_1281.h | 35 ++++++------- Marlin/src/HAL/AVR/fastio/fastio_168.h | 26 +++++----- Marlin/src/HAL/AVR/fastio/fastio_644.h | 38 +++++++------- Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h | 11 ++--- Marlin/src/HAL/DUE/fastio.h | 8 +-- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 18 ++++++- Marlin/src/pins/mega/pins_GT2560_V3.h | 16 ++---- Marlin/src/pins/mega/pins_GT2560_V3_A20.h | 14 ++++-- Marlin/src/pins/mega/pins_GT2560_V4_A20.h | 14 ++++-- Marlin/src/pins/pins.h | 2 +- .../src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h | 2 +- 12 files changed, 118 insertions(+), 115 deletions(-) diff --git a/Marlin/src/HAL/AVR/fastio/fastio_1280.h b/Marlin/src/HAL/AVR/fastio/fastio_1280.h index 6f074cf911..633774dda9 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_1280.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_1280.h @@ -35,39 +35,36 @@ #include "../fastio.h" -// change for your board -#define DEBUG_LED DIO21 - // UART -#define RXD DIO0 -#define TXD DIO1 +#define RXD 0 +#define TXD 1 // SPI -#define SCK DIO52 -#define MISO DIO50 -#define MOSI DIO51 -#define SS DIO53 +#define MISO 50 +#define MOSI 51 +#define SCK 52 +#define SS 53 // TWI (I2C) -#define SCL DIO21 -#define SDA DIO20 +#define SCL 21 +#define SDA 20 // Timers and PWM -#define OC0A DIO13 -#define OC0B DIO4 -#define OC1A DIO11 -#define OC1B DIO12 -#define OC2A DIO10 -#define OC2B DIO9 -#define OC3A DIO5 -#define OC3B DIO2 -#define OC3C DIO3 -#define OC4A DIO6 -#define OC4B DIO7 -#define OC4C DIO8 -#define OC5A DIO46 -#define OC5B DIO45 -#define OC5C DIO44 +#define OC0A 13 +#define OC0B 4 +#define OC1A 11 +#define OC1B 12 +#define OC2A 10 +#define OC2B 9 +#define OC3A 5 +#define OC3B 2 +#define OC3C 3 +#define OC4A 6 +#define OC4B 7 +#define OC4C 8 +#define OC5A 46 +#define OC5B 45 +#define OC5C 44 // Digital I/O diff --git a/Marlin/src/HAL/AVR/fastio/fastio_1281.h b/Marlin/src/HAL/AVR/fastio/fastio_1281.h index 812586225d..6067248978 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_1281.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_1281.h @@ -33,32 +33,29 @@ #include "../fastio.h" -// change for your board -#define DEBUG_LED DIO46 - // UART -#define RXD DIO0 -#define TXD DIO1 +#define RXD 0 +#define TXD 1 // SPI -#define SCK DIO10 -#define MISO DIO12 -#define MOSI DIO11 -#define SS DIO16 +#define SCK 10 +#define MISO 12 +#define MOSI 11 +#define SS 16 // TWI (I2C) -#define SCL DIO17 -#define SDA DIO18 +#define SCL 17 +#define SDA 18 // Timers and PWM -#define OC0A DIO9 -#define OC0B DIO4 -#define OC1A DIO7 -#define OC1B DIO8 -#define OC2A DIO6 -#define OC3A DIO5 -#define OC3B DIO2 -#define OC3C DIO3 +#define OC0A 9 +#define OC0B 4 +#define OC1A 7 +#define OC1B 8 +#define OC2A 6 +#define OC3A 5 +#define OC3B 2 +#define OC3C 3 // Digital I/O diff --git a/Marlin/src/HAL/AVR/fastio/fastio_168.h b/Marlin/src/HAL/AVR/fastio/fastio_168.h index 4f591b37b9..cc55979740 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_168.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_168.h @@ -33,29 +33,27 @@ #include "../fastio.h" -#define DEBUG_LED AIO5 - // UART -#define RXD DIO0 -#define TXD DIO1 +#define RXD 0 +#define TXD 1 // SPI -#define SCK DIO13 -#define MISO DIO12 -#define MOSI DIO11 -#define SS DIO10 +#define SS 10 +#define MOSI 11 +#define MISO 12 +#define SCK 13 // TWI (I2C) #define SCL AIO5 #define SDA AIO4 // Timers and PWM -#define OC0A DIO6 -#define OC0B DIO5 -#define OC1A DIO9 -#define OC1B DIO10 -#define OC2A DIO11 -#define OC2B DIO3 +#define OC0A 6 +#define OC0B 5 +#define OC1A 9 +#define OC1B 10 +#define OC2A 11 +#define OC2B 3 // Digital I/O diff --git a/Marlin/src/HAL/AVR/fastio/fastio_644.h b/Marlin/src/HAL/AVR/fastio/fastio_644.h index 16bdc6a23d..94b322a819 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_644.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_644.h @@ -59,34 +59,32 @@ #include "../fastio.h" -#define DEBUG_LED DIO0 - // UART -#define RXD DIO8 -#define TXD DIO9 -#define RXD0 DIO8 -#define TXD0 DIO9 +#define RXD 8 +#define TXD 9 +#define RXD0 8 +#define TXD0 9 -#define RXD1 DIO10 -#define TXD1 DIO11 +#define RXD1 10 +#define TXD1 11 // SPI -#define SCK DIO7 -#define MISO DIO6 -#define MOSI DIO5 -#define SS DIO4 +#define SS 4 +#define MOSI 5 +#define MISO 6 +#define SCK 7 // TWI (I2C) -#define SCL DIO16 -#define SDA DIO17 +#define SCL 16 +#define SDA 17 // Timers and PWM -#define OC0A DIO3 -#define OC0B DIO4 -#define OC1A DIO13 -#define OC1B DIO12 -#define OC2A DIO15 -#define OC2B DIO14 +#define OC0A 3 +#define OC0B 4 +#define OC1A 13 +#define OC1B 12 +#define OC2A 15 +#define OC2B 14 // Digital I/O diff --git a/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h b/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h index d2a8aca6f3..0c434b157c 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h @@ -34,14 +34,11 @@ #include "../fastio.h" -// change for your board -#define DEBUG_LED DIO31 /* led D5 red */ - // SPI -#define SCK DIO21 // 9 -#define MISO DIO23 // 11 -#define MOSI DIO22 // 10 -#define SS DIO20 // 8 +#define SS 20 // 8 +#define SCK 21 // 9 +#define MOSI 22 // 10 +#define MISO 23 // 11 // Digital I/O diff --git a/Marlin/src/HAL/DUE/fastio.h b/Marlin/src/HAL/DUE/fastio.h index a609210d81..77bc1911d8 100644 --- a/Marlin/src/HAL/DUE/fastio.h +++ b/Marlin/src/HAL/DUE/fastio.h @@ -189,12 +189,12 @@ */ // UART -#define RXD DIO0 -#define TXD DIO1 +#define RXD 0 +#define TXD 1 // TWI (I2C) -#define SCL DIO21 -#define SDA DIO20 +#define SCL 21 +#define SDA 20 /** * pins diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index a0cf5fe46b..b03ff8a9f5 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -103,7 +103,23 @@ #elif ENABLED(YHCB2004) - LCD_CLASS lcd(YHCB2004_CLK, 20, 4, YHCB2004_MOSI, YHCB2004_MISO); // CLK, cols, rows, MOSI, MISO + #ifndef YHCB2004_SS_PIN + #define YHCB2004_SS_PIN SS + #endif + #ifndef YHCB2004_SCK_PIN + #define YHCB2004_SCK_PIN SCK + #endif + #ifndef YHCB2004_MOSI_PIN + #define YHCB2004_MOSI_PIN MOSI + #endif + #ifndef YHCB2004_MISO_PIN + #define YHCB2004_MISO_PIN MISO + #endif + #if !PINS_EXIST(YHCB2004_SS, YHCB2004_SCK, YHCB2004_MOSI, YHCB2004_MISO) + #error "YHCB2004 display requires YHCB2004_SS_PIN, YHCB2004_SCK_PIN, YHCB2004_MOSI_PIN, and YHCB2004_MISO_PIN." + #endif + + LCD_CLASS lcd(YHCB2004_SS_PIN, 20, 4, YHCB2004_SCK_PIN, YHCB2004_MOSI_PIN, YHCB2004_MISO_PIN); // SS, cols, rows, SCK, MOSI, MISO #else diff --git a/Marlin/src/pins/mega/pins_GT2560_V3.h b/Marlin/src/pins/mega/pins_GT2560_V3.h index 61f30fc7d4..0c588e6516 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V3.h +++ b/Marlin/src/pins/mega/pins_GT2560_V3.h @@ -168,18 +168,10 @@ #define BEEPER_PIN 18 #if ENABLED(YHCB2004) - #ifndef YHCB2004_CLK - #define YHCB2004_CLK 5 - #define DIO52 YHCB2004_CLK - #endif - #ifndef YHCB2004_MOSI - #define YHCB2004_MOSI 21 - #define DIO50 YHCB2004_MOSI - #endif - #ifndef YHCB2004_MISO - #define YHCB2004_MISO 36 - #define DIO51 YHCB2004_MISO - #endif + #define YHCB2004_MOSI_PIN 21 + #define YHCB2004_MISO_PIN 36 + #define YHCB2004_SCK_PIN 5 + #define YHCB2004_SS_PIN SS #elif HAS_WIRED_LCD #ifndef LCD_PINS_RS #define LCD_PINS_RS 20 diff --git a/Marlin/src/pins/mega/pins_GT2560_V3_A20.h b/Marlin/src/pins/mega/pins_GT2560_V3_A20.h index 772a45a918..2422dfdd73 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V3_A20.h +++ b/Marlin/src/pins/mega/pins_GT2560_V3_A20.h @@ -26,12 +26,16 @@ * ATmega2560 */ -#define LCD_PINS_RS 5 -#define LCD_PINS_EN 36 -#define LCD_PINS_D4 21 -#define LCD_PINS_D7 6 +#if HAS_WIRED_LCD + #define LCD_PINS_RS 5 + #define LCD_PINS_EN 36 + #define LCD_PINS_D4 21 + #define LCD_PINS_D7 6 +#endif -#define SPEAKER // The speaker can produce tones +#ifndef SPEAKER + #define SPEAKER // The speaker can produce tones +#endif #if IS_NEWPANEL #define BTN_EN1 16 diff --git a/Marlin/src/pins/mega/pins_GT2560_V4_A20.h b/Marlin/src/pins/mega/pins_GT2560_V4_A20.h index 3b3a80caa8..405a3aba5b 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V4_A20.h +++ b/Marlin/src/pins/mega/pins_GT2560_V4_A20.h @@ -28,12 +28,16 @@ #define BOARD_INFO_NAME "GT2560 4.x" -#define LCD_PINS_RS 5 -#define LCD_PINS_EN 36 -#define LCD_PINS_D4 21 -#define LCD_PINS_D7 6 +#if HAS_WIRED_LCD + #define LCD_PINS_RS 5 + #define LCD_PINS_EN 36 + #define LCD_PINS_D4 21 + #define LCD_PINS_D7 6 +#endif -#define SPEAKER // The speaker can produce tones +#ifndef SPEAKER + #define SPEAKER // The speaker can produce tones +#endif #if IS_NEWPANEL #define BTN_EN1 16 diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 5118700533..6ee6401bad 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -795,7 +795,7 @@ #elif MB(BLACKPILL_CUSTOM) #include "stm32f4/pins_BLACKPILL_CUSTOM.h" // STM32F4 env:STM32F401CD_blackpill_stlink #elif MB(I3DBEEZ9_V1) - #include "stm32f4/pins_I3DBEEZ9.h" // STM32F4 env:I3DBEEZ9_V1 + #include "stm32f4/pins_I3DBEEZ9.h" // STM32F4 env:I3DBEEZ9_V1 // // ARM Cortex M7 diff --git a/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h b/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h index 9049a553fb..039333adfa 100644 --- a/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h +++ b/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h @@ -117,7 +117,7 @@ //#define SDIO_SUPPORT #define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer -#if SD_CONNECTION_IS(ONBOARD) +#if SD_CONNECTION_IS(ONBOARD) #define SDSS PA4 #define SD_SCK_PIN PA5 #define SD_MISO_PIN PA6