Przeglądaj źródła

Fix STM32F1 SPI device init, MKS_LCD12864 (#19271)

Victor Oliveira 4 lat temu
rodzic
commit
486731162f
No account linked to committer's email address

+ 4
- 1
Marlin/src/HAL/STM32F1/SPI.cpp Wyświetl plik

@@ -40,6 +40,9 @@
40 40
 #include <boards.h>
41 41
 #include <wirish.h>
42 42
 
43
+#include "../../inc/MarlinConfig.h"
44
+#include "spi_pins.h"
45
+
43 46
 /** Time in ms for DMA receive timeout */
44 47
 #define DMA_TIMEOUT 100
45 48
 
@@ -710,6 +713,6 @@ static spi_baud_rate determine_baud_rate(spi_dev *dev, uint32_t freq) {
710 713
   return baud_rates[i];
711 714
 }
712 715
 
713
-SPIClass SPI(1);
716
+SPIClass SPI(SPI_DEVICE);
714 717
 
715 718
 #endif // __STM32F1__

+ 1
- 0
Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp Wyświetl plik

@@ -112,6 +112,7 @@ static const uint8_t u8g_dev_uc1701_mini12864_HAL_init_seq[] PROGMEM = {
112 112
   U8G_ESC_CS(1),              // enable chip
113 113
   UC1701_ALL_PIX(0),          // normal display
114 114
   U8G_ESC_CS(0),              // disable chip
115
+  U8G_ESC_DLY(150),           // delay 150 ms before sending any data
115 116
   U8G_ESC_END                 // end of sequence
116 117
 };
117 118
 

+ 28
- 32
Marlin/src/lcd/dogm/ultralcd_DOGM.cpp Wyświetl plik

@@ -240,39 +240,35 @@ bool MarlinUI::detected() { return true; }
240 240
 
241 241
 // Initialize or re-initialize the LCD
242 242
 void MarlinUI::init_lcd() {
243
-  #if DISABLED(MKS_LCD12864)
244
-
245
-    #if PIN_EXISTS(LCD_BACKLIGHT)
246
-      OUT_WRITE(LCD_BACKLIGHT_PIN, DISABLED(DELAYED_BACKLIGHT_INIT)); // Illuminate after reset or right away
247
-    #endif
248
-
249
-    #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306, FYSETC_242_OLED_12864, ZONESTAR_12864OLED)
250
-      SET_OUTPUT(LCD_PINS_DC);
251
-      #ifndef LCD_RESET_PIN
252
-        #define LCD_RESET_PIN LCD_PINS_RS
253
-      #endif
254
-    #endif
255
-
256
-    #if PIN_EXISTS(LCD_RESET)
257
-      // Perform a clean hardware reset with needed delays
258
-      OUT_WRITE(LCD_RESET_PIN, LOW);
259
-      _delay_ms(5);
260
-      WRITE(LCD_RESET_PIN, HIGH);
261
-      _delay_ms(5);
262
-      u8g.begin();
243
+  #if PIN_EXISTS(LCD_BACKLIGHT)
244
+    OUT_WRITE(LCD_BACKLIGHT_PIN, DISABLED(DELAYED_BACKLIGHT_INIT)); // Illuminate after reset or right away
245
+  #endif
246
+
247
+  #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306, FYSETC_242_OLED_12864, ZONESTAR_12864OLED)
248
+    SET_OUTPUT(LCD_PINS_DC);
249
+    #ifndef LCD_RESET_PIN
250
+      #define LCD_RESET_PIN LCD_PINS_RS
263 251
     #endif
264
-
265
-    #if PIN_EXISTS(LCD_BACKLIGHT) && ENABLED(DELAYED_BACKLIGHT_INIT)
266
-      WRITE(LCD_BACKLIGHT_PIN, HIGH);
267
-    #endif
268
-
269
-    TERN_(HAS_LCD_CONTRAST, refresh_contrast());
270
-
271
-    TERN_(LCD_SCREEN_ROT_90, u8g.setRot90());
272
-    TERN_(LCD_SCREEN_ROT_180, u8g.setRot180());
273
-    TERN_(LCD_SCREEN_ROT_270, u8g.setRot270());
274
-
275
-  #endif // !MKS_LCD12864
252
+  #endif
253
+
254
+  #if PIN_EXISTS(LCD_RESET)
255
+    // Perform a clean hardware reset with needed delays
256
+    OUT_WRITE(LCD_RESET_PIN, LOW);
257
+    _delay_ms(5);
258
+    WRITE(LCD_RESET_PIN, HIGH);
259
+    _delay_ms(5);
260
+    u8g.begin();
261
+  #endif
262
+
263
+  #if PIN_EXISTS(LCD_BACKLIGHT) && ENABLED(DELAYED_BACKLIGHT_INIT)
264
+    WRITE(LCD_BACKLIGHT_PIN, HIGH);
265
+  #endif
266
+
267
+  TERN_(HAS_LCD_CONTRAST, refresh_contrast());
268
+
269
+  TERN_(LCD_SCREEN_ROT_90, u8g.setRot90());
270
+  TERN_(LCD_SCREEN_ROT_180, u8g.setRot180());
271
+  TERN_(LCD_SCREEN_ROT_270, u8g.setRot270());
276 272
 
277 273
   uxg_SetUtf8Fonts(g_fontinfo, COUNT(g_fontinfo));
278 274
 }

+ 0
- 3
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h Wyświetl plik

@@ -33,7 +33,6 @@
33 33
 
34 34
 //#define DISABLE_DEBUG
35 35
 #define DISABLE_JTAG
36
-#define ENABLE_SPI2
37 36
 
38 37
 //
39 38
 // EEPROM
@@ -152,8 +151,6 @@
152 151
     #define DOGLCD_SCK                      PB13
153 152
     #define DOGLCD_MOSI                     PB15
154 153
 
155
-    #undef SHOW_BOOTSCREEN
156
-
157 154
   #else
158 155
 
159 156
     #define LCD_PINS_D4                     PA6

+ 0
- 2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h Wyświetl plik

@@ -115,8 +115,6 @@
115 115
     #define DOGLCD_SCK                      PB13
116 116
     #define DOGLCD_MOSI                     PB15
117 117
 
118
-    #undef SHOW_BOOTSCREEN
119
-
120 118
   #else                                           // !MKS_MINI_12864
121 119
 
122 120
     #define LCD_PINS_D4                     PA6

+ 0
- 4
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h Wyświetl plik

@@ -351,10 +351,6 @@
351 351
     #define DOGLCD_SCK                      PA5
352 352
     #define DOGLCD_MOSI                     PA7
353 353
 
354
-    // Required for MKS_MINI_12864 with this board
355
-    #define MKS_LCD12864B
356
-    #undef SHOW_BOOTSCREEN
357
-
358 354
   #else                                           // !MKS_MINI_12864
359 355
 
360 356
     #define LCD_PINS_D4                     PE14

Ładowanie…
Anuluj
Zapisz