2018-11-13 01:47:45 -06:00
|
|
|
|
/**
|
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 08:00:57 -06:00
|
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2018-11-13 01:47:45 -06:00
|
|
|
|
*
|
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-27 23:57:50 -05:00
|
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2018-11-13 01:47:45 -06:00
|
|
|
|
*
|
|
|
|
|
* 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
|
2020-07-22 22:20:14 -05:00
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2018-11-13 01:47:45 -06:00
|
|
|
|
*
|
|
|
|
|
*/
|
2019-07-04 22:44:12 -05:00
|
|
|
|
#pragma once
|
2018-11-13 01:47:45 -06:00
|
|
|
|
|
|
|
|
|
/**
|
2020-10-16 19:36:25 -05:00
|
|
|
|
* lcd/dogm/marlinui_DOGM.h
|
2018-11-13 01:47:45 -06:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "../../inc/MarlinConfigPre.h"
|
|
|
|
|
|
|
|
|
|
#include <U8glib.h>
|
|
|
|
|
#include "HAL_LCD_class_defines.h"
|
|
|
|
|
|
2019-09-25 18:41:04 -05:00
|
|
|
|
//#define ALTERNATIVE_LCD
|
|
|
|
|
|
2018-11-13 01:47:45 -06:00
|
|
|
|
#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
|
2020-08-07 17:03:59 -05:00
|
|
|
|
|
|
|
|
|
// RepRapWorld Graphical LCD
|
|
|
|
|
|
2018-11-13 01:47:45 -06:00
|
|
|
|
#define U8G_CLASS U8GLIB_ST7920_128X64_4X
|
2021-01-01 14:31:15 -06:00
|
|
|
|
#if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN) && (LCD_PINS_ENABLE == SD_MOSI_PIN)
|
2018-11-13 01:47:45 -06:00
|
|
|
|
#define U8G_PARAM LCD_PINS_RS
|
|
|
|
|
#else
|
|
|
|
|
#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#elif ENABLED(U8GLIB_ST7920)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2018-11-13 01:47:45 -06:00
|
|
|
|
// RepRap Discount Full Graphics Smart Controller
|
2020-08-07 17:03:59 -05:00
|
|
|
|
// and other variant LCDs using ST7920
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2021-01-01 14:31:15 -06:00
|
|
|
|
#if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN) && (LCD_PINS_ENABLE == SD_MOSI_PIN)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
#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
|
2018-11-13 01:47:45 -06:00
|
|
|
|
#else
|
2019-09-25 18:41:04 -05:00
|
|
|
|
#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
|
2018-11-13 01:47:45 -06:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#elif ENABLED(CARTESIO_UI)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
|
|
|
|
// 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
|
2018-11-13 01:47:45 -06:00
|
|
|
|
|
|
|
|
|
#elif ENABLED(U8GLIB_LM6059_AF)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2020-07-22 22:20:14 -05:00
|
|
|
|
// Based on the Adafruit ST7565 (https://www.adafruit.com/products/250)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
|
|
|
|
#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
|
2018-11-13 01:47:45 -06:00
|
|
|
|
|
|
|
|
|
#elif ENABLED(U8GLIB_ST7565_64128N)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
|
|
|
|
// MaKrPanel, Mini Viki, Viki 2.0, AZSMZ 12864 ST7565 controller
|
|
|
|
|
|
2019-10-15 14:18:46 -05:00
|
|
|
|
#define SMART_RAMPS MB(RAMPS_SMART_EFB, RAMPS_SMART_EEB, RAMPS_SMART_EFF, RAMPS_SMART_EEF, RAMPS_SMART_SF)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
#define U8G_CLASS U8GLIB_64128N_2X_HAL // 4 stripes (HW-SPI)
|
2021-02-20 20:20:55 -06:00
|
|
|
|
|
|
|
|
|
#if (SMART_RAMPS && defined(__SAM3X8E__)) || DOGLCD_SCK != SD_SCK_PIN || DOGLCD_MOSI != SD_MOSI_PIN
|
2019-09-25 18:41:04 -05:00
|
|
|
|
#define FORCE_SOFT_SPI // SW-SPI
|
2018-11-13 01:47:45 -06:00
|
|
|
|
#endif
|
|
|
|
|
|
2020-08-07 17:03:59 -05:00
|
|
|
|
#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
|
|
|
|
|
|
2021-01-17 00:46:57 -06:00
|
|
|
|
#elif ENABLED(MKS_12864OLED_SSD1306)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2018-11-13 01:47:45 -06:00
|
|
|
|
// MKS 128x64 (SSD1306) OLED I2C LCD
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
|
|
|
|
#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
|
2018-11-13 01:47:45 -06:00
|
|
|
|
|
2021-01-17 00:46:57 -06:00
|
|
|
|
#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
|
|
|
|
|
|
2020-08-07 17:03:59 -05:00
|
|
|
|
#elif ENABLED(ZONESTAR_12864OLED_SSD1306)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2020-08-07 17:03:59 -05:00
|
|
|
|
// Zonestar SSD1306 OLED SPI LCD
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2020-08-07 17:03:59 -05:00
|
|
|
|
#define FORCE_SOFT_SPI // SW-SPI
|
2019-09-25 18:41:04 -05:00
|
|
|
|
#if ENABLED(ALTERNATIVE_LCD)
|
2020-08-07 17:03:59 -05:00
|
|
|
|
#define U8G_CLASS U8GLIB_SH1306_128X64_2X // 4 stripes
|
2019-09-25 18:41:04 -05:00
|
|
|
|
#else
|
2020-08-07 17:03:59 -05:00
|
|
|
|
#define U8G_CLASS U8GLIB_SH1306_128X64 // 8 stripes
|
2019-09-25 18:41:04 -05:00
|
|
|
|
#endif
|
2018-11-13 01:47:45 -06:00
|
|
|
|
|
2020-08-07 17:03:59 -05:00
|
|
|
|
#elif EITHER(MKS_12864OLED, ZONESTAR_12864OLED)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2018-11-13 01:47:45 -06:00
|
|
|
|
// MKS 128x64 (SH1106) OLED I2C LCD
|
2020-08-07 17:03:59 -05:00
|
|
|
|
// - or -
|
|
|
|
|
// Zonestar SH1106 OLED SPI LCD
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
2020-08-07 17:03:59 -05:00
|
|
|
|
#elif ENABLED(U8GLIB_SH1106_EINSTART)
|
2020-07-07 01:57:05 -05:00
|
|
|
|
|
2020-08-07 17:03:59 -05:00
|
|
|
|
// Connected via motherboard header
|
2020-07-07 01:57:05 -05:00
|
|
|
|
|
2020-08-07 17:03:59 -05:00
|
|
|
|
#define U8G_CLASS U8GLIB_SH1106_128X64
|
|
|
|
|
#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS
|
2020-07-02 20:33:52 -05:00
|
|
|
|
|
2018-11-13 01:47:45 -06:00
|
|
|
|
#elif ENABLED(U8GLIB_SH1106)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
2018-11-13 01:47:45 -06:00
|
|
|
|
#elif ENABLED(U8GLIB_SSD1309)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2018-11-13 01:47:45 -06:00
|
|
|
|
// Generic support for SSD1309 OLED I2C LCDs
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2018-11-13 01:47:45 -06:00
|
|
|
|
#define U8G_CLASS U8GLIB_SSD1309_128X64
|
2019-09-25 18:41:04 -05:00
|
|
|
|
#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // I2C
|
|
|
|
|
|
2020-08-07 17:03:59 -05:00
|
|
|
|
#elif ENABLED(U8GLIB_SSD1306)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2020-08-07 17:03:59 -05:00
|
|
|
|
// Generic SSD1306 OLED I2C LCD
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
|
|
|
|
#if ENABLED(ALTERNATIVE_LCD)
|
2020-08-07 17:03:59 -05:00
|
|
|
|
#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE // 4 stripes
|
2019-04-15 22:54:11 -05:00
|
|
|
|
#else
|
2020-08-07 17:03:59 -05:00
|
|
|
|
#define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes
|
2019-04-15 22:54:11 -05:00
|
|
|
|
#endif
|
2020-08-07 17:03:59 -05:00
|
|
|
|
#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2020-07-29 21:25:07 -05:00
|
|
|
|
#elif TFT_SCALED_DOGLCD
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2019-01-03 10:38:39 -06:00
|
|
|
|
// Unspecified 320x240 TFT pre-initialized by built-in bootloader
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2019-01-03 10:38:39 -06:00
|
|
|
|
#define U8G_CLASS U8GLIB_TFT_320X240_UPSCALE_FROM_128X64
|
2020-10-15 03:00:27 -05:00
|
|
|
|
#if HAS_FSMC_GRAPHICAL_TFT
|
2020-07-29 21:25:07 -05:00
|
|
|
|
#define U8G_PARAM FSMC_CS_PIN, FSMC_RS_PIN
|
|
|
|
|
#else
|
|
|
|
|
#define U8G_PARAM -1, -1
|
|
|
|
|
#endif
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
2018-11-13 01:47:45 -06:00
|
|
|
|
#else
|
2019-09-25 18:41:04 -05:00
|
|
|
|
|
|
|
|
|
#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
|
2018-11-13 01:47:45 -06:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// For selective rendering within a Y range
|
2018-11-27 21:15:52 -06:00
|
|
|
|
#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?
|
2018-11-13 01:47:45 -06:00
|
|
|
|
|
|
|
|
|
extern U8G_CLASS u8g;
|