Skip to content

Commit aa7d571

Browse files
authored
♻️ LCD pins migration precursor (MarlinFirmware#26719)
Preliminary changes for MarlinFirmware#25650
1 parent 604d3e8 commit aa7d571

File tree

84 files changed

+1886
-1197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1886
-1197
lines changed

Marlin/src/HAL/DUE/HAL_SPI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
// Public functions
4343
// ------------------------
4444

45-
#if ANY(DUE_SOFTWARE_SPI, FORCE_SOFT_SPI)
45+
#if ANY(SOFTWARE_SPI, FORCE_SOFT_SPI)
4646

4747
// ------------------------
4848
// Software SPI

Marlin/src/HAL/DUE/inc/SanityCheck.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@
7272

7373
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
7474
#if ENABLED(TMC_USE_SW_SPI)
75-
#if DISABLED(DUE_SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
75+
#if DISABLED(SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
7676
#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."
7777
#endif
78-
#elif ENABLED(DUE_SOFTWARE_SPI)
78+
#elif ENABLED(SOFTWARE_SPI)
7979
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
8080
#endif
8181
#endif

Marlin/src/HAL/DUE/spi_pins.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#define SD_MOSI_PIN 75
4949
#else
5050
// defaults
51-
#define DUE_SOFTWARE_SPI
51+
#define SOFTWARE_SPI
5252
#ifndef SD_SCK_PIN
5353
#define SD_SCK_PIN 52
5454
#endif

Marlin/src/HAL/LINUX/spi_pins.h

-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
*/
2222
#pragma once
2323

24-
#include "../../core/macros.h"
25-
#include "../../inc/MarlinConfigPre.h"
26-
2724
#if ALL(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
2825
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
2926
// needed due to the speed and mode required for communicating with each device being different.

Marlin/src/HAL/LPC1768/spi_pins.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
*/
2222
#pragma once
2323

24-
#include "../../core/macros.h"
25-
26-
#if ALL(HAS_MEDIA, HAS_MARLINUI_U8GLIB) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
24+
#if ALL(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
2725
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
2826
// needed due to the speed and mode required for communicating with each device being different.
2927
// This requirement can be removed if the SPI access to these devices is updated to use

Marlin/src/HAL/NATIVE_SIM/spi_pins.h

-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
*/
2222
#pragma once
2323

24-
#include "../../core/macros.h"
25-
#include "../../inc/MarlinConfigPre.h"
26-
2724
#if ALL(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
2825
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
2926
// needed due to the speed and mode required for communicating with each device being different.

Marlin/src/MarlinCore.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ inline void tmc_standby_setup() {
10631063
* - Init the buzzer, possibly a custom timer
10641064
* - Init more optional hardware:
10651065
* • Color LED illumination
1066-
* • Neopixel illumination
1066+
* • NeoPixel illumination
10671067
* • Controller Fan
10681068
* • Creality DWIN LCD (show boot image)
10691069
* • Tare the Probe if possible

Marlin/src/inc/Conditionals_LCD.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@
575575
#define MKS_MINI_12864
576576
#endif
577577

578-
// MKS_MINI_12864_V3 , BTT_MINI_12864 and BEEZ_MINI_12864 have identical pinouts to FYSETC_MINI_12864_2_1
578+
// MKS_MINI_12864_V3 , BTT_MINI_12864 and BEEZ_MINI_12864 are nearly identical to FYSETC_MINI_12864_2_1
579579
#if ANY(MKS_MINI_12864_V3, BTT_MINI_12864, BEEZ_MINI_12864)
580580
#define FYSETC_MINI_12864_2_1
581581
#endif

Marlin/src/inc/Conditionals_post.h

-12
Original file line numberDiff line numberDiff line change
@@ -3215,18 +3215,6 @@
32153215
#undef SOUND_ON_DEFAULT
32163216
#endif
32173217

3218-
/**
3219-
* Make sure DOGLCD_SCK and DOGLCD_MOSI are defined.
3220-
*/
3221-
#if HAS_MARLINUI_U8GLIB
3222-
#ifndef DOGLCD_SCK
3223-
#define DOGLCD_SCK SD_SCK_PIN
3224-
#endif
3225-
#ifndef DOGLCD_MOSI
3226-
#define DOGLCD_MOSI SD_MOSI_PIN
3227-
#endif
3228-
#endif
3229-
32303218
/**
32313219
* Z_CLEARANCE_FOR_HOMING / Z_CLEARANCE_BETWEEN_PROBES
32323220
*/

Marlin/src/lcd/dogm/marlinui_DOGM.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,6 @@ void MarlinUI::init_lcd() {
311311

312312
#if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306, FYSETC_242_OLED_12864, ZONESTAR_12864OLED, K3D_242_OLED_CONTROLLER)
313313
SET_OUTPUT(LCD_PINS_DC);
314-
#ifndef LCD_RESET_PIN
315-
#define LCD_RESET_PIN LCD_PINS_RS
316-
#endif
317314
#endif
318315

319316
#if PIN_EXISTS(LCD_RESET)

Marlin/src/lcd/dogm/marlinui_DOGM.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@
4040
#ifdef __SAMD21__
4141
#define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL
4242
#else
43+
// Hardware SPI on DUE
4344
#define U8G_CLASS U8GLIB_ST7920_128X64_4X
4445
#endif
4546
#define U8G_PARAM LCD_PINS_RS
4647
#elif (LCD_PINS_D4 == SD_SCK_PIN) && (LCD_PINS_EN == SD_MOSI_PIN)
48+
// Hardware SPI shared with SD Card
4749
#define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL
4850
#define U8G_PARAM LCD_PINS_RS
4951
#else
52+
// Software SPI
5053
#define U8G_CLASS U8GLIB_ST7920_128X64_4X
5154
#define U8G_PARAM LCD_PINS_D4, LCD_PINS_EN, LCD_PINS_RS
5255
#endif
@@ -97,7 +100,7 @@
97100
#define SMART_RAMPS MB(RAMPS_SMART_EFB, RAMPS_SMART_EEB, RAMPS_SMART_EFF, RAMPS_SMART_EEF, RAMPS_SMART_SF)
98101
#define U8G_CLASS U8GLIB_64128N_2X_HAL // 4 stripes (HW-SPI)
99102

100-
#if (SMART_RAMPS && defined(__SAM3X8E__)) || DOGLCD_SCK != SD_SCK_PIN || DOGLCD_MOSI != SD_MOSI_PIN
103+
#if (SMART_RAMPS && defined(__SAM3X8E__)) || (defined(DOGLCD_SCK) && (DOGLCD_SCK != -1 && DOGLCD_SCK != SD_SCK_PIN)) || (defined(DOGLCD_MOSI) && (DOGLCD_MOSI != -1 && DOGLCD_MOSI != SD_MOSI_PIN))
101104
#define FORCE_SOFT_SPI // SW-SPI
102105
#endif
103106

@@ -230,7 +233,7 @@
230233
#if ENABLED(FORCE_SOFT_SPI)
231234
#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // SW-SPI
232235
#else
233-
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI
236+
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI
234237
#endif
235238
#endif
236239

Marlin/src/module/settings.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ void MarlinSettings::postprocess() {
702702
if (oldpos != current_position)
703703
report_current_position();
704704

705-
// Moved as last update due to interference with Neopixel init
705+
// Moved as last update due to interference with NeoPixel init
706706
TERN_(HAS_LCD_CONTRAST, ui.refresh_contrast());
707707
TERN_(HAS_LCD_BRIGHTNESS, ui.refresh_brightness());
708708
TERN_(HAS_BACKLIGHT_TIMEOUT, ui.refresh_backlight_timeout());

Marlin/src/pins/esp32/pins_ENWI_ESPNP.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@
112112

113113
// #define FAN_SOFT_PWM_REQUIRED // check if needed
114114

115-
// Neopixel Rings
116-
#define NEOPIXEL_PIN 14
115+
// NeoPixel Rings
116+
#define BOARD_NEOPIXEL_PIN 14
117117
#define NEOPIXEL2_PIN 27
118118

119119
// SPI

Marlin/src/pins/esp32/pins_MKS_TINYBEE.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
* ------ ------
129129
* (BEEPER) 149 | 1 2 | 13 (BTN_ENC) (SPI MISO) 19 | 1 2 | 18 (SPI SCK)
130130
* (LCD_EN) 21 | 3 4 | 4 (LCD_RS) (BTN_EN1) 14 | 3 4 | 5 (SPI CS)
131-
* (LCD_D4) 0 5 6 | 16 (LCD_D5) (BTN_EN2) 12 5 6 | 23 (SPI MOSI)
131+
* (LCD_D4) 0 | 5 6 16 (LCD_D5) (BTN_EN2) 12 | 5 6 23 (SPI MOSI)
132132
* (LCD_D6) 15 | 7 8 | 17 (LCD_D7) (SPI_DET) 34 | 7 8 | RESET
133133
* GND | 9 10 | 5V GND | 9 10 | 3.3V
134134
* ------ ------
@@ -159,6 +159,8 @@
159159
//#define SD_MOSI_PIN EXP2_06_PIN // uses esp32 default 23
160160
//#define SD_MISO_PIN EXP2_01_PIN // uses esp32 default 19
161161
//#define SD_SCK_PIN EXP2_02_PIN // uses esp32 default 18
162+
163+
// TODO: Migrate external SD Card to pins/lcd
162164
#define SDSS EXP2_04_PIN
163165
#define SD_DETECT_PIN EXP2_07_PIN // IO34 default is SD_DET signal (Jump to SDDET)
164166
#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers

Marlin/src/pins/esp32/pins_PANDA_common.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
* (EN1) 33 | 3 4 | (5 SDSS?) (EN) 26 | 3 4 | 27 (RS)
8787
* (EN2) 32 5 6 | (23 MOSI?) (D4) 14 | 5 6 --
8888
* (SDDET 2?) | 7 8 | (RESET) -- | 7 8 | --
89-
* -- | 9 10 | -- (GND) | 9 10 | (5V)
89+
* -- | 9 10 | -- GND | 9 10 | 5V
9090
* ------ ------
9191
* EXP2 EXP1
9292
*/

0 commit comments

Comments
 (0)