My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ultralcd_DOGM.h 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * ultralcd_DOGM.h
  25. */
  26. #include "../../inc/MarlinConfigPre.h"
  27. #include <U8glib.h>
  28. #include "HAL_LCD_class_defines.h"
  29. // LCD selection
  30. #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
  31. #define U8G_CLASS U8GLIB_ST7920_128X64_4X
  32. #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
  33. #define U8G_PARAM LCD_PINS_RS
  34. #else
  35. #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS
  36. #endif
  37. #elif ENABLED(U8GLIB_ST7920)
  38. // RepRap Discount Full Graphics Smart Controller
  39. #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
  40. #define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL
  41. #define U8G_PARAM LCD_PINS_RS // 2 stripes, HW SPI (shared with SD card, on AVR does not use standard LCD adapter)
  42. #else
  43. //#define U8G_CLASS U8GLIB_ST7920_128X64_4X
  44. //#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS // Original u8glib device. 2 stripes, SW SPI
  45. #define U8G_CLASS U8GLIB_ST7920_128X64_RRD
  46. #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS // Number of stripes can be adjusted in ultralcd_st7920_u8glib_rrd.h with PAGE_HEIGHT
  47. // AVR version ignores these pin settings
  48. // HAL version uses these pin settings
  49. #endif
  50. #elif ENABLED(CARTESIO_UI)
  51. // The CartesioUI display
  52. //#define U8G_CLASS U8GLIB_DOGM128_2X
  53. //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes
  54. #define U8G_CLASS U8GLIB_DOGM128_2X
  55. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes
  56. #elif ENABLED(U8GLIB_LM6059_AF)
  57. // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
  58. //#define U8G_CLASS U8GLIB_LM6059
  59. //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes
  60. #define U8G_CLASS U8GLIB_LM6059_2X
  61. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes
  62. #elif ENABLED(U8GLIB_ST7565_64128N)
  63. // The MaKrPanel, Mini Viki, Viki 2.0 & AZSMZ 12864 ST7565 controller
  64. #define SMART_RAMPS (MB(RAMPS_SMART_EFB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_SMART_EFF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_SMART_SF))
  65. #if DOGLCD_SCK == SCK_PIN && DOGLCD_MOSI == MOSI_PIN && !SMART_RAMPS
  66. #define U8G_CLASS U8GLIB_64128N_2X_HAL
  67. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // using HW-SPI
  68. #else
  69. #define U8G_CLASS U8GLIB_64128N_2X_HAL
  70. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // using SW-SPI
  71. #endif
  72. #elif ENABLED(MKS_12864OLED_SSD1306)
  73. // MKS 128x64 (SSD1306) OLED I2C LCD
  74. #define U8G_CLASS U8GLIB_SSD1306_128X64
  75. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 8 stripes
  76. //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X
  77. //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes
  78. #elif ENABLED(U8GLIB_SSD1306)
  79. // Generic support for SSD1306 OLED I2C LCDs
  80. //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE
  81. //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
  82. #define U8G_CLASS U8GLIB_SSD1306_128X64_2X
  83. #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
  84. #elif ENABLED(MKS_12864OLED)
  85. // MKS 128x64 (SH1106) OLED I2C LCD
  86. #define U8G_CLASS U8GLIB_SH1106_128X64
  87. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 8 stripes
  88. //#define U8G_CLASS U8GLIB_SH1106_128X64_2X
  89. //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes
  90. #elif ENABLED(U8GLIB_SH1106)
  91. // Generic support for SH1106 OLED I2C LCDs
  92. //#define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE
  93. //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
  94. #define U8G_CLASS U8GLIB_SH1106_128X64_2X
  95. #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
  96. #elif ENABLED(U8GLIB_SSD1309)
  97. // Generic support for SSD1309 OLED I2C LCDs
  98. #define U8G_CLASS U8GLIB_SSD1309_128X64
  99. #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)
  100. #elif ENABLED(MINIPANEL)
  101. // MINIPanel display
  102. //#define U8G_CLASS U8GLIB_MINI12864
  103. //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes
  104. #define U8G_CLASS U8GLIB_MINI12864_2X
  105. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes
  106. #elif ENABLED(FYSETC_MINI_12864)
  107. // The FYSETC_MINI_12864 display
  108. #define U8G_CLASS U8GLIB_MINI12864_2X_HAL
  109. #if ENABLED(FORCE_SOFT_SPI)
  110. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes SW-SPI
  111. #else
  112. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes HW-SPI
  113. #endif
  114. #elif ENABLED(U8GLIB_SH1106_EINSTART)
  115. // Connected via motherboard header
  116. #define U8G_CLASS U8GLIB_SH1106_128X64
  117. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS
  118. #elif ENABLED(FSMC_GRAPHICAL_TFT)
  119. // Unspecified 320x240 TFT pre-initialized by built-in bootloader
  120. #define U8G_CLASS U8GLIB_TFT_320X240_UPSCALE_FROM_128X64
  121. #define U8G_PARAM FSMC_CS_PIN, FSMC_RS_PIN
  122. #else
  123. // for regular DOGM128 display with HW-SPI
  124. //#define U8G_CLASS U8GLIB_DOGM128
  125. //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI Com: CS, A0 // 8 stripes
  126. #define U8G_CLASS U8GLIB_DOGM128_2X
  127. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI Com: CS, A0 // 4 stripes
  128. #endif
  129. #ifndef LCD_PIXEL_WIDTH
  130. #define LCD_PIXEL_WIDTH 128
  131. #endif
  132. #ifndef LCD_PIXEL_HEIGHT
  133. #define LCD_PIXEL_HEIGHT 64
  134. #endif
  135. // For selective rendering within a Y range
  136. #define PAGE_OVER(ya) ((ya) <= u8g.getU8g()->current_page.y1) // Does the current page follow a region top?
  137. #define PAGE_UNDER(yb) ((yb) >= u8g.getU8g()->current_page.y0) // Does the current page precede a region bottom?
  138. #define PAGE_CONTAINS(ya, yb) ((yb) >= u8g.getU8g()->current_page.y0 && (ya) <= u8g.getU8g()->current_page.y1) // Do two vertical regions overlap?
  139. // Only Western languages support big / small fonts
  140. #if DISABLED(DISPLAY_CHARSET_ISO10646_1)
  141. #undef USE_BIG_EDIT_FONT
  142. #undef USE_SMALL_INFOFONT
  143. #endif
  144. #define MENU_FONT_NAME ISO10646_1_5x7
  145. #define MENU_FONT_WIDTH 6
  146. #define MENU_FONT_ASCENT 10
  147. #define MENU_FONT_DESCENT 2
  148. #define MENU_FONT_HEIGHT (MENU_FONT_ASCENT + MENU_FONT_DESCENT)
  149. #if ENABLED(USE_BIG_EDIT_FONT)
  150. #define EDIT_FONT_NAME u8g_font_9x18
  151. #define EDIT_FONT_WIDTH 9
  152. #define EDIT_FONT_ASCENT 10
  153. #define EDIT_FONT_DESCENT 3
  154. #else
  155. #define EDIT_FONT_NAME MENU_FONT_NAME
  156. #define EDIT_FONT_WIDTH MENU_FONT_WIDTH
  157. #define EDIT_FONT_ASCENT MENU_FONT_ASCENT
  158. #define EDIT_FONT_DESCENT MENU_FONT_DESCENT
  159. #endif
  160. #define EDIT_FONT_HEIGHT (EDIT_FONT_ASCENT + EDIT_FONT_DESCENT)
  161. // Get the Ascent, Descent, and total Height for the Info Screen font
  162. #if ENABLED(USE_SMALL_INFOFONT)
  163. extern const u8g_fntpgm_uint8_t u8g_font_6x9[];
  164. #define INFO_FONT_ASCENT 7
  165. #else
  166. #define INFO_FONT_ASCENT 8
  167. #endif
  168. #define INFO_FONT_DESCENT 2
  169. #define INFO_FONT_HEIGHT (INFO_FONT_ASCENT + INFO_FONT_DESCENT)
  170. #define INFO_FONT_WIDTH 6
  171. extern U8G_CLASS u8g;