Subversion Repositories Tronxy-X3A-Marlin

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 ron 1
/**
2
 * Marlin 3D Printer Firmware
3
 * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
 *
5
 * Based on Sprinter and grbl.
6
 * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 *
21
 */
22
 
23
/**
24
 * Sanguinololu board pin assignments
25
 */
26
 
27
/**
28
 * Rev B    26 DEC 2016
29
 *
30
 * 1) added pointer to a current Arduino IDE extension
31
 * 2) added support for M3, M4 & M5 spindle control commands
32
 * 3) added case light pin definition
33
 *
34
 */
35
 
36
/**
37
 * A useable Arduino IDE extension (board manager) can be found at
38
 * https://github.com/Lauszus/Sanguino
39
 *
40
 * This extension has been tested on Arduino 1.6.12 & 1.8.0
41
 *
42
 * Here's the JSON path:
43
 * https://raw.githubusercontent.com/Lauszus/Sanguino/master/package_lauszus_sanguino_index.json
44
 *
45
 * When installing select 1.0.2
46
 *
47
 * Installation instructions can be found at https://learn.sparkfun.com/pages/CustomBoardsArduino
48
 * Just use the above JSON URL instead of Sparkfun's JSON.
49
 *
50
 * Once installed select the Sanguino board and then select the CPU.
51
 *
52
 */
53
 
54
#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__)
55
  #error "Oops!  Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu."
56
#endif
57
 
58
#ifndef BOARD_NAME
59
  #define BOARD_NAME "Sanguinololu <1.2"
60
#endif
61
 
62
//
63
// Limit Switches
64
//
65
#define X_STOP_PIN         18
66
#define Y_STOP_PIN         19
67
#define Z_STOP_PIN         20
68
 
69
//
70
// Steppers
71
//
72
#define X_STEP_PIN         15
73
#define X_DIR_PIN          21
74
 
75
#define Y_STEP_PIN         22
76
#define Y_DIR_PIN          23
77
 
78
#define Z_STEP_PIN          3
79
#define Z_DIR_PIN           2
80
 
81
#define E0_STEP_PIN         1
82
#define E0_DIR_PIN          0
83
 
84
//
85
// Temperature Sensors
86
//
87
#define TEMP_0_PIN          7   // Analog Input (pin 33 extruder)
88
#define TEMP_BED_PIN        6   // Analog Input (pin 34 bed)
89
 
90
//
91
// Heaters / Fans
92
//
93
#define HEATER_0_PIN       13   // (extruder)
94
 
95
#if ENABLED(SANGUINOLOLU_V_1_2)
96
 
97
  #define HEATER_BED_PIN   12   // (bed)
98
  #define X_ENABLE_PIN     14
99
  #define Y_ENABLE_PIN     14
100
  #define Z_ENABLE_PIN     26
101
  #define E0_ENABLE_PIN    14
102
 
103
  #if !defined(FAN_PIN) && ENABLED(LCD_I2C_PANELOLU2)
104
    #define FAN_PIN         4   // Uses Transistor1 (PWM) on Panelolu2's Sanguino Adapter Board to drive the fan
105
  #endif
106
 
107
#else
108
 
109
  #define HEATER_BED_PIN   14   // (bed)
110
  #define X_ENABLE_PIN     -1
111
  #define Y_ENABLE_PIN     -1
112
  #define Z_ENABLE_PIN     -1
113
  #define E0_ENABLE_PIN    -1
114
 
115
#endif
116
 
117
#if !defined(FAN_PIN) && (MB(AZTEEG_X1) || MB(STB_11) || ENABLED(IS_MELZI))
118
  #define FAN_PIN           4   // Works for Panelolu2 too
119
#endif
120
 
121
//
122
// Misc. Functions
123
//
124
 
125
/**
126
 * In some versions of the Sanguino libraries the pin
127
 * definitions are wrong, with SDSS = 24 and LED_PIN = 28 (Melzi).
128
 * If you encounter issues with these pins, upgrade your
129
 * Sanguino libraries! See #368.
130
 */
131
//#define SDSS               24
132
#define SDSS               31
133
 
