1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* lcd/dogm/marlinui_DOGM.h
*/
#include "../../inc/MarlinConfigPre.h"
#include <U8glib.h>
#include "HAL_LCD_class_defines.h"
//#define ALTERNATIVE_LCD
#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
// RepRapWorld Graphical LCD
#define U8G_CLASS U8GLIB_ST7920_128X64_4X
#if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN) && (LCD_PINS_ENABLE == SD_MOSI_PIN)
#define U8G_PARAM LCD_PINS_RS
#else
#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS
#endif
#elif ENABLED(U8GLIB_ST7920)
// RepRap Discount Full Graphics Smart Controller
// and other variant LCDs using ST7920
#if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN) && (LCD_PINS_ENABLE == SD_MOSI_PIN)
#define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL // 2 stripes, HW SPI (Shared with SD card. Non-standard LCD adapter on AVR.)
#define U8G_PARAM LCD_PINS_RS
#else
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_ST7920_128X64_4X // 2 stripes, SW SPI (Original u8glib device)
#else
#define U8G_CLASS U8GLIB_ST7920_128X64_RRD // Adjust stripes with PAGE_HEIGHT in ultralcd_st7920_u8glib_rrd.h
#endif
#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS // AVR version ignores these pin settings
// HAL version uses these pin settings
#endif
#elif ENABLED(CARTESIO_UI)
// CartesioUI LCD
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_DOGM128_2X // 4 stripes
#define FORCE_SOFT_SPI // SW-SPI
#else
#define U8G_CLASS U8GLIB_DOGM128_2X // 4 stripes (HW-SPI)
#endif
#elif ENABLED(U8GLIB_LM6059_AF)
// Based on the Adafruit ST7565 (https://www.adafruit.com/products/250)
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_LM6059 // 8 stripes (HW-SPI)
#else
#define U8G_CLASS U8GLIB_LM6059_2X // 4 stripes (HW-SPI)
#endif
#elif ENABLED(U8GLIB_ST7565_64128N)
// MaKrPanel, Mini Viki, Viki 2.0, AZSMZ 12864 ST7565 controller
#define SMART_RAMPS MB(RAMPS_SMART_EFB, RAMPS_SMART_EEB, RAMPS_SMART_EFF, RAMPS_SMART_EEF, RAMPS_SMART_SF)
#define U8G_CLASS U8GLIB_64128N_2X_HAL // 4 stripes (HW-SPI)
#if SMART_RAMPS || DOGLCD_SCK != SD_SCK_PIN || DOGLCD_MOSI != SD_MOSI_PIN
#define FORCE_SOFT_SPI // SW-SPI
#endif
#elif ANY(FYSETC_MINI_12864, MKS_MINI_12864, ENDER2_STOCKDISPLAY)
// The FYSETC Mini 12864 display // "4 stripes"
// The MKS_MINI_12864 V1/V2 aren't exact copies of the MiniPanel.
// Panel management is in u8g_dev_uc1701_mini12864_HAL.cpp with
// extra delays added to remove glitches seen with fast MCUs.
#define U8G_CLASS U8GLIB_MINI12864_2X_HAL // 8 stripes (HW-SPI)
#elif ENABLED(MINIPANEL)
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_MINI12864
#else
#define U8G_CLASS U8GLIB_MINI12864_2X // 8 stripes (HW-SPI)
#endif
#elif ENABLED(MKS_12864OLED_SSD1306)
// MKS 128x64 (SSD1306) OLED I2C LCD
#define FORCE_SOFT_SPI // SW-SPI
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes
#else
#define U8G_CLASS U8GLIB_SSD1306_128X64 // 8 stripes
#endif
#elif ENABLED(FYSETC_242_OLED_12864)
// FYSETC OLED 2.42" 128 × 64 FULL GRAPHICS CONTROLLER
#define FORCE_SOFT_SPI // SW-SPI
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes
#else
#define U8G_CLASS U8GLIB_SSD1309_128X64_HAL
#endif
#elif ENABLED(ZONESTAR_12864OLED_SSD1306)
// Zonestar SSD1306 OLED SPI LCD
#define FORCE_SOFT_SPI // SW-SPI
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_SH1306_128X64_2X // 4 stripes
#else
#define U8G_CLASS U8GLIB_SH1306_128X64 // 8 stripes
#endif
#elif EITHER(MKS_12864OLED, ZONESTAR_12864OLED)
// MKS 128x64 (SH1106) OLED I2C LCD
// - or -
// Zonestar SH1106 OLED SPI LCD
#define FORCE_SOFT_SPI // SW-SPI
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_SH1106_128X64_2X // 4 stripes
#else
#define U8G_CLASS U8GLIB_SH1106_128X64 // 8 stripes
#endif
#elif ENABLED(U8GLIB_SH1106_EINSTART)
// Connected via motherboard header
#define U8G_CLASS U8GLIB_SH1106_128X64
#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS
#elif ENABLED(U8GLIB_SH1106)
// Generic SH1106 OLED I2C LCD
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE // 4 stripes
#else
#define U8G_CLASS U8GLIB_SH1106_128X64_2X // 4 stripes
#endif
#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // I2C
#elif ENABLED(U8GLIB_SSD1309)
// Generic support for SSD1309 OLED I2C LCDs
#define U8G_CLASS U8GLIB_SSD1309_128X64
#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // I2C
#elif ENABLED(U8GLIB_SSD1306)
// Generic SSD1306 OLED I2C LCD
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE // 4 stripes
#else
#define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes
#endif
#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)
#elif TFT_SCALED_DOGLCD
// Unspecified 320x240 TFT pre-initialized by built-in bootloader
#define U8G_CLASS U8GLIB_TFT_320X240_UPSCALE_FROM_128X64
#if HAS_FSMC_GRAPHICAL_TFT
#define U8G_PARAM FSMC_CS_PIN, FSMC_RS_PIN
#else
#define U8G_PARAM -1, -1
#endif
#else
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_DOGM128 // 8 stripes (HW-SPI)
#else
#define U8G_CLASS U8GLIB_DOGM128_2X // 4 stripes (HW-SPI)
#endif
#endif
// Use HW-SPI if no other option is specified
#ifndef U8G_PARAM
#if ENABLED(FORCE_SOFT_SPI)
#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // SW-SPI
#else
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI
#endif
#endif
// For selective rendering within a Y range
#define PAGE_OVER(ya) ((ya) <= u8g.getU8g()->current_page.y1) // Does the current page follow a region top?
#define PAGE_UNDER(yb) ((yb) >= u8g.getU8g()->current_page.y0) // Does the current page precede a region bottom?
#define PAGE_CONTAINS(ya, yb) ((yb) >= u8g.getU8g()->current_page.y0 && (ya) <= u8g.getU8g()->current_page.y1) // Do two vertical regions overlap?
extern U8G_CLASS u8g;
|