From 41f8cdb3a62817b5bea01309e73f9082883c1728 Mon Sep 17 00:00:00 2001 From: Ed Boston Date: Sun, 17 May 2015 12:47:41 -0700 Subject: [PATCH] ADAFRUIT_ST7565 Added support for new display type --- Marlin/Conditionals.h | 6 ++++-- Marlin/Configuration.h | 2 ++ Marlin/dogm_lcd_implementation.h | 2 ++ Marlin/pins_RAMPS_13.h | 16 ++++++++++++++-- Marlin/ultralcd.cpp | 12 +++++++++++- 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index f09a8a2fe8..0a761872bb 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -22,15 +22,17 @@ #define NEWPANEL #endif - #if defined(miniVIKI) || defined(VIKI2) + #if defined(miniVIKI) || defined(VIKI2) || defined(ADAFRUIT_ST7565) #define ULTRA_LCD //general LCD support, also 16x2 #define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. #ifdef miniVIKI #define DEFAULT_LCD_CONTRAST 95 - #else + #elif defined(VIKI2) #define DEFAULT_LCD_CONTRAST 40 + #elif defined(ADAFRUIT_ST7565) + #define DEFAULT_LCD_CONTRAST 110 #endif #define ENCODER_PULSES_PER_STEP 4 diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 8e520fa96a..c5fdac39db 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -660,6 +660,8 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#define VIKI2 //#define miniVIKI +#define ADAFRUIT_ST7565 + // The RepRapDiscount Smart Controller (white PCB) // http://reprap.org/wiki/RepRapDiscount_Smart_Controller //#define REPRAP_DISCOUNT_SMART_CONTROLLER diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 47e4a9244d..a091a2c4af 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -126,6 +126,8 @@ #elif defined(VIKI2) || defined(miniVIKI) // Mini Viki and Viki 2.0 LCD, ST7565 controller as well U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); +#elif defined(ADAFRUIT_ST7565) + U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0); #else // for regular DOGM128 display with HW-SPI U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 diff --git a/Marlin/pins_RAMPS_13.h b/Marlin/pins_RAMPS_13.h index c9c796ed42..6328ab6c20 100644 --- a/Marlin/pins_RAMPS_13.h +++ b/Marlin/pins_RAMPS_13.h @@ -180,6 +180,19 @@ #define BTN_ENC -1 #define LCD_SDSS 53 #define SDCARDDETECT 49 + #elif defined(ADAFRUIT_ST7565) + #define BTN_EN1 35 + #define BTN_EN2 37 + #define BTN_ENC 31 + #define SDCARDDETECT 49 + #define SDCARDDETECTINVERTED + #define SDSLOW + #define LCD_SDSS 53 + #define KILL_PIN 41 + #define BEEPER 23 + #define DOGLCD_CS 29 + #define DOGLCD_A0 27 + #define LCD_PIN_BL 33 #else // arduino pin which triggers an piezzo beeper #define BEEPER 33 // Beeper on AUX-4 @@ -209,8 +222,7 @@ #endif #endif - - #else // Old-style panel with shift register + #else // Old-style panel with shift register // Arduino pin witch triggers an piezzo beeper #define BEEPER 33 // No Beeper added diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 1bcd3dbaae..7ab4499cba 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1110,13 +1110,23 @@ static void lcd_control_volumetric_menu() { #ifdef HAS_LCD_CONTRAST static void lcd_set_contrast() { if (encoderPosition != 0) { +#ifdef ADAFRUIT_ST7565 + lcd_contrast += encoderPosition; + lcd_contrast &= 0xFF; +#else lcd_contrast -= encoderPosition; lcd_contrast &= 0x3F; +#endif encoderPosition = 0; lcdDrawUpdate = 1; u8g.setContrast(lcd_contrast); } - if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast)); + if (lcdDrawUpdate) +#ifdef ADAFRUIT_ST7565 + lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr3(lcd_contrast)); +#else + lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast)); +#endif if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu); } #endif // HAS_LCD_CONTRAST