134
#if ENABLED(IS_MELZI)
135
  #define LED_PIN          27
136
#elif MB(STB_11)
137
  #define LCD_BACKLIGHT_PIN 17   // LCD backlight LED
138
#endif
139
 
140
#if DISABLED(SPINDLE_LASER_ENABLE) && ENABLED(SANGUINOLOLU_V_1_2) && !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL))  // try to use IO Header
141
  #define CASE_LIGHT_PIN     4   // MUST BE HARDWARE PWM  - see if IO Header is available
142
#endif
143
 
144
/**
145
 * Sanguinololu 1.4 AUX pins:
146
 *
147
 *           PWM  TX1  RX1  SDA  SCL
148
 *  12V  5V  D12  D11  D10  D17  D16
149
 *  GND GND  D31  D30  D29  D28  D27
150
 *            A4   A3   A2   A1   A0
151
 */
152
 
153
//
154
// LCD / Controller
155
//
156
#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)
157
 
158
  #if ENABLED(DOGLCD)
159
 
160
    #if ENABLED(U8GLIB_ST7920) // SPI GLCD 12864 ST7920 ( like [www.digole.com] ) For Melzi V2.0
161
 
162
      #if ENABLED(IS_MELZI)
163
        #define LCD_PINS_RS     30   // CS chip select /SS chip slave select
164
        #define LCD_PINS_ENABLE 29   // SID (MOSI)
165
        #define LCD_PINS_D4     17   // SCK (CLK) clock
166
        // Pin 27 is taken by LED_PIN, but Melzi LED does nothing with
167
        // Marlin so this can be used for BEEPER_PIN. You can use this pin
168
        // with M42 instead of BEEPER_PIN.
169
        #define BEEPER_PIN      27
170
      #else        // Sanguinololu >=1.3
171
        #define LCD_PINS_RS      4
172
        #define LCD_PINS_ENABLE 17
173
        #define LCD_PINS_D4     30
174
        #define LCD_PINS_D5     29
175
        #define LCD_PINS_D6     28
176
        #define LCD_PINS_D7     27
177
      #endif
178
 
179
    #else // DOGM SPI LCD Support
180
 
181
      #define DOGLCD_A0         30
182
      #define LCD_CONTRAST       1
183
 
184
      #if ENABLED(MAKRPANEL)
185
 
186
        #define BEEPER_PIN      29
187
        #define DOGLCD_CS       17
188
        #define LCD_BACKLIGHT_PIN 28   // PA3
189
 
190
      #elif ENABLED(IS_MELZI)
191
 
192
        #define BEEPER_PIN      27
193
        #define DOGLCD_CS       28
194
 
195
      #else // !MAKRPANEL
196
 
197
        #define DOGLCD_CS       29
198
 
199
      #endif
200
 
201
    #endif
202
 
203
    // Uncomment screen orientation
204
    #define LCD_SCREEN_ROT_0
205
    //#define LCD_SCREEN_ROT_90
206
    //#define LCD_SCREEN_ROT_180
207
    //#define LCD_SCREEN_ROT_270
208
 
209
  #else // !DOGLCD
210
 
211
    #define LCD_PINS_RS          4
212
    #define LCD_PINS_ENABLE     17
213
    #define LCD_PINS_D4         30
214
    #define LCD_PINS_D5         29
215
    #define LCD_PINS_D6         28
216
    #define LCD_PINS_D7         27
217
 
218
  #endif // !DOGLCD
219
 
220
  #define BTN_EN1               11
221
  #define BTN_EN2               10
222
 
223
  #if ENABLED(LCD_I2C_PANELOLU2)
224
 
225
    #if ENABLED(IS_MELZI)
226
      #define BTN_ENC           29
227
      #define LCD_SDSS          30   // Panelolu2 SD card reader rather than the Melzi
228
    #else
229
      #define BTN_ENC           30
230
    #endif
231
 
232
  #elif ENABLED(LCD_FOR_MELZI)
233
 
234
    #define LCD_PINS_RS         17
235
    #define LCD_PINS_ENABLE     16
