Browse Source
* Group status methods, share reset_status with Extensible UI * Move common DOGM code to headerspull/1/head
Scott Lahteine
6 years ago
committed by
GitHub
18 changed files with 544 additions and 516 deletions
@ -1,39 +0,0 @@ |
|||
/**
|
|||
* Lightweight Status Screen for the RepRapDiscount Full |
|||
* Graphics Smart Controller (ST7920-based 128x64 LCD) |
|||
* |
|||
* (c) 2017 Aleph Objects, Inc. |
|||
* |
|||
* The code in this page is free software: you can |
|||
* redistribute it and/or modify it under the terms of the GNU |
|||
* General Public License (GNU GPL) as published by the Free Software |
|||
* Foundation, either version 3 of the License, or (at your option) |
|||
* any later version. The code is distributed WITHOUT ANY WARRANTY; |
|||
* without even the implied warranty of MERCHANTABILITY or FITNESS |
|||
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. |
|||
* |
|||
*/ |
|||
|
|||
#include "status_screen_lite_ST7920_class.h" |
|||
|
|||
void ST7920_Lite_Status_Screen::cs() { |
|||
ST7920_CS(); |
|||
current_bits.synced = false; |
|||
} |
|||
|
|||
void ST7920_Lite_Status_Screen::ncs() { |
|||
ST7920_NCS(); |
|||
current_bits.synced = false; |
|||
} |
|||
|
|||
void ST7920_Lite_Status_Screen::sync_cmd() { |
|||
ST7920_SET_CMD(); |
|||
} |
|||
|
|||
void ST7920_Lite_Status_Screen::sync_dat() { |
|||
ST7920_SET_DAT(); |
|||
} |
|||
|
|||
void ST7920_Lite_Status_Screen::write_byte(const uint8_t data) { |
|||
ST7920_WRITE_BYTE(data); |
|||
} |
@ -0,0 +1,174 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
|
|||
/**
|
|||
* ultralcd_impl_DOGM.h |
|||
*/ |
|||
|
|||
#include "../../inc/MarlinConfigPre.h" |
|||
|
|||
#include <U8glib.h> |
|||
#include "HAL_LCD_class_defines.h" |
|||
|
|||
// LCD selection
|
|||
#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD) |
|||
#define U8G_CLASS U8GLIB_ST7920_128X64_4X |
|||
#if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == 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
|
|||
#if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN) |
|||
#define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL |
|||
#define U8G_PARAM LCD_PINS_RS // 2 stripes, HW SPI (shared with SD card, on AVR does not use standard LCD adapter)
|
|||
#else |
|||
//#define U8G_CLASS U8GLIB_ST7920_128X64_4X
|
|||
//#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS // Original u8glib device. 2 stripes, SW SPI
|
|||
#define U8G_CLASS U8GLIB_ST7920_128X64_RRD |
|||
#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
|
|||
// AVR version ignores these pin settings
|
|||
// HAL version uses these pin settings
|
|||
#endif |
|||
|
|||
#elif ENABLED(CARTESIO_UI) |
|||
// The CartesioUI display
|
|||
//#define U8G_CLASS U8GLIB_DOGM128_2X
|
|||
//#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes
|
|||
#define U8G_CLASS U8GLIB_DOGM128_2X |
|||
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes
|
|||
|
|||
#elif ENABLED(U8GLIB_LM6059_AF) |
|||
// Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
|
|||
//#define U8G_CLASS U8GLIB_LM6059
|
|||
//#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes
|
|||
#define U8G_CLASS U8GLIB_LM6059_2X |
|||
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes
|
|||
|
|||
#elif ENABLED(U8GLIB_ST7565_64128N) |
|||
// The MaKrPanel, Mini Viki, Viki 2.0 & AZSMZ 12864 ST7565 controller
|
|||
#define SMART_RAMPS (MB(RAMPS_SMART_EFB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_SMART_EFF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_SMART_SF)) |
|||
#if DOGLCD_SCK == SCK_PIN && DOGLCD_MOSI == MOSI_PIN && !SMART_RAMPS |
|||
#define U8G_CLASS U8GLIB_64128N_2X_HAL |
|||
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // using HW-SPI
|
|||
#else |
|||
#define U8G_CLASS U8GLIB_64128N_2X_HAL |
|||
#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // using SW-SPI
|
|||
#endif |
|||
|
|||
#elif ENABLED(MKS_12864OLED_SSD1306) |
|||
// MKS 128x64 (SSD1306) OLED I2C LCD
|
|||
#define U8G_CLASS U8GLIB_SSD1306_128X64 |
|||
#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 8 stripes
|
|||
//#define U8G_CLASS U8GLIB_SSD1306_128X64_2X
|
|||
//#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes
|
|||
|
|||
#elif ENABLED(U8GLIB_SSD1306) |
|||
// Generic support for SSD1306 OLED I2C LCDs
|
|||
//#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE
|
|||
//#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
|
|||
#define U8G_CLASS U8GLIB_SSD1306_128X64_2X |
|||
#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
|
|||
|
|||
#elif ENABLED(MKS_12864OLED) |
|||
// MKS 128x64 (SH1106) OLED I2C LCD
|
|||
#define U8G_CLASS U8GLIB_SH1106_128X64 |
|||
#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 8 stripes
|
|||
//#define U8G_CLASS U8GLIB_SH1106_128X64_2X
|
|||
//#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes
|
|||
#elif ENABLED(U8GLIB_SH1106) |
|||
// Generic support for SH1106 OLED I2C LCDs
|
|||
//#define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE
|
|||
//#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
|
|||
#define U8G_CLASS U8GLIB_SH1106_128X64_2X |
|||
#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
|
|||
#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) |
|||
#elif ENABLED(MINIPANEL) |
|||
// The MINIPanel display
|
|||
//#define U8G_CLASS U8GLIB_MINI12864
|
|||
//#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes
|
|||
#define U8G_CLASS U8GLIB_MINI12864_2X |
|||
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes
|
|||
#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 |
|||
#else |
|||
// for regular DOGM128 display with HW-SPI
|
|||
//#define U8G_CLASS U8GLIB_DOGM128
|
|||
//#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI Com: CS, A0 // 8 stripes
|
|||
#define U8G_CLASS U8GLIB_DOGM128_2X |
|||
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI Com: CS, A0 // 4 stripes
|
|||
#endif |
|||
|
|||
#ifndef LCD_PIXEL_WIDTH |
|||
#define LCD_PIXEL_WIDTH 128 |
|||
#endif |
|||
#ifndef LCD_PIXEL_HEIGHT |
|||
#define LCD_PIXEL_HEIGHT 64 |
|||
#endif |
|||
|
|||
// For selective rendering within a Y range
|
|||
#define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb)) |
|||
#define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya)) |
|||
|
|||
// Only Western languages support big / small fonts
|
|||
#if DISABLED(DISPLAY_CHARSET_ISO10646_1) |
|||
#undef USE_BIG_EDIT_FONT |
|||
#undef USE_SMALL_INFOFONT |
|||
#endif |
|||
|
|||
#define MENU_FONT_NAME ISO10646_1_5x7 |
|||
#define MENU_FONT_WIDTH 6 |
|||
#define MENU_FONT_ASCENT 10 |
|||
#define MENU_FONT_DESCENT 2 |
|||
#define MENU_FONT_HEIGHT (MENU_FONT_ASCENT + MENU_FONT_DESCENT) |
|||
|
|||
#if ENABLED(USE_BIG_EDIT_FONT) |
|||
#define EDIT_FONT_NAME u8g_font_9x18 |
|||
#define EDIT_FONT_WIDTH 9 |
|||
#define EDIT_FONT_ASCENT 10 |
|||
#define EDIT_FONT_DESCENT 3 |
|||
#else |
|||
#define EDIT_FONT_NAME MENU_FONT_NAME |
|||
#define EDIT_FONT_WIDTH MENU_FONT_WIDTH |
|||
#define EDIT_FONT_ASCENT MENU_FONT_ASCENT |
|||
#define EDIT_FONT_DESCENT MENU_FONT_DESCENT |
|||
#endif |
|||
#define EDIT_FONT_HEIGHT (EDIT_FONT_ASCENT + EDIT_FONT_DESCENT) |
|||
|
|||
// Get the Ascent, Descent, and total Height for the Info Screen font
|
|||
#if ENABLED(USE_SMALL_INFOFONT) |
|||
extern const u8g_fntpgm_uint8_t u8g_font_6x9[]; |
|||
#define INFO_FONT_ASCENT 7 |
|||
#else |
|||
#define INFO_FONT_ASCENT 8 |
|||
#endif |
|||
#define INFO_FONT_DESCENT 2 |
|||
#define INFO_FONT_HEIGHT (INFO_FONT_ASCENT + INFO_FONT_DESCENT) |
|||
|
|||
extern U8G_CLASS u8g; |
@ -0,0 +1,97 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
|
|||
// NOTE - the HAL version of the rrd device uses a generic ST7920 device. See the
|
|||
// file u8g_dev_st7920_128x64_HAL.cpp for the HAL version.
|
|||
|
|||
#include "../../inc/MarlinConfig.h" |
|||
|
|||
#if ENABLED(U8GLIB_ST7920) && !defined(U8G_HAL_LINKS) && !defined(__SAM3X8E__) |
|||
|
|||
#include "../../HAL/shared/Delay.h" |
|||
|
|||
#define ST7920_CLK_PIN LCD_PINS_D4 |
|||
#define ST7920_DAT_PIN LCD_PINS_ENABLE |
|||
#define ST7920_CS_PIN LCD_PINS_RS |
|||
|
|||
//#define PAGE_HEIGHT 8 //128 byte framebuffer
|
|||
#define PAGE_HEIGHT 16 //256 byte framebuffer
|
|||
//#define PAGE_HEIGHT 32 //512 byte framebuffer
|
|||
|
|||
#define LCD_PIXEL_WIDTH 128 |
|||
#define LCD_PIXEL_HEIGHT 64 |
|||
|
|||
#include <U8glib.h> |
|||
|
|||
// If you want you can define your own set of delays in Configuration.h
|
|||
//#define ST7920_DELAY_1 DELAY_NS(0)
|
|||
//#define ST7920_DELAY_2 DELAY_NS(0)
|
|||
//#define ST7920_DELAY_3 DELAY_NS(0)
|
|||
|
|||
#if F_CPU >= 20000000 |
|||
#define CPU_ST7920_DELAY_1 DELAY_NS(0) |
|||
#define CPU_ST7920_DELAY_2 DELAY_NS(0) |
|||
#define CPU_ST7920_DELAY_3 DELAY_NS(50) |
|||
#elif MB(3DRAG) || MB(K8200) || MB(K8400) || MB(SILVER_GATE) |
|||
#define CPU_ST7920_DELAY_1 DELAY_NS(0) |
|||
#define CPU_ST7920_DELAY_2 DELAY_NS(188) |
|||
#define CPU_ST7920_DELAY_3 DELAY_NS(0) |
|||
#elif MB(MINIRAMBO) || MB(EINSY_RAMBO) || MB(EINSY_RETRO) |
|||
#define CPU_ST7920_DELAY_1 DELAY_NS(0) |
|||
#define CPU_ST7920_DELAY_2 DELAY_NS(250) |
|||
#define CPU_ST7920_DELAY_3 DELAY_NS(0) |
|||
#elif MB(RAMBO) |
|||
#define CPU_ST7920_DELAY_1 DELAY_NS(0) |
|||
#define CPU_ST7920_DELAY_2 DELAY_NS(0) |
|||
#define CPU_ST7920_DELAY_3 DELAY_NS(0) |
|||
#elif MB(BQ_ZUM_MEGA_3D) |
|||
#define CPU_ST7920_DELAY_1 DELAY_NS(0) |
|||
#define CPU_ST7920_DELAY_2 DELAY_NS(0) |
|||
#define CPU_ST7920_DELAY_3 DELAY_NS(189) |
|||
#elif defined(ARDUINO_ARCH_STM32) |
|||
#define CPU_ST7920_DELAY_1 DELAY_NS(300) |
|||
#define CPU_ST7920_DELAY_2 DELAY_NS(40) |
|||
#define CPU_ST7920_DELAY_3 DELAY_NS(340) |
|||
#elif F_CPU == 16000000 |
|||
#define CPU_ST7920_DELAY_1 DELAY_NS(0) |
|||
#define CPU_ST7920_DELAY_2 DELAY_NS(0) |
|||
#define CPU_ST7920_DELAY_3 DELAY_NS(63) |
|||
#else |
|||
#error "No valid condition for delays in 'ultralcd_st7920_u8glib_rrd_AVR.h'" |
|||
#endif |
|||
|
|||
void ST7920_SWSPI_SND_8BIT(uint8_t val); |
|||
|
|||
#if DOGM_SPI_DELAY_US > 0 |
|||
#define U8G_DELAY() DELAY_US(DOGM_SPI_DELAY_US) |
|||
#else |
|||
#define U8G_DELAY() DELAY_US(10) |
|||
#endif |
|||
|
|||
#define ST7920_CS() { WRITE(ST7920_CS_PIN,1); U8G_DELAY(); } |
|||
#define ST7920_NCS() { WRITE(ST7920_CS_PIN,0); } |
|||
#define ST7920_SET_CMD() { ST7920_SWSPI_SND_8BIT(0xF8); U8G_DELAY(); } |
|||
#define ST7920_SET_DAT() { ST7920_SWSPI_SND_8BIT(0xFA); U8G_DELAY(); } |
|||
#define ST7920_WRITE_BYTE(a) { ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xF0u)); ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4u)); U8G_DELAY(); } |
|||
#define ST7920_WRITE_BYTES(p,l) { for (uint8_t i = l + 1; --i;) { ST7920_SWSPI_SND_8BIT(*p&0xF0); ST7920_SWSPI_SND_8BIT(*p<<4); p++; } U8G_DELAY(); } |
|||
|
|||
#endif // U8GLIB_ST7920 && !U8G_HAL_LINKS && !__SAM3X8E__
|
Loading…
Reference in new issue