From 64ad96e19ea2cafd396bea4ef7632aa006e4386c Mon Sep 17 00:00:00 2001
From: Luu Lac <45380455+shitcreek@users.noreply.github.com>
Date: Thu, 6 May 2021 04:52:18 -0500
Subject: [PATCH] TFT SPI for BTT SKR v1.3 (#21794)

---
 Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h | 69 ++++++++++++++++++++-
 Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h |  4 --
 2 files changed, 68 insertions(+), 5 deletions(-)

diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h
index 981006fd90..557a4c4c65 100644
--- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h
+++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h
@@ -267,8 +267,75 @@
 
     #error "ADC BUTTONS do not work unmodifed on SKR 1.3, The ADC ports cannot take more than 3.3v."
 
-  #elif IS_TFTGLCD_PANEL
+  #elif HAS_SPI_TFT                               // Config for Classic UI (emulated DOGM) and Color UI
 
+    #define TFT_A0_PIN               EXP1_03_PIN
+    #define TFT_DC_PIN               EXP1_03_PIN
+    #define TFT_CS_PIN               EXP1_04_PIN
+    #define TFT_RESET_PIN            EXP1_07_PIN
+    #define TFT_BACKLIGHT_PIN        EXP1_08_PIN
+
+    #define TFT_RST_PIN              EXP2_04_PIN
+    #define TFT_MOSI_PIN             EXP2_05_PIN
+    #define TFT_SCK_PIN              EXP2_09_PIN
+    #define TFT_MISO_PIN             EXP2_10_PIN
+
+    #define TOUCH_INT_PIN            EXP1_05_PIN
+    #define TOUCH_CS_PIN             EXP1_06_PIN
+
+    #define TOUCH_MOSI_PIN           EXP2_05_PIN
+    #define TOUCH_SCK_PIN            EXP2_09_PIN
+    #define TOUCH_MISO_PIN           EXP2_10_PIN
+
+    #define BTN_EN2                  EXP2_06_PIN
+    #define BTN_EN1                  EXP2_08_PIN
+    #define BTN_ENC                  EXP1_09_PIN
+
+    #define TOUCH_BUTTONS_HW_SPI
+    #define TOUCH_BUTTONS_HW_SPI_DEVICE        1
+
+    #define TFT_BUFFER_SIZE                 2400
+
+    #ifndef TFT_WIDTH
+      #define TFT_WIDTH                      480
+    #endif
+    #ifndef TFT_HEIGHT
+      #define TFT_HEIGHT                     320
+    #endif
+
+    #define LCD_READ_ID                     0xD3
+    #define LCD_USE_DMA_SPI
+
+    #if ENABLED(TFT_CLASSIC_UI)
+      #ifndef TOUCH_CALIBRATION_X
+        #define TOUCH_CALIBRATION_X       -11386
+      #endif
+      #ifndef TOUCH_CALIBRATION_Y
+        #define TOUCH_CALIBRATION_Y         8684
+      #endif
+      #ifndef TOUCH_OFFSET_X
+        #define TOUCH_OFFSET_X               689
+      #endif
+      #ifndef TOUCH_OFFSET_Y
+        #define TOUCH_OFFSET_Y              -273
+      #endif
+    #elif ENABLED(TFT_COLOR_UI)
+      #ifndef TOUCH_CALIBRATION_X
+        #define TOUCH_CALIBRATION_X       -16741
+      #endif
+      #ifndef TOUCH_CALIBRATION_Y
+        #define TOUCH_CALIBRATION_Y        11258
+      #endif
+      #ifndef TOUCH_OFFSET_X
+        #define TOUCH_OFFSET_X              1024
+      #endif
+      #ifndef TOUCH_OFFSET_Y
+        #define TOUCH_OFFSET_Y              -367
+      #endif
+      #define TFT_BUFFER_SIZE               2400
+    #endif
+
+  #elif IS_TFTGLCD_PANEL
     #if ENABLED(TFTGLCD_PANEL_SPI)
       #define TFTGLCD_CS             EXP2_08_PIN
     #endif
diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h
index 4451fc9b02..aa94bc935d 100644
--- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h
+++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h
@@ -402,10 +402,6 @@
     #define SD_MISO_PIN              EXP2_10_PIN
     #define SD_MOSI_PIN              EXP2_05_PIN
 
-    // Disable any LCD related PINs config
-    #define LCD_PINS_ENABLE                -1
-    #define LCD_PINS_RS                    -1
-
     #define TFT_BUFFER_SIZE                 2400
 
   #elif IS_TFTGLCD_PANEL