236
    #define LCD_PINS_D4         11
237
    #define BTN_ENC             28
238
    #define BTN_EN1             29
239
    #define BTN_EN2             30
240
 
241
    #ifndef ST7920_DELAY_1
242
      #define ST7920_DELAY_1 DELAY_NS(0)
243
    #endif
244
    #ifndef ST7920_DELAY_2
245
      #define ST7920_DELAY_2 DELAY_NS(188)
246
    #endif
247
    #ifndef ST7920_DELAY_3
248
      #define ST7920_DELAY_3 DELAY_NS(0)
249
    #endif
250
 
251
  #elif ENABLED(ZONESTAR_LCD) // For the Tronxy Melzi boards
252
 
253
    #define LCD_PINS_RS         28
254
    #define LCD_PINS_ENABLE     29
255
    #define LCD_PINS_D4         10
256
    #define LCD_PINS_D5         11
257
    #define LCD_PINS_D6         16
258
    #define LCD_PINS_D7         17
259
    #define ADC_KEYPAD_PIN       1
260
 
261
    // Not used
262
    #define BTN_EN1             -1
263
    #define BTN_EN2             -1
264
 
265
  #else  // !LCD_I2C_PANELOLU2 && !LCD_FOR_MELZI && !ZONESTAR_LCD
266
 
267
    #define BTN_ENC             16
268
    #define LCD_SDSS            28   // Smart Controller SD card reader rather than the Melzi
269
 
270
  #endif
271
 
272
  #define SD_DETECT_PIN         -1
273
 
274
#endif // ULTRA_LCD && NEWPANEL
275
 
276
//
277
// M3/M4/M5 - Spindle/Laser Control
278
//
279
#if ENABLED(SPINDLE_LASER_ENABLE)
280
  #if !MB(AZTEEG_X1) && ENABLED(SANGUINOLOLU_V_1_2) && !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL))  // try to use IO Header
281
 
282
    #define SPINDLE_LASER_ENABLE_PIN 10   // Pin should have a pullup/pulldown!
283
    #define SPINDLE_LASER_PWM_PIN     4   // MUST BE HARDWARE PWM
284
    #define SPINDLE_DIR_PIN          11
285
 
286
  #elif !MB(MELZI)  // use X stepper motor socket
287
 
288
    /**
289
     *  To control the spindle speed and have an LCD you must sacrifice
290
     *  the Extruder and pull some signals off the X stepper driver socket.
291
     *
292
     *  The following assumes:
293
     *   - The X stepper driver socket is empty
294
     *   - The extruder driver socket has a driver board plugged into it
295
     *   - The X stepper wires are attached the the extruder connector
296
     */
297
 
298
    /**
299
     *  Where to get the spindle signals
300
     *
301
     *      spindle signal          socket name       socket name
302
     *                                         -------
303
     *                               /ENABLE  O|     |O  VMOT
304
     *                                   MS1  O|     |O  GND
305
     *                                   MS2  O|     |O  2B
306
     *                                   MS3  O|     |O  2A
307
     *                                /RESET  O|     |O  1A
308
     *                                /SLEEP  O|     |O  1B
309
     *  SPINDLE_LASER_PWM_PIN           STEP  O|     |O  VDD
310
     *  SPINDLE_LASER_ENABLE_PIN         DIR  O|     |O  GND
311
     *                                         -------
312
     *
313
     *  Note: Socket names vary from vendor to vendor.
314
     */
315
    #undef X_DIR_PIN
316
    #undef X_ENABLE_PIN
317
    #undef X_STEP_PIN
318
    #define X_DIR_PIN                 0
319
    #define X_ENABLE_PIN             14
320
    #define X_STEP_PIN                1
321
    #define SPINDLE_LASER_PWM_PIN    15   // MUST BE HARDWARE PWM
322
    #define SPINDLE_LASER_ENABLE_PIN 21   // Pin should have a pullup!
323
    #define SPINDLE_DIR_PIN          -1   // No pin available on the socket for the direction pin
324
  #endif
325
#endif // SPINDLE_LASER_ENABLE