From 652bedfa18c6fc03fd90d69f53df9b7c735d7fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Stawicki?= Date: Sun, 8 Jan 2017 17:12:35 +0100 Subject: [PATCH] Add RepRapDiscount Full Graphic Smart Controller support to MIGHTYBOARD REVE --- Marlin/pins_MIGHTYBOARD_REVE.h | 131 ++++++++++++++++++++++++++++----- 1 file changed, 111 insertions(+), 20 deletions(-) diff --git a/Marlin/pins_MIGHTYBOARD_REVE.h b/Marlin/pins_MIGHTYBOARD_REVE.h index cb85534d3..933486177 100644 --- a/Marlin/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/pins_MIGHTYBOARD_REVE.h @@ -129,6 +129,9 @@ #define THERMO_CS1 5 // E3 #define THERMO_CS2 2 // E4 +#define MAX6675_SS THERMO_CS1 +#define MAX6675_SCK_PIN THERMO_SCK_PIN +#define MAX6675_DO_PIN THERMO_DO_PIN // // Augmentation for auto-assigning plugs // @@ -137,7 +140,7 @@ // With no heated bed, an additional 24V fan is possible. // #define MOSFET_A_PIN 6 // H3 -#define MOSFET_B_PIN 9 // B5 +#define MOSFET_B_PIN 11 // B5 #define MOSFET_C_PIN 45 // L4 #define MOSFET_D_PIN 44 // L5 @@ -181,8 +184,8 @@ // // Extruder Auto Fan Pins // -#define EXTRUDER_0_AUTO_FAN 7 // H4 -#define EXTRUDER_1_AUTO_FAN 12 // B6 +#define ORIG_E0_AUTO_FAN_PIN 7 // H4 +#define ORIG_E1_AUTO_FAN_PIN 12 // B6 // // Misc. Functions @@ -194,29 +197,117 @@ // // LCD / Controller // -// Replicator uses a 3-wire SR controller with HD44780 -// For now, pretend it's the SAV -// -#define SAV_3DLCD -#define SR_DATA_PIN 34 // C3 -#define SR_CLK_PIN 35 // C2 -#define SR_STROBE_PIN 33 // C4 -#define BTN_UP 75 // J4 -#define BTN_DOWN 73 // J3 -#define BTN_LEFT 72 // J2 -#define BTN_RIGHT 14 // J1 -#define BTN_CENTER 15 // J0 -#define BTN_ENC BTN_CENTER +#ifdef REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER + + #define LCD_PINS_RS 33 // C4, LCD-STROBE + #define LCD_PINS_ENABLE 72 // J2, LEFT + #define LCD_PINS_D4 35 // C2, LCD-CLK + #define LCD_PINS_D5 32 // C5, RLED + #define LCD_PINS_D6 34 // C3, LCD-DATA + #define LCD_PINS_D7 31 // C6, GLED + + #define BTN_EN2 75 // J4, UP + #define BTN_EN1 73 // J3, DOWN + //STOP button connected as KILL_PIN + #define KILL_PIN 14 // J1, RIGHT + //KILL - not connected + + #define BEEPER_PIN 8 // H5, SD_WP + + #define BTN_CENTER 15 // J0 + #define BTN_ENC BTN_CENTER + + //on board leds + #define STAT_LED_RED_LED SERVO0_PIN // C1 (1280-EX1, DEBUG2) + #define STAT_LED_BLUE_PIN SERVO1_PIN // C0 (1280-EX2, DEBUG3) + +#else + // Replicator uses a 3-wire SR controller with HD44780 + // For now, pretend it's the SAV + // + + #define SAV_3DLCD + #define SR_DATA_PIN 34 // C3 + #define SR_CLK_PIN 35 // C2 + #define SR_STROBE_PIN 33 // C4 -#define BEEPER_PIN 4 // G5 + #define BTN_UP 75 // J4 + #define BTN_DOWN 73 // J3 + #define BTN_LEFT 72 // J2 + #define BTN_RIGHT 14 // J1 + #define BTN_CENTER 15 // J0 + #define BTN_ENC BTN_CENTER + + #define BEEPER_PIN 4 // G5 + + #define STAT_LED_RED_PIN 32 // C5 + #define STAT_LED_BLUE_PIN 31 // C6 (Actually green) + +#endif -#define STAT_LED_RED 32 // C5 -#define STAT_LED_BLUE 31 // C6 (Actually green) // // SD Card // #define SDSS 53 // B0 -#define SD_DETECT_PIN 30 // C7 +#define SD_DETECT_PIN 9 // H6 + +#define MAX_PIN THERMO_SCK_PIN + +//check if all pins are defined in mega/pins_arduino.h +#include +static_assert(NUM_DIGITAL_PINS > MAX_PIN, "add missing pins to [arduino dir]/hardware/arduino/avr/variants/mega/pins_arduino.h based on fastio.h" + "to digital_pin_to_port_PGM, digital_pin_to_bit_mask_PGM, digital_pin_to_timer_PGM, NUM_DIGITAL_PINS, see below"); + +/* in [arduino dir]/hardware/arduino/avr/variants/mega/pins_arduino.h +change: +#define NUM_DIGITAL_PINS 70 +to: +#define NUM_DIGITAL_PINS 80 + +to digital_pin_to_port_PGM add at the end: +const uint8_t PROGMEM digital_pin_to_port_PGM[] = { +.... + PG , // PG 4 ** 70 ** + PG , // PG 3 ** 71 ** + PJ , // PJ 2 ** 72 ** + PJ , // PJ 3 ** 73 ** + PJ , // PJ 7 ** 74 ** + PJ , // PJ 4 ** 75 ** + PJ , // PJ 5 ** 76 ** + PJ , // PJ 6 ** 77 ** + PE , // PE 2 ** 78 ** + PE , // PE 6 ** 79 ** +}; + +to digital_pin_to_bit_mask_PGM add at the end: +const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { +.... + _BV( 4 ) , // PG 4 ** 70 ** + _BV( 3 ) , // PG 3 ** 71 ** + _BV( 2 ) , // PJ 2 ** 72 ** + _BV( 3 ) , // PJ 3 ** 73 ** + _BV( 7 ) , // PJ 7 ** 74 ** + _BV( 4 ) , // PJ 4 ** 75 ** + _BV( 5 ) , // PJ 5 ** 76 ** + _BV( 6 ) , // PJ 6 ** 77 ** + _BV( 2 ) , // PE 2 ** 78 ** + _BV( 6 ) , // PE 6 ** 79 ** +}; +to digital_pin_to_timer_PGM add at the end: +const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { +.... + NOT_ON_TIMER , // PG 4 ** 70 ** + NOT_ON_TIMER , // PG 3 ** 71 ** + NOT_ON_TIMER , // PJ 2 ** 72 ** + NOT_ON_TIMER , // PJ 3 ** 73 ** + NOT_ON_TIMER , // PJ 7 ** 74 ** + NOT_ON_TIMER , // PJ 4 ** 75 ** + NOT_ON_TIMER , // PJ 5 ** 76 ** + NOT_ON_TIMER , // PJ 6 ** 77 ** + NOT_ON_TIMER , // PE 2 ** 78 ** + NOT_ON_TIMER , // PE 6 ** 79 ** +}; +*/