Browse Source

Don't compile custom u8g without DOGLCD

Scott Lahteine 7 years ago
parent
commit
81bc428b48

+ 5
- 0
Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp View File

@@ -69,6 +69,10 @@
69 69
  * beginning.
70 70
  */
71 71
 
72
+#include "../../inc/MarlinConfig.h"
73
+
74
+#if ENABLED(DOGLCD)
75
+
72 76
 #include <U8glib.h>
73 77
 #include "HAL_LCD_com_defines.h"
74 78
 
@@ -308,3 +312,4 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s
308 312
   return 1;
309 313
 }
310 314
 
315
+#endif // DOGLCD

+ 7
- 1
Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp View File

@@ -57,6 +57,10 @@
57 57
 
58 58
 */
59 59
 
60
+#include "../../inc/MarlinConfig.h"
61
+
62
+#if ENABLED(DOGLCD)
63
+
60 64
 #include <U8glib.h>
61 65
 
62 66
 #include "HAL_LCD_com_defines.h"
@@ -226,4 +230,6 @@ u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_sw_spi = { u8g_dev_st7565_64128n_HAL_2x_f
226 230
 
227 231
 
228 232
 U8G_PB_DEV(u8g_dev_st7565_64128n_HAL_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_64128n_HAL_fn, U8G_COM_HAL_HW_SPI_FN);
229
-u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_hw_spi = { u8g_dev_st7565_64128n_HAL_2x_fn, &u8g_dev_st7565_64128n_HAL_2x_pb, U8G_COM_HAL_HW_SPI_FN };
233
+u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_hw_spi = { u8g_dev_st7565_64128n_HAL_2x_fn, &u8g_dev_st7565_64128n_HAL_2x_pb, U8G_COM_HAL_HW_SPI_FN };
234
+
235
+#endif // DOGLCD

+ 6
- 0
Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp View File

@@ -56,6 +56,10 @@
56 56
 
57 57
 */
58 58
 
59
+#include "../../inc/MarlinConfig.h"
60
+
61
+#if ENABLED(DOGLCD)
62
+
59 63
 #include <U8glib.h>
60 64
 
61 65
 #include "HAL_LCD_com_defines.h"
@@ -200,3 +204,5 @@ u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi = { u8g_dev_st7920_128x64_HAL_4x_f
200 204
   // for the ST7920 for HAL systems no matter what is selected in ultralcd_impl_DOGM.h.
201 205
   u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_SW_SPI };
202 206
 #endif
207
+
208
+#endif // DOGLCD

+ 12
- 12
Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp View File

@@ -23,9 +23,13 @@
23 23
 // NOTE - the HAL version of the rrd device uses a generic ST7920 device.  See the
24 24
 // file u8g_dev_st7920_128x64_HAL.cpp for the HAL version.
25 25
 
26
+#include "../../inc/MarlinConfig.h"
27
+
28
+#if ENABLED(DOGLCD)
29
+
26 30
 #ifndef U8G_HAL_LINKS
27 31
 
28
-#include "../../Marlin.h"
32
+//#include "../../Marlin.h"
29 33
 
30 34
 //#if ENABLED(U8GLIB_ST7920)
31 35
 //#if ( ENABLED(SHARED_SPI) || !ENABLED(SHARED_SPI) && (defined(LCD_PINS_D4) &&  LCD_PINS_D4 >= 0) &&  (defined(LCD_PINS_ENABLE) &&  LCD_PINS_ENABLE >= 0))
@@ -97,18 +101,15 @@
97 101
   #define U8G_DELAY() u8g_10MicroDelay()
98 102
 #endif
99 103
 
100
-
101
-
102 104
 static void ST7920_WRITE_BYTE(uint8_t val) {
103 105
   for (uint8_t i = 0; i < 8; i++) {
104 106
     WRITE(ST7920_DAT_PIN, val & 0x80);
105 107
     WRITE(ST7920_CLK_PIN, HIGH);
106 108
     WRITE(ST7920_CLK_PIN, LOW);
107
-    val = val << 1;
109
+    val <<= 1;
108 110
   }
109 111
 }
110 112
 
111
-
112 113
 #define ST7920_SET_CMD()         { ST7920_WRITE_BYTE(0xF8); U8G_DELAY(); }
113 114
 #define ST7920_SET_DAT()         { ST7920_WRITE_BYTE(0xFA); U8G_DELAY(); }
114 115
 #define ST7920_WRITE_NIBBLES(a)     { ST7920_WRITE_BYTE((uint8_t)((a)&0xF0u)); ST7920_WRITE_BYTE((uint8_t)((a)<<4u)); U8G_DELAY(); }
@@ -118,17 +119,13 @@ static void ST7920_WRITE_BYTE(uint8_t val) {
118 119
 #define ST7920_CS()              { WRITE(ST7920_CS_PIN,1); U8G_DELAY(); }
119 120
 #define ST7920_NCS()             { WRITE(ST7920_CS_PIN,0); }
120 121
 
121
-
122
-
123 122
 uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
124 123
   uint8_t i, y;
125 124
   switch (msg) {
126 125
     case U8G_DEV_MSG_INIT: {
127 126
       OUT_WRITE(ST7920_CS_PIN, LOW);
128
-
129
-
130
-        OUT_WRITE(ST7920_DAT_PIN, LOW);
131
-        OUT_WRITE(ST7920_CLK_PIN, LOW);
127
+      OUT_WRITE(ST7920_DAT_PIN, LOW);
128
+      OUT_WRITE(ST7920_CLK_PIN, LOW);
132 129
 
133 130
       ST7920_CS();
134 131
       u8g_Delay(120);                 //initial delay for boot up
@@ -197,4 +194,7 @@ u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g
197 194
 
198 195
 //#endif //( ENABLED(SHARED_SPI) || !ENABLED(SHARED_SPI) && (defined(LCD_PINS_D4) &&  LCD_PINS_D4 >= 0) &&  (defined(LCD_PINS_ENABLE) &&  LCD_PINS_ENABLE >= 0))
199 196
 //#endif // U8GLIB_ST7920
200
-#endif // AVR
197
+
198
+#endif // U8G_HAL_LINKS
199
+
200
+#endif // DOGLCD

Loading…
Cancel
Save