/**
 * 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/>.
 *
 */
#pragma once

/**
 * QUBOID_SHIELD Board pin assignments
 */

#include "env_validate.h"

#define BOARD_INFO_NAME      "QUBOID SHIELD"
#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME


#define DISABLE_JTAG
#define FAN_SOFT_PWM

//Change index of timer to use for temperature
//#undef TEMP_TIMER_NUM
//#define TEMP_TIMER_NUM 1

//
// Limit Switches
//

#define X_MIN_PIN		PB9
#define Y_MIN_PIN		PB3
#define Z_MIN_PIN		PA9


//
// Steppers
//
// X & Y enable are the same
#define X_STEP_PIN         PB7
#define X_DIR_PIN          PB6
#define X_ENABLE_PIN       PB8

#define Y_STEP_PIN         PB5
#define Y_DIR_PIN          PB4
#define Y_ENABLE_PIN       PB8

#define Z_STEP_PIN         PA15
#define Z_DIR_PIN          PA10
#define Z_ENABLE_PIN       PB8

#define E0_STEP_PIN        PA8
#define E0_DIR_PIN         PB15
#define E0_ENABLE_PIN      PB8

//
// Temperature Sensors
//
#define TEMP_0_PIN         PB1   // Analog Input (HOTEND thermistor)
#define TEMP_BED_PIN       PB0   // Analog Input (BED thermistor)

//
// Heaters / Fans
//
#define HEATER_0_PIN       PA2   // HOTEND MOSFET
#define HEATER_BED_PIN     PA0   // BED MOSFET

#define FAN_PIN            PA1   // FAN1 header on board - PRINT FAN


// For different Displays pins
/**                                                                                           
 *                               ______                                      ______           
 *                           NC | 1  2 | BTN_ENC                     (MISO) | 1  2 | (SCK)    
 *                     (LCD_EN) | 3  4 | (LCD_RS)                 (BTN_EN2) | 3  4 | (SD_CS)  
 *                     (LCD_D4) | 5  6   (LCD_D5)(LCD_CS)         (BTN_EN1) | 5  6   (MOSI)   
 *  (LCD_A0, SCL2, TX3)(LCD_D6) | 7  8 | (LCD_D7)(SDA2, RX3)             NC | 7  8 | NC       
 *                         GND  | 9 10 | 5V                             GND | 9 10 | NC       
 *                               ------                                      ------           
 *                                EXP1                                        EXP2            
 */                                                                                             

//Define pins EXP1 and EXP2 for our plate

#define EXP1_01_PIN                        -1
#define EXP1_02_PIN                        PC13
#define EXP1_03_PIN                        PB13
#define EXP1_04_PIN                        PB12
#define EXP1_05_PIN                        PB14
#define EXP1_06_PIN                        PA3
#define EXP1_07_PIN                        PB10
#define EXP1_08_PIN                        PB11
#define EXP2_09_PIN                        -1
#define EXP2_10_PIN                        -1

#define EXP2_01_PIN                        PA6
#define EXP2_02_PIN                        PA5
#define EXP2_03_PIN                        PC15
#define EXP2_04_PIN                        PA4
#define EXP2_05_PIN                        PC14
#define EXP2_06_PIN                        PA7   
#define EXP2_07_PIN                        -1   
#define EXP2_08_PIN                        -1
#define EXP2_09_PIN                        -1
#define EXP2_10_PIN                        -1	



#ifdef MKS_MINI_12864_V3
  #define DOGLCD_CS            EXP1_03_PIN
  #define DOGLCD_A0            EXP1_04_PIN
  #define DOGLCD_SCK           EXP2_02_PIN
  #define DOGLCD_MOSI          EXP2_06_PIN

//Encoder
  #define BTN_EN1             EXP2_05_PIN
  #define BTN_EN2             EXP2_03_PIN
  #define BTN_ENC             EXP1_02_PIN
#endif

#ifdef NEOPIXEL_LED
  #define NEOPIXEL_PIN	      EXP1_06_PIN
#endif

#if defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
  #define LCD_PINS_RS         EXP1_04_PIN
  #define LCD_PINS_ENABLE     EXP1_03_PIN
  #define LCD_PINS_D4         EXP1_05_PIN
  #define LCD_PINS_D5         EXP1_06_PIN
  #define LCD_PINS_D6         EXP1_07_PIN
  #define LCD_PINS_D7         EXP1_08_PIN

//Encoder
  #define BTN_EN1             EXP2_03_PIN
  #define BTN_EN2             EXP2_05_PIN
  #define BTN_ENC             EXP1_02_PIN
#endif


// SDCard
#ifdef SDSUPPORT
  #define SDSS                EXP2_04_PIN
  #define SD_DETECT_PIN       -1
  #define KILL_PIN            -1
#endif

