Skip to content

Commit a2f024f

Browse files
authored
🔧 Rework MKS Monster8 pins (#26988)
1 parent e1d65cc commit a2f024f

File tree

1 file changed

+189
-100
lines changed

1 file changed

+189
-100
lines changed

Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h

Lines changed: 189 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -245,43 +245,120 @@
245245
#define EXP2_07_PIN PB11
246246
#define EXP2_08_PIN -1 // RESET
247247

248-
#if HAS_MEDIA
249-
#ifndef SDCARD_CONNECTION
248+
//
249+
// SD Support
250+
//
251+
#ifndef SDCARD_CONNECTION
252+
#if HAS_WIRED_LCD && DISABLED(NO_LCD_SDCARD)
253+
#define SDCARD_CONNECTION LCD
254+
#else
250255
#define SDCARD_CONNECTION ONBOARD
251256
#endif
252-
#if SD_CONNECTION_IS(ONBOARD)
253-
#define ENABLE_SPI3
254-
#define SD_SS_PIN -1
255-
#define SDSS PC9
256-
#define SD_SCK_PIN PC10
257-
#define SD_MISO_PIN PC11
258-
#define SD_MOSI_PIN PC12
259-
#define SD_DETECT_PIN PC4 // SD_DETECT_PIN doesn't work with NO_SD_HOST_DRIVE disabled
260-
#elif SD_CONNECTION_IS(LCD)
261-
#define ENABLE_SPI1
262-
#define SDSS EXP2_04_PIN
263-
#define SD_SCK_PIN EXP2_02_PIN
264-
#define SD_MISO_PIN EXP2_01_PIN
265-
#define SD_MOSI_PIN EXP2_06_PIN
266-
#define SD_DETECT_PIN EXP2_07_PIN
267-
#endif
268257
#endif
269258

270-
#if ANY(TFT_COLOR_UI, TFT_CLASSIC_UI)
271-
#define TFT_CS_PIN EXP1_07_PIN
259+
//
260+
// Onboard SD card
261+
// Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2
262+
//
263+
#if SD_CONNECTION_IS(ONBOARD)
264+
#define ENABLE_SPI3
265+
#define SD_SS_PIN -1
266+
#define SDSS PC9
267+
#define SD_SCK_PIN PC10
268+
#define SD_MISO_PIN PC11
269+
#define SD_MOSI_PIN PC12
270+
#define SD_DETECT_PIN PC4 // SD_DETECT_PIN doesn't work with NO_SD_HOST_DRIVE disabled
271+
#elif SD_CONNECTION_IS(LCD)
272+
#define ENABLE_SPI1
273+
#define SDSS EXP2_04_PIN
274+
#define SD_SCK_PIN EXP2_02_PIN
275+
#define SD_MISO_PIN EXP2_01_PIN
276+
#define SD_MOSI_PIN EXP2_06_PIN
277+
#define SD_DETECT_PIN EXP2_07_PIN
278+
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
279+
#error "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for BOARD_MKS_MONSTER8_V1/V2."
280+
#endif
281+
282+
#if HAS_WIRED_LCD
283+
284+
#define BEEPER_PIN EXP1_01_PIN
285+
#define BTN_ENC EXP1_02_PIN
286+
287+
#if ENABLED(CR10_STOCKDISPLAY)
288+
#define LCD_PINS_RS EXP1_07_PIN
289+
290+
#define BTN_EN1 EXP1_03_PIN
291+
#define BTN_EN2 EXP1_05_PIN
292+
293+
#define LCD_PINS_EN EXP1_08_PIN
294+
#define LCD_PINS_D4 EXP1_06_PIN
295+
296+
#else
297+
298+
#define LCD_PINS_EN EXP1_03_PIN
299+
#define LCD_PINS_RS EXP1_04_PIN
300+
301+
#define BTN_EN1 EXP2_03_PIN
302+
#define BTN_EN2 EXP2_05_PIN
303+
304+
// MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
305+
#if ENABLED(MKS_MINI_12864)
306+
307+
#define ENABLE_SPI1
308+
#define FORCE_SOFT_SPI
309+
#define DOGLCD_A0 EXP1_07_PIN
310+
#define DOGLCD_CS EXP1_06_PIN
311+
#define DOGLCD_SCK EXP2_02_PIN
312+
#define DOGLCD_MOSI EXP2_06_PIN
313+
//#define LCD_BACKLIGHT_PIN -1
314+
//#define LCD_RESET_PIN -1
315+
316+
#elif ENABLED(FYSETC_MINI_12864_2_1)
317+
318+
#define LCD_PINS_DC EXP1_04_PIN
319+
#define DOGLCD_CS EXP1_03_PIN
320+
#define DOGLCD_A0 LCD_PINS_DC
321+
#define LCD_BACKLIGHT_PIN -1
322+
#define LCD_RESET_PIN EXP1_05_PIN
323+
#define NEOPIXEL_PIN EXP1_06_PIN
324+
#define DOGLCD_MOSI EXP2_06_PIN
325+
#define DOGLCD_SCK EXP2_02_PIN
326+
#if SD_CONNECTION_IS(ONBOARD)
327+
#define FORCE_SOFT_SPI
328+
#endif
329+
//#define LCD_SCREEN_ROTATE 180 // 0, 90, 180, 270
330+
331+
#else
332+
333+
#define LCD_PINS_D4 EXP1_05_PIN
334+
#if IS_ULTIPANEL
335+
#define LCD_PINS_D5 EXP1_06_PIN
336+
#define LCD_PINS_D6 EXP1_07_PIN
337+
#define LCD_PINS_D7 EXP1_08_PIN
338+
#endif
339+
340+
#ifndef BOARD_ST7920_DELAY_1
341+
#define BOARD_ST7920_DELAY_1 96
342+
#endif
343+
#ifndef BOARD_ST7920_DELAY_2
344+
#define BOARD_ST7920_DELAY_2 48
345+
#endif
346+
#ifndef BOARD_ST7920_DELAY_3
347+
#define BOARD_ST7920_DELAY_3 600
348+
#endif
349+
350+
#endif
351+
#endif
352+
#endif // HAS_WIRED_LCD
353+
354+
#if HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI
355+
272356
#define TFT_SCK_PIN EXP2_02_PIN
273357
#define TFT_MISO_PIN EXP2_01_PIN
274358
#define TFT_MOSI_PIN EXP2_06_PIN
275-
#define TFT_DC_PIN EXP1_08_PIN
276-
#define TFT_A0_PIN TFT_DC_PIN
277-
278-
#define TFT_RESET_PIN EXP1_04_PIN
279-
280-
#define LCD_BACKLIGHT_PIN EXP1_03_PIN
281-
#define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN
282359

283-
#define TOUCH_BUTTONS_HW_SPI
284-
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1
360+
#define BTN_EN1 EXP2_03_PIN
361+
#define BTN_EN2 EXP2_05_PIN
285362

286363
#ifndef TFT_WIDTH
287364
#define TFT_WIDTH 480
@@ -290,85 +367,97 @@
290367
#define TFT_HEIGHT 320
291368
#endif
292369

293-
#define TOUCH_CS_PIN EXP1_05_PIN // SPI1_NSS
294-
#define TOUCH_SCK_PIN EXP2_02_PIN // SPI1_SCK
295-
#define TOUCH_MISO_PIN EXP2_01_PIN // SPI1_MISO
296-
#define TOUCH_MOSI_PIN EXP2_06_PIN // SPI1_MOSI
370+
#if ENABLED(BTT_TFT35_SPI_V1_0)
371+
372+
/**
373+
* ------ ------
374+
* BEEPER | 1 2 | LCD-BTN MISO | 1 2 | CLK
375+
* T_MOSI | 3 4 | T_CS LCD-ENCA | 3 4 | TFTCS
376+
* T_CLK | 5 6 T_MISO LCD-ENCB | 5 6 MOSI
377+
* PENIRQ | 7 8 | F_CS RS | 7 8 | RESET
378+
* GND | 9 10 | VCC GND | 9 10 | NC
379+
* ------ ------
380+
* EXP1 EXP2
381+
*
382+
* 480x320, 3.5", SPI Display with Rotary Encoder.
383+
* Stock Display for the BIQU B1 SE Series.
384+
* Schematic: https://github.com/bigtreetech/TFT35-SPI/blob/master/v1/Hardware/BTT%20TFT35-SPI%20V1-SCH.pdf
385+
*/
386+
#define TFT_CS_PIN EXP2_04_PIN
387+
#define TFT_DC_PIN EXP2_07_PIN
388+
#define TFT_A0_PIN TFT_DC_PIN
389+
390+
#define TOUCH_CS_PIN EXP1_04_PIN
391+
#define TOUCH_SCK_PIN EXP1_05_PIN
392+
#define TOUCH_MISO_PIN EXP1_06_PIN
393+
#define TOUCH_MOSI_PIN EXP1_03_PIN
394+
#define TOUCH_INT_PIN EXP1_07_PIN
395+
396+
#ifndef TOUCH_CALIBRATION_X
397+
#define TOUCH_CALIBRATION_X 17540
398+
#endif
399+
#ifndef TOUCH_CALIBRATION_Y
400+
#define TOUCH_CALIBRATION_Y -11388
401+
#endif
402+
#ifndef TOUCH_OFFSET_X
403+
#define TOUCH_OFFSET_X -21
404+
#endif
405+
#ifndef TOUCH_OFFSET_Y
406+
#define TOUCH_OFFSET_Y 337
407+
#endif
408+
#ifndef TOUCH_ORIENTATION
409+
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
410+
#endif
297411

298-
#define LCD_READ_ID 0xD3
299-
#define LCD_USE_DMA_SPI
412+
#elif ENABLED(MKS_TS35_V2_0)
300413

301-
#define TFT_BUFFER_WORDS 14400
414+
/** ------ ------
415+
* BEEPER | 1 2 | BTN_ENC SPI1_MISO | 1 2 | SPI1_SCK
416+
* TFT_BKL / LCD_EN | 3 4 | TFT_RESET / LCD_RS BTN_EN1 | 3 4 | SPI1_CS
417+
* TOUCH_CS / LCD_D4 | 5 6 TOUCH_INT / LCD_D5 BTN_EN2 | 5 6 SPI1_MOSI
418+
* SPI1_CS / LCD_D6 | 7 8 | SPI1_RS / LCD_D7 SPI1_RS | 7 8 | RESET
419+
* GND | 9 10 | VCC GND | 9 10 | VCC
420+
* ------ ------
421+
* EXP1 EXP2
422+
*/
423+
#define TFT_CS_PIN EXP1_07_PIN // SPI1_CS
424+
#define TFT_DC_PIN EXP1_08_PIN // SPI1_RS
425+
#define TFT_A0_PIN TFT_DC_PIN
302426

303-
#ifndef TOUCH_CALIBRATION_X
304-
#define TOUCH_CALIBRATION_X -17253
305-
#endif
306-
#ifndef TOUCH_CALIBRATION_Y
307-
#define TOUCH_CALIBRATION_Y 11579
308-
#endif
309-
#ifndef TOUCH_OFFSET_X
310-
#define TOUCH_OFFSET_X 514
311-
#endif
312-
#ifndef TOUCH_OFFSET_Y
313-
#define TOUCH_OFFSET_Y -24
314-
#endif
315-
#ifndef TOUCH_ORIENTATION
316-
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
317-
#endif
427+
#define TFT_RESET_PIN EXP1_04_PIN
318428

319-
#elif HAS_WIRED_LCD
320-
321-
#define LCD_PINS_EN EXP1_03_PIN
322-
#define LCD_PINS_RS EXP1_04_PIN
323-
#define LCD_BACKLIGHT_PIN -1
324-
325-
// MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
326-
#if ENABLED(MKS_MINI_12864)
327-
328-
#define ENABLE_SPI1
329-
#define FORCE_SOFT_SPI
330-
#define DOGLCD_A0 EXP1_07_PIN
331-
#define DOGLCD_CS EXP1_06_PIN
332-
#define DOGLCD_SCK EXP2_02_PIN
333-
#define DOGLCD_MOSI EXP2_06_PIN
334-
//#define LCD_BACKLIGHT_PIN -1
335-
//#define LCD_RESET_PIN -1
336-
337-
#elif ENABLED(FYSETC_MINI_12864_2_1)
338-
339-
#define LCD_PINS_DC EXP1_04_PIN
340-
#define DOGLCD_CS EXP1_03_PIN
341-
#define DOGLCD_A0 LCD_PINS_DC
342-
#define LCD_BACKLIGHT_PIN -1
343-
#define LCD_RESET_PIN EXP1_05_PIN
344-
#define NEOPIXEL_PIN EXP1_06_PIN
345-
#define DOGLCD_MOSI EXP2_06_PIN
346-
#define DOGLCD_SCK EXP2_02_PIN
347-
#if SD_CONNECTION_IS(ONBOARD)
348-
#define FORCE_SOFT_SPI
349-
#endif
350-
//#define LCD_SCREEN_ROTATE 180 // 0, 90, 180, 270
429+
#define LCD_BACKLIGHT_PIN EXP1_03_PIN
430+
#define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN
351431

352-
#else
432+
#define TOUCH_BUTTONS_HW_SPI
433+
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1
353434

354-
#define LCD_PINS_D4 EXP1_05_PIN
355-
#if IS_ULTIPANEL
356-
#define LCD_PINS_D5 EXP1_06_PIN
357-
#define LCD_PINS_D6 EXP1_07_PIN
358-
#define LCD_PINS_D7 EXP1_08_PIN
359-
#endif
435+
#define TOUCH_CS_PIN EXP1_05_PIN // SPI1_NSS
436+
#define TOUCH_SCK_PIN EXP2_02_PIN // SPI1_SCK
437+
#define TOUCH_MISO_PIN EXP2_01_PIN // SPI1_MISO
438+
#define TOUCH_MOSI_PIN EXP2_06_PIN // SPI1_MOSI
360439

361-
#define BOARD_ST7920_DELAY_1 96
362-
#define BOARD_ST7920_DELAY_2 48
363-
#define BOARD_ST7920_DELAY_3 600
440+
#define LCD_READ_ID 0xD3
441+
#define LCD_USE_DMA_SPI
364442

365-
#endif // !MKS_MINI_12864
443+
#define TFT_BUFFER_WORDS 14400
366444

367-
#endif // HAS_WIRED_LCD
445+
#ifndef TOUCH_CALIBRATION_X
446+
#define TOUCH_CALIBRATION_X -17253
447+
#endif
448+
#ifndef TOUCH_CALIBRATION_Y
449+
#define TOUCH_CALIBRATION_Y 11579
450+
#endif
451+
#ifndef TOUCH_OFFSET_X
452+
#define TOUCH_OFFSET_X 514
453+
#endif
454+
#ifndef TOUCH_OFFSET_Y
455+
#define TOUCH_OFFSET_Y -24
456+
#endif
457+
#ifndef TOUCH_ORIENTATION
458+
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
459+
#endif
460+
461+
#endif
368462

369-
#if ANY(TFT_COLOR_UI, TFT_CLASSIC_UI, HAS_WIRED_LCD)
370-
#define BEEPER_PIN EXP1_01_PIN
371-
#define BTN_EN1 EXP2_03_PIN
372-
#define BTN_EN2 EXP2_05_PIN
373-
#define BTN_ENC EXP1_02_PIN
374463
#endif

0 commit comments

Comments
 (0)