Browse Source

Fix STM32F1 SPI device init, MKS_LCD12864 (#19271)

Victor Oliveira 4 years ago
parent
commit
486731162f
No account linked to committer's email address

+ 4
- 1
Marlin/src/HAL/STM32F1/SPI.cpp View File

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

+ 1
- 0
Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp View File

112
   U8G_ESC_CS(1),              // enable chip
112
   U8G_ESC_CS(1),              // enable chip
113
   UC1701_ALL_PIX(0),          // normal display
113
   UC1701_ALL_PIX(0),          // normal display
114
   U8G_ESC_CS(0),              // disable chip
114
   U8G_ESC_CS(0),              // disable chip
115
+  U8G_ESC_DLY(150),           // delay 150 ms before sending any data
115
   U8G_ESC_END                 // end of sequence
116
   U8G_ESC_END                 // end of sequence
116
 };
117
 };
117
 
118
 

+ 28
- 32
Marlin/src/lcd/dogm/ultralcd_DOGM.cpp View File

240
 
240
 
241
 // Initialize or re-initialize the LCD
241
 // Initialize or re-initialize the LCD
242
 void MarlinUI::init_lcd() {
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
     #endif
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
   uxg_SetUtf8Fonts(g_fontinfo, COUNT(g_fontinfo));
273
   uxg_SetUtf8Fonts(g_fontinfo, COUNT(g_fontinfo));
278
 }
274
 }

+ 0
- 3
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h View File

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

+ 0
- 2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h View File

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

+ 0
- 4
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h View File

351
     #define DOGLCD_SCK                      PA5
351
     #define DOGLCD_SCK                      PA5
352
     #define DOGLCD_MOSI                     PA7
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
   #else                                           // !MKS_MINI_12864
354
   #else                                           // !MKS_MINI_12864
359
 
355
 
360
     #define LCD_PINS_D4                     PE14
356
     #define LCD_PINS_D4                     PE14

Loading…
Cancel
Save