From b378deaf8971952217f32dd74ca201645ba5f156 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 8 Jun 2017 18:05:14 -0500 Subject: [PATCH 1/5] Unify AVR90USB: fastio changes --- Marlin/boards.h | 2 +- Marlin/fastio.h | 31 +- Marlin/fastio_AT90USB-Marlin.h | 681 ------------------ ...stio_AT90USB-Teensy.h => fastio_AT90USB.h} | 20 +- Marlin/pins.h | 29 +- Marlin/ultralcd.cpp | 0 platformio.ini | 2 +- 7 files changed, 48 insertions(+), 717 deletions(-) delete mode 100644 Marlin/fastio_AT90USB-Marlin.h rename Marlin/{fastio_AT90USB-Teensy.h => fastio_AT90USB.h} (97%) mode change 100755 => 100644 Marlin/ultralcd.cpp diff --git a/Marlin/boards.h b/Marlin/boards.h index 24ab48c86d..1ce5a21401 100644 --- a/Marlin/boards.h +++ b/Marlin/boards.h @@ -71,7 +71,7 @@ #define BOARD_PRINTRBOARD_REVF 811 // Printrboard Revision F (AT90USB1286) #define BOARD_BRAINWAVE 82 // Brainwave (AT90USB646) #define BOARD_SAV_MKI 83 // SAV Mk-I (AT90USB1286) -#define BOARD_TEENSY2 84 // Teensy++2.0 (AT90USB1286) - CLI compile: DEFINES=AT90USBxx_TEENSYPP_ASSIGNMENTS HARDWARE_MOTHERBOARD=84 make +#define BOARD_TEENSY2 84 // Teensy++2.0 (AT90USB1286) - CLI compile: HARDWARE_MOTHERBOARD=84 make #define BOARD_BRAINWAVE_PRO 85 // Brainwave Pro (AT90USB1286) #define BOARD_GEN3_PLUS 9 // Gen3+ #define BOARD_GEN3_MONOLITHIC 22 // Gen3 Monolithic Electronics diff --git a/Marlin/fastio.h b/Marlin/fastio.h index 174e5f9cf6..035c9c3a2f 100644 --- a/Marlin/fastio.h +++ b/Marlin/fastio.h @@ -32,27 +32,25 @@ #include #include "macros.h" -/** - * Enable this option to use Teensy++ 2.0 assignments for AT90USB processors. - */ -//#define AT90USBxx_TEENSYPP_ASSIGNMENTS +#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__)) +#define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__)) +#define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)) +#define AVR_ATmega2561_FAMILY (defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)) +#define AVR_ATmega328_FAMILY (defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328p__)) + /** * Include Ports and Functions */ -#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__) +#if AVR_ATmega328_FAMILY #include "fastio_168.h" -#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__) +#elif AVR_ATmega1284_FAMILY #include "fastio_644.h" -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +#elif AVR_ATmega2560_FAMILY #include "fastio_1280.h" -#elif defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) - #ifdef AT90USBxx_TEENSYPP_ASSIGNMENTS - #include "fastio_AT90USB-Teensy.h" - #else - #include "fastio_AT90USB-Marlin.h" - #endif -#elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) +#elif AVR_AT90USB1286_FAMILY + #include "fastio_AT90USB.h" +#elif AVR_ATmega2561_FAMILY #include "fastio_1281.h" #else #error "Pins for this chip not defined in Arduino.h! If you have a working pins definition, please contribute!" @@ -243,11 +241,6 @@ typedef enum { /** * PWM availability macros */ -#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__)) -#define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__)) -#define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)) -#define AVR_ATmega2561_FAMILY (defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)) -#define AVR_ATmega328_FAMILY (defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328p__)) //find out which harware PWMs are already in use #if PIN_EXISTS(CONTROLLER_FAN) diff --git a/Marlin/fastio_AT90USB-Marlin.h b/Marlin/fastio_AT90USB-Marlin.h deleted file mode 100644 index 955da40c44..0000000000 --- a/Marlin/fastio_AT90USB-Marlin.h +++ /dev/null @@ -1,681 +0,0 @@ -/** - * 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 . - * - */ - -/** - * Pin mapping (Marlin) for AT90USB646, 647, 1286, and 1287 - * - * AT90USB 51 50 49 48 47 46 45 44 10 11 12 13 14 15 16 17 35 36 37 38 39 40 41 42 25 26 27 28 29 30 31 32 33 34 43 09 18 19 01 02 61 60 59 58 57 56 55 54 - * Teensy 28 29 30 31 32 33 34 35 20 21 22 23 24 25 26 27 10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07 08 09(46*47)36 37 18 19 38 39 40 41 42 43 44 45 - * Port A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 - * > Marlin 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 - * The pins 46 and 47 are not supported by Teensyduino, but are supported below. - */ - -#ifndef _FASTIO_AT90USB -#define _FASTIO_AT90USB - -#include "fastio.h" - -// change for your board -#define DEBUG_LED DIO31 /* led D5 red */ - -// SPI -#define SCK DIO9 // 21 -#define MISO DIO11 // 23 -#define MOSI DIO10 // 22 -#define SS DIO8 // 20 - -// Digital I/O - -#define DIO0_PIN PINA0 -#define DIO0_RPORT PINA -#define DIO0_WPORT PORTA -#define DIO0_PWM NULL -#define DIO0_DDR DDRA - -#define DIO1_PIN PINA1 -#define DIO1_RPORT PINA -#define DIO1_WPORT PORTA -#define DIO1_PWM NULL -#define DIO1_DDR DDRA - -#define DIO2_PIN PINA2 -#define DIO2_RPORT PINA -#define DIO2_WPORT PORTA -#define DIO2_PWM NULL -#define DIO2_DDR DDRA - -#define DIO3_PIN PINA3 -#define DIO3_RPORT PINA -#define DIO3_WPORT PORTA -#define DIO3_PWM NULL -#define DIO3_DDR DDRA - -#define DIO4_PIN PINA4 -#define DIO4_RPORT PINA -#define DIO4_WPORT PORTA -#define DIO4_PWM NULL -#define DIO4_DDR DDRA - -#define DIO5_PIN PINA5 -#define DIO5_RPORT PINA -#define DIO5_WPORT PORTA -#define DIO5_PWM NULL -#define DIO5_DDR DDRA - -#define DIO6_PIN PINA6 -#define DIO6_RPORT PINA -#define DIO6_WPORT PORTA -#define DIO6_PWM NULL -#define DIO6_DDR DDRA - -#define DIO7_PIN PINA7 -#define DIO7_RPORT PINA -#define DIO7_WPORT PORTA -#define DIO7_PWM NULL -#define DIO7_DDR DDRA - -#define DIO8_PIN PINB0 -#define DIO8_RPORT PINB -#define DIO8_WPORT PORTB -#define DIO8_PWM NULL -#define DIO8_DDR DDRB - -#define DIO9_PIN PINB1 -#define DIO9_RPORT PINB -#define DIO9_WPORT PORTB -#define DIO9_PWM NULL -#define DIO9_DDR DDRB - -#define DIO10_PIN PINB2 -#define DIO10_RPORT PINB -#define DIO10_WPORT PORTB -#define DIO10_PWM NULL -#define DIO10_DDR DDRB - -#define DIO11_PIN PINB3 -#define DIO11_RPORT PINB -#define DIO11_WPORT PORTB -#define DIO11_PWM NULL -#define DIO11_DDR DDRB - -#define DIO12_PIN PINB4 -#define DIO12_RPORT PINB -#define DIO12_WPORT PORTB -#define DIO12_PWM NULL -#define DIO12_DDR DDRB - -#define DIO13_PIN PINB5 -#define DIO13_RPORT PINB -#define DIO13_WPORT PORTB -#define DIO13_PWM NULL -#define DIO13_DDR DDRB - -#define DIO14_PIN PINB6 -#define DIO14_RPORT PINB -#define DIO14_WPORT PORTB -#define DIO14_PWM NULL -#define DIO14_DDR DDRB - -#define DIO15_PIN PINB7 -#define DIO15_RPORT PINB -#define DIO15_WPORT PORTB -#define DIO15_PWM NULL -#define DIO15_DDR DDRB - -#define DIO16_PIN PINC0 -#define DIO16_RPORT PINC -#define DIO16_WPORT PORTC -#define DIO16_PWM NULL -#define DIO16_DDR DDRC - -#define DIO17_PIN PINC1 -#define DIO17_RPORT PINC -#define DIO17_WPORT PORTC -#define DIO17_PWM NULL -#define DIO17_DDR DDRC - -#define DIO18_PIN PINC2 -#define DIO18_RPORT PINC -#define DIO18_WPORT PORTC -#define DIO18_PWM NULL -#define DIO18_DDR DDRC - -#define DIO19_PIN PINC3 -#define DIO19_RPORT PINC -#define DIO19_WPORT PORTC -#define DIO19_PWM NULL -#define DIO19_DDR DDRC - -#define DIO20_PIN PINC4 -#define DIO20_RPORT PINC -#define DIO20_WPORT PORTC -#define DIO20_PWM NULL -#define DIO20_DDR DDRC - -#define DIO21_PIN PINC5 -#define DIO21_RPORT PINC -#define DIO21_WPORT PORTC -#define DIO21_PWM NULL -#define DIO21_DDR DDRC - -#define DIO22_PIN PINC6 -#define DIO22_RPORT PINC -#define DIO22_WPORT PORTC -#define DIO22_PWM NULL -#define DIO22_DDR DDRC - -#define DIO23_PIN PINC7 -#define DIO23_RPORT PINC -#define DIO23_WPORT PORTC -#define DIO23_PWM NULL -#define DIO23_DDR DDRC - -#define DIO24_PIN PIND0 -#define DIO24_RPORT PIND -#define DIO24_WPORT PORTD -#define DIO24_PWM NULL -#define DIO24_DDR DDRD - -#define DIO25_PIN PIND1 -#define DIO25_RPORT PIND -#define DIO25_WPORT PORTD -#define DIO25_PWM NULL -#define DIO25_DDR DDRD - -#define DIO26_PIN PIND2 -#define DIO26_RPORT PIND -#define DIO26_WPORT PORTD -#define DIO26_PWM NULL -#define DIO26_DDR DDRD - -#define DIO27_PIN PIND3 -#define DIO27_RPORT PIND -#define DIO27_WPORT PORTD -#define DIO27_PWM NULL -#define DIO27_DDR DDRD - -#define DIO28_PIN PIND4 -#define DIO28_RPORT PIND -#define DIO28_WPORT PORTD -#define DIO28_PWM NULL -#define DIO28_DDR DDRD - -#define DIO29_PIN PIND5 -#define DIO29_RPORT PIND -#define DIO29_WPORT PORTD -#define DIO29_PWM NULL -#define DIO29_DDR DDRD - -#define DIO30_PIN PIND6 -#define DIO30_RPORT PIND -#define DIO30_WPORT PORTD -#define DIO30_PWM NULL -#define DIO30_DDR DDRD - -#define DIO31_PIN PIND7 -#define DIO31_RPORT PIND -#define DIO31_WPORT PORTD -#define DIO31_PWM NULL -#define DIO31_DDR DDRD - -#define DIO32_PIN PINE0 -#define DIO32_RPORT PINE -#define DIO32_WPORT PORTE -#define DIO32_PWM NULL -#define DIO32_DDR DDRE - -#define DIO33_PIN PINE1 -#define DIO33_RPORT PINE -#define DIO33_WPORT PORTE -#define DIO33_PWM NULL -#define DIO33_DDR DDRE - -#define DIO34_PIN PINE2 -#define DIO34_RPORT PINE -#define DIO34_WPORT PORTE -#define DIO34_PWM NULL -#define DIO34_DDR DDRE - -#define DIO35_PIN PINE3 -#define DIO35_RPORT PINE -#define DIO35_WPORT PORTE -#define DIO35_PWM NULL -#define DIO35_DDR DDRE - -#define DIO36_PIN PINE4 -#define DIO36_RPORT PINE -#define DIO36_WPORT PORTE -#define DIO36_PWM NULL -#define DIO36_DDR DDRE - -#define DIO37_PIN PINE5 -#define DIO37_RPORT PINE -#define DIO37_WPORT PORTE -#define DIO37_PWM NULL -#define DIO37_DDR DDRE - -#define DIO38_PIN PINE6 -#define DIO38_RPORT PINE -#define DIO38_WPORT PORTE -#define DIO38_PWM NULL -#define DIO38_DDR DDRE - -#define DIO39_PIN PINE7 -#define DIO39_RPORT PINE -#define DIO39_WPORT PORTE -#define DIO39_PWM NULL -#define DIO39_DDR DDRE - -#define AIO0_PIN PINF0 -#define AIO0_RPORT PINF -#define AIO0_WPORT PORTF -#define AIO0_PWM NULL -#define AIO0_DDR DDRF - -#define AIO1_PIN PINF1 -#define AIO1_RPORT PINF -#define AIO1_WPORT PORTF -#define AIO1_PWM NULL -#define AIO1_DDR DDRF - -#define AIO2_PIN PINF2 -#define AIO2_RPORT PINF -#define AIO2_WPORT PORTF -#define AIO2_PWM NULL -#define AIO2_DDR DDRF - -#define AIO3_PIN PINF3 -#define AIO3_RPORT PINF -#define AIO3_WPORT PORTF -#define AIO3_PWM NULL -#define AIO3_DDR DDRF - -#define AIO4_PIN PINF4 -#define AIO4_RPORT PINF -#define AIO4_WPORT PORTF -#define AIO4_PWM NULL -#define AIO4_DDR DDRF - -#define AIO5_PIN PINF5 -#define AIO5_RPORT PINF -#define AIO5_WPORT PORTF -#define AIO5_PWM NULL -#define AIO5_DDR DDRF - -#define AIO6_PIN PINF6 -#define AIO6_RPORT PINF -#define AIO6_WPORT PORTF -#define AIO6_PWM NULL -#define AIO6_DDR DDRF - -#define AIO7_PIN PINF7 -#define AIO7_RPORT PINF -#define AIO7_WPORT PORTF -#define AIO7_PWM NULL -#define AIO7_DDR DDRF - -#define DIO40_PIN PINF0 -#define DIO40_RPORT PINF -#define DIO40_WPORT PORTF -#define DIO40_PWM NULL -#define DIO40_DDR DDRF - -#define DIO41_PIN PINF1 -#define DIO41_RPORT PINF -#define DIO41_WPORT PORTF -#define DIO41_PWM NULL -#define DIO41_DDR DDRF - -#define DIO42_PIN PINF2 -#define DIO42_RPORT PINF -#define DIO42_WPORT PORTF -#define DIO42_PWM NULL -#define DIO42_DDR DDRF - -#define DIO43_PIN PINF3 -#define DIO43_RPORT PINF -#define DIO43_WPORT PORTF -#define DIO43_PWM NULL -#define DIO43_DDR DDRF - -#define DIO44_PIN PINF4 -#define DIO44_RPORT PINF -#define DIO44_WPORT PORTF -#define DIO44_PWM NULL -#define DIO44_DDR DDRF - -#define DIO45_PIN PINF5 -#define DIO45_RPORT PINF -#define DIO45_WPORT PORTF -#define DIO45_PWM NULL -#define DIO45_DDR DDRF - -#define DIO46_PIN PINF6 -#define DIO46_RPORT PINF -#define DIO46_WPORT PORTF -#define DIO46_PWM NULL -#define DIO46_DDR DDRF - -#define DIO47_PIN PINF7 -#define DIO47_RPORT PINF -#define DIO47_WPORT PORTF -#define DIO47_PWM NULL -#define DIO47_DDR DDRF - -// Analog Outputs - -#undef PA0 -#define PA0_PIN PINA0 -#define PA0_RPORT PINA -#define PA0_WPORT PORTA -#define PA0_PWM NULL -#define PA0_DDR DDRA -#undef PA1 -#define PA1_PIN PINA1 -#define PA1_RPORT PINA -#define PA1_WPORT PORTA -#define PA1_PWM NULL -#define PA1_DDR DDRA -#undef PA2 -#define PA2_PIN PINA2 -#define PA2_RPORT PINA -#define PA2_WPORT PORTA -#define PA2_PWM NULL -#define PA2_DDR DDRA -#undef PA3 -#define PA3_PIN PINA3 -#define PA3_RPORT PINA -#define PA3_WPORT PORTA -#define PA3_PWM NULL -#define PA3_DDR DDRA -#undef PA4 -#define PA4_PIN PINA4 -#define PA4_RPORT PINA -#define PA4_WPORT PORTA -#define PA4_PWM NULL -#define PA4_DDR DDRA -#undef PA5 -#define PA5_PIN PINA5 -#define PA5_RPORT PINA -#define PA5_WPORT PORTA -#define PA5_PWM NULL -#define PA5_DDR DDRA -#undef PA6 -#define PA6_PIN PINA6 -#define PA6_RPORT PINA -#define PA6_WPORT PORTA -#define PA6_PWM NULL -#define PA6_DDR DDRA -#undef PA7 -#define PA7_PIN PINA7 -#define PA7_RPORT PINA -#define PA7_WPORT PORTA -#define PA7_PWM NULL -#define PA7_DDR DDRA - -#undef PB0 -#define PB0_PIN PINB0 -#define PB0_RPORT PINB -#define PB0_WPORT PORTB -#define PB0_PWM NULL -#define PB0_DDR DDRB -#undef PB1 -#define PB1_PIN PINB1 -#define PB1_RPORT PINB -#define PB1_WPORT PORTB -#define PB1_PWM NULL -#define PB1_DDR DDRB -#undef PB2 -#define PB2_PIN PINB2 -#define PB2_RPORT PINB -#define PB2_WPORT PORTB -#define PB2_PWM NULL -#define PB2_DDR DDRB -#undef PB3 -#define PB3_PIN PINB3 -#define PB3_RPORT PINB -#define PB3_WPORT PORTB -#define PB3_PWM NULL -#define PB3_DDR DDRB -#undef PB4 -#define PB4_PIN PINB4 -#define PB4_RPORT PINB -#define PB4_WPORT PORTB -#define PB4_PWM NULL -#define PB4_DDR DDRB -#undef PB5 -#define PB5_PIN PINB5 -#define PB5_RPORT PINB -#define PB5_WPORT PORTB -#define PB5_PWM NULL -#define PB5_DDR DDRB -#undef PB6 -#define PB6_PIN PINB6 -#define PB6_RPORT PINB -#define PB6_WPORT PORTB -#define PB6_PWM NULL -#define PB6_DDR DDRB -#undef PB7 -#define PB7_PIN PINB7 -#define PB7_RPORT PINB -#define PB7_WPORT PORTB -#define PB7_PWM NULL -#define PB7_DDR DDRB - -#undef PC0 -#define PC0_PIN PINC0 -#define PC0_RPORT PINC -#define PC0_WPORT PORTC -#define PC0_PWM NULL -#define PC0_DDR DDRC -#undef PC1 -#define PC1_PIN PINC1 -#define PC1_RPORT PINC -#define PC1_WPORT PORTC -#define PC1_PWM NULL -#define PC1_DDR DDRC -#undef PC2 -#define PC2_PIN PINC2 -#define PC2_RPORT PINC -#define PC2_WPORT PORTC -#define PC2_PWM NULL -#define PC2_DDR DDRC -#undef PC3 -#define PC3_PIN PINC3 -#define PC3_RPORT PINC -#define PC3_WPORT PORTC -#define PC3_PWM NULL -#define PC3_DDR DDRC -#undef PC4 -#define PC4_PIN PINC4 -#define PC4_RPORT PINC -#define PC4_WPORT PORTC -#define PC4_PWM NULL -#define PC4_DDR DDRC -#undef PC5 -#define PC5_PIN PINC5 -#define PC5_RPORT PINC -#define PC5_WPORT PORTC -#define PC5_PWM NULL -#define PC5_DDR DDRC -#undef PC6 -#define PC6_PIN PINC6 -#define PC6_RPORT PINC -#define PC6_WPORT PORTC -#define PC6_PWM NULL -#define PC6_DDR DDRC -#undef PC7 -#define PC7_PIN PINC7 -#define PC7_RPORT PINC -#define PC7_WPORT PORTC -#define PC7_PWM NULL -#define PC7_DDR DDRC - -#undef PD0 -#define PD0_PIN PIND0 -#define PD0_RPORT PIND -#define PD0_WPORT PORTD -#define PD0_PWM NULL -#define PD0_DDR DDRD -#undef PD1 -#define PD1_PIN PIND1 -#define PD1_RPORT PIND -#define PD1_WPORT PORTD -#define PD1_PWM NULL -#define PD1_DDR DDRD -#undef PD2 -#define PD2_PIN PIND2 -#define PD2_RPORT PIND -#define PD2_WPORT PORTD -#define PD2_PWM NULL -#define PD2_DDR DDRD -#undef PD3 -#define PD3_PIN PIND3 -#define PD3_RPORT PIND -#define PD3_WPORT PORTD -#define PD3_PWM NULL -#define PD3_DDR DDRD -#undef PD4 -#define PD4_PIN PIND4 -#define PD4_RPORT PIND -#define PD4_WPORT PORTD -#define PD4_PWM NULL -#define PD4_DDR DDRD -#undef PD5 -#define PD5_PIN PIND5 -#define PD5_RPORT PIND -#define PD5_WPORT PORTD -#define PD5_PWM NULL -#define PD5_DDR DDRD -#undef PD6 -#define PD6_PIN PIND6 -#define PD6_RPORT PIND -#define PD6_WPORT PORTD -#define PD6_PWM NULL -#define PD6_DDR DDRD -#undef PD7 -#define PD7_PIN PIND7 -#define PD7_RPORT PIND -#define PD7_WPORT PORTD -#define PD7_PWM NULL -#define PD7_DDR DDRD - -#undef PE0 -#define PE0_PIN PINE0 -#define PE0_RPORT PINE -#define PE0_WPORT PORTE -#define PE0_PWM NULL -#define PE0_DDR DDRE -#undef PE1 -#define PE1_PIN PINE1 -#define PE1_RPORT PINE -#define PE1_WPORT PORTE -#define PE1_PWM NULL -#define PE1_DDR DDRE -#undef PE2 -#define PE2_PIN PINE2 -#define PE2_RPORT PINE -#define PE2_WPORT PORTE -#define PE2_PWM NULL -#define PE2_DDR DDRE -#undef PE3 -#define PE3_PIN PINE3 -#define PE3_RPORT PINE -#define PE3_WPORT PORTE -#define PE3_PWM NULL -#define PE3_DDR DDRE -#undef PE4 -#define PE4_PIN PINE4 -#define PE4_RPORT PINE -#define PE4_WPORT PORTE -#define PE4_PWM NULL -#define PE4_DDR DDRE -#undef PE5 -#define PE5_PIN PINE5 -#define PE5_RPORT PINE -#define PE5_WPORT PORTE -#define PE5_PWM NULL -#define PE5_DDR DDRE -#undef PE6 -#define PE6_PIN PINE6 -#define PE6_RPORT PINE -#define PE6_WPORT PORTE -#define PE6_PWM NULL -#define PE6_DDR DDRE -#undef PE7 -#define PE7_PIN PINE7 -#define PE7_RPORT PINE -#define PE7_WPORT PORTE -#define PE7_PWM NULL -#define PE7_DDR DDRE - -#undef PF0 -#define PF0_PIN PINF0 -#define PF0_RPORT PINF -#define PF0_WPORT PORTF -#define PF0_PWM NULL -#define PF0_DDR DDRF -#undef PF1 -#define PF1_PIN PINF1 -#define PF1_RPORT PINF -#define PF1_WPORT PORTF -#define PF1_PWM NULL -#define PF1_DDR DDRF -#undef PF2 -#define PF2_PIN PINF2 -#define PF2_RPORT PINF -#define PF2_WPORT PORTF -#define PF2_PWM NULL -#define PF2_DDR DDRF -#undef PF3 -#define PF3_PIN PINF3 -#define PF3_RPORT PINF -#define PF3_WPORT PORTF -#define PF3_PWM NULL -#define PF3_DDR DDRF -#undef PF4 -#define PF4_PIN PINF4 -#define PF4_RPORT PINF -#define PF4_WPORT PORTF -#define PF4_PWM NULL -#define PF4_DDR DDRF -#undef PF5 -#define PF5_PIN PINF5 -#define PF5_RPORT PINF -#define PF5_WPORT PORTF -#define PF5_PWM NULL -#define PF5_DDR DDRF -#undef PF6 -#define PF6_PIN PINF6 -#define PF6_RPORT PINF -#define PF6_WPORT PORTF -#define PF6_PWM NULL -#define PF6_DDR DDRF -#undef PF7 -#define PF7_PIN PINF7 -#define PF7_RPORT PINF -#define PF7_WPORT PORTF -#define PF7_PWM NULL -#define PF7_DDR DDRF - -#endif // _FASTIO_AT90USB diff --git a/Marlin/fastio_AT90USB-Teensy.h b/Marlin/fastio_AT90USB.h similarity index 97% rename from Marlin/fastio_AT90USB-Teensy.h rename to Marlin/fastio_AT90USB.h index 0cf94454ad..c643291f77 100644 --- a/Marlin/fastio_AT90USB-Teensy.h +++ b/Marlin/fastio_AT90USB.h @@ -26,8 +26,7 @@ * AT90USB 51 50 49 48 47 46 45 44 10 11 12 13 14 15 16 17 35 36 37 38 39 40 41 42 25 26 27 28 29 30 31 32 33 34 43 09 18 19 01 02 61 60 59 58 57 56 55 54 * > Teensy 28 29 30 31 32 33 34 35 20 21 22 23 24 25 26 27 10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07 08 09(46*47)36 37 18 19 38 39 40 41 42 43 44 45 * Port A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 - * Marlin 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 - * The pins 46 and 47 are not supported by Teensyduino, but are supported below. + * The pins 46 and 47 are not supported by Teensyduino, but are supported below as E2 and E3 */ #ifndef _FASTIO_AT90USB @@ -679,4 +678,21 @@ #define PF7_PWM NULL #define PF7_DDR DDRF + +/** + * some of the pin mapping functions of the Teensduino extension to the Arduino IDE + * do not function the same as the other Arduino extensions + */ + +//digitalPinToTimer(pin) function works like Arduino but Timers are not defined +#define TIMER0B 1 +#define TIMER1A 7 +#define TIMER1B 8 +#define TIMER1C 9 +#define TIMER2A 6 +#define TIMER2B 2 +#define TIMER3A 5 +#define TIMER3B 4 +#define TIMER3C 3 + #endif // _FASTIO_AT90USB diff --git a/Marlin/pins.h b/Marlin/pins.h index e4c5e4f5e1..689e305d92 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -20,6 +20,18 @@ * */ +/** + * Include pins definitions + * + * Pins numbering schemes: + * + * - Digital I/O pin number if used by READ/WRITE macros. (e.g., X_STEP_DIR) + * The FastIO headers map digital pins to their ports and functions. + * + * - Analog Input number if used by analogRead or DAC. (e.g., TEMP_n_PIN) + * These numbers are the same in any pin mapping. + */ + #ifndef __PINS_H__ #define __PINS_H__ @@ -537,19 +549,10 @@ #define AVR_MOSI_PIN 51 #define AVR_SS_PIN 53 #elif defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) - #if ENABLED(AT90USBxx_TEENSYPP_ASSIGNMENTS) - // Teensy pin assignments - #define AVR_SCK_PIN 21 - #define AVR_MISO_PIN 23 - #define AVR_MOSI_PIN 22 - #define AVR_SS_PIN 20 - #else - // Traditional pin assignments - #define AVR_SCK_PIN 9 - #define AVR_MISO_PIN 11 - #define AVR_MOSI_PIN 10 - #define AVR_SS_PIN 8 - #endif + #define AVR_SCK_PIN 21 + #define AVR_MISO_PIN 23 + #define AVR_MOSI_PIN 22 + #define AVR_SS_PIN 20 #elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) #define AVR_SCK_PIN 10 #define AVR_MISO_PIN 12 diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp old mode 100755 new mode 100644 diff --git a/platformio.ini b/platformio.ini index c82fe48696..c5ef19140f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -50,7 +50,7 @@ lib_deps = ${common.lib_deps} platform = teensy framework = arduino board = teensy20pp -build_flags = -I $BUILDSRC_DIR -D MOTHERBOARD=BOARD_BRAINWAVE_PRO -D AT90USBxx_TEENSYPP_ASSIGNMENTS +build_flags = -I $BUILDSRC_DIR -D MOTHERBOARD=BOARD_BRAINWAVE_PRO lib_deps = ${common.lib_deps} [env:rambo] From 87d82232513b999a14f050d7134dc439bb4535c6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 8 Jun 2017 18:07:37 -0500 Subject: [PATCH 2/5] Unify AVR90USB: Pins remap to Arduino --- Marlin/pins_5DPRINT.h | 107 +++++++++++++++------- Marlin/pins_BRAINWAVE.h | 64 +++++++------ Marlin/pins_BRAINWAVE_PRO.h | 93 ++++++++----------- Marlin/pins_PRINTRBOARD.h | 163 +++++++++++++++++++-------------- Marlin/pins_PRINTRBOARD_REVF.h | 154 +++++++++++++++++-------------- Marlin/pins_SAV_MKI.h | 150 ++++++++++++++++++------------ Marlin/pins_TEENSY2.h | 124 ++++++++++++++++--------- Marlin/pins_TEENSYLU.h | 161 +++++++++++++++----------------- 8 files changed, 569 insertions(+), 447 deletions(-) mode change 100644 => 100755 Marlin/pins_5DPRINT.h mode change 100644 => 100755 Marlin/pins_BRAINWAVE.h mode change 100644 => 100755 Marlin/pins_BRAINWAVE_PRO.h mode change 100644 => 100755 Marlin/pins_PRINTRBOARD.h mode change 100644 => 100755 Marlin/pins_PRINTRBOARD_REVF.h mode change 100644 => 100755 Marlin/pins_SAV_MKI.h mode change 100644 => 100755 Marlin/pins_TEENSY2.h mode change 100644 => 100755 Marlin/pins_TEENSYLU.h diff --git a/Marlin/pins_5DPRINT.h b/Marlin/pins_5DPRINT.h old mode 100644 new mode 100755 index f44a56887d..f56ec0b678 --- a/Marlin/pins_5DPRINT.h +++ b/Marlin/pins_5DPRINT.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -20,6 +20,47 @@ * */ +/** + * Rev B 2 JUN 2017 + * + * Converted to Arduino pin numbering + */ + +/** + * There are two Arduino IDE extensions that are compatible with this board + * and with the mainstream Marlin software. + * + * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu + * + * Installation instructions are at the above URL. Don't bother loading the + * libraries - they are not used with the Marlin software. + * + * Printrboard - https://github.com/scwimbush/Printrboard-HID-Arduino-IDE-Support + * + * Installation: + * + * 1. Go to the above URL, click on the "Clone or Download" button and then + * click on "Download ZIP" button. + * 2. Unzip the file, find the "printrboard" directory and then copy it to the + * hardware directory in Arduino. The Arduino hardware directory will probably + * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. + * 3. Restart Arduino. + * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * + * Teensyduino is the most popular option. Printrboard is used if your board doesn't have + * the Teensyduino bootloader on it. + */ + +/** + * To burn the bootloader that comes with Printrboard: + * + * 1. Connect your programmer to the board. + * 2. In the Arduino IDE select "Printrboard" and then select the programmer. + * 3. In the Arduino IDE click on "burn bootloader". Don't worry about the "verify failed at 1F000" error message. + * 4. The programmer is no longer needed. Remove it. + */ + /** * 5DPrint D8 Driver board pin assignments * @@ -27,7 +68,7 @@ */ #ifndef __AVR_AT90USB1286__ - #error "Oops! Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu." + #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." #endif #define DEFAULT_MACHINE_NAME "Makibox" @@ -39,56 +80,54 @@ // // Limit Switches // -#define X_STOP_PIN 37 -#define Y_STOP_PIN 36 -#define Z_STOP_PIN 39 +#define X_STOP_PIN 37 // E5 +#define Y_STOP_PIN 36 // E4 +#define Z_STOP_PIN 19 // E7 // // Steppers // -#define X_STEP_PIN 0 -#define X_DIR_PIN 1 -#define X_ENABLE_PIN 23 +#define X_STEP_PIN 28 // A0 +#define X_DIR_PIN 29 // A1 +#define X_ENABLE_PIN 17 // C7 -#define Y_STEP_PIN 2 -#define Y_DIR_PIN 3 -#define Y_ENABLE_PIN 19 +#define Y_STEP_PIN 30 // A2 +#define Y_DIR_PIN 31 // A3 +#define Y_ENABLE_PIN 13 // C3 -#define Z_STEP_PIN 4 -#define Z_DIR_PIN 5 -#define Z_ENABLE_PIN 18 +#define Z_STEP_PIN 32 // A4 +#define Z_DIR_PIN 33 // A5 +#define Z_ENABLE_PIN 12 // C2 -#define E0_STEP_PIN 6 -#define E0_DIR_PIN 7 -#define E0_ENABLE_PIN 17 +#define E0_STEP_PIN 34 // A6 +#define E0_DIR_PIN 35 // A7 +#define E0_ENABLE_PIN 11 // C1 -// Microstepping pins - Mapping not from fastio.h (?) -#define X_MS1_PIN 25 -#define X_MS2_PIN 26 -#define Y_MS1_PIN 9 -#define Y_MS2_PIN 8 -#define Z_MS1_PIN 7 -#define Z_MS2_PIN 6 -#define E0_MS1_PIN 5 -#define E0_MS2_PIN 4 + +#define X_MS1_PIN 25 // B5 +#define X_MS2_PIN 26 // B6 +#define Y_MS1_PIN 9 // E1 +#define Y_MS2_PIN 8 // E0 +#define Z_MS1_PIN 7 // D7 +#define Z_MS2_PIN 6 // D6 +#define E0_MS1_PIN 5 // D5 +#define E0_MS2_PIN 4 // D4 // // Temperature Sensors // -#define TEMP_0_PIN 1 // Analog Input -#define TEMP_BED_PIN 0 // Analog Input +#define TEMP_0_PIN 1 // F1 Analog Input +#define TEMP_BED_PIN 0 // F0 Analog Input // // Heaters / Fans // -#define HEATER_0_PIN 21 -#define HEATER_BED_PIN 20 +#define HEATER_0_PIN 15 // C5 +#define HEATER_BED_PIN 14 // C4 -// You may need to change FAN_PIN to 16 because Marlin isn't using fastio.h -// for the fan and Teensyduino uses a different pin mapping. -#define FAN_PIN 16 +#define FAN_PIN 16 // C6 PWM3A // // Misc. Functions // -#define SDSS 20 +#define SDSS 20 // B0 diff --git a/Marlin/pins_BRAINWAVE.h b/Marlin/pins_BRAINWAVE.h old mode 100644 new mode 100755 index 83e7a35a96..2776c50062 --- a/Marlin/pins_BRAINWAVE.h +++ b/Marlin/pins_BRAINWAVE.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -34,6 +34,12 @@ * allow this board to use the latest Marlin software */ +/** + * Rev C 2 JUN 2017 + * + * Converted to Arduino pin numbering + */ + /** * Marlin_AT90USB - https://github.com/Bob-the-Kuhn/Marlin_AT90USB * This is the only known IDE extension that is compatible with the pin definitions @@ -49,20 +55,20 @@ * https://rawgit.com/Bob-the-Kuhn/Marlin_AT90USB/master/package_MARLIN_AT90USB_index.json * 2. Under Tools -> Board -> Boards manager, scroll to the bottom, click on MARLIN_AT90USB * and then click on "Install" - * 3. Select "AT90USB646_STANDARD" from the 'Tools -> Boards' menu. + * 3. Select "AT90USB646_TEENSYPP" from the 'Tools -> Boards' menu. */ /** * To burn the bootloader that comes with Marlin_AT90USB: * * 1. Connect your programmer to the board. - * 2. In Arduino IDE select "AT90USB646_STANDARD" and then select the programmer. + * 2. In Arduino IDE select "AT90USB646_TEENSYPP" and then select the programmer. * 3. In Arduino IDE click on "burn bootloader". Don't worry about the "verify failed at 1F000" error message. * 4. The programmer is no longer needed. Remove it. */ #ifndef __AVR_AT90USB646__ - #error "Oops! Make sure you have 'Brainwave' selected from the 'Tools -> Boards' menu." + #error "Oops! Make sure you have 'AT90USB646_TEENSYPP' selected from the 'Tools -> Boards' menu." #endif #define BOARD_NAME "Brainwave" @@ -72,48 +78,48 @@ // // Limit Switches // -#define X_STOP_PIN 7 -#define Y_STOP_PIN 6 -#define Z_STOP_PIN 5 +#define X_STOP_PIN 35 // A7 +#define Y_STOP_PIN 34 // A6 +#define Z_STOP_PIN 33 // A5 // // Steppers // -#define X_STEP_PIN 27 -#define X_DIR_PIN 29 -#define X_ENABLE_PIN 28 -#define X_ATT_PIN 26 +#define X_STEP_PIN 3 // D3 +#define X_DIR_PIN 5 // D5 +#define X_ENABLE_PIN 4 // D4 +#define X_ATT_PIN 2 // D2 -#define Y_STEP_PIN 31 -#define Y_DIR_PIN 33 -#define Y_ENABLE_PIN 32 -#define Y_ATT_PIN 30 +#define Y_STEP_PIN 7 // D7 +#define Y_DIR_PIN 9 // E1 +#define Y_ENABLE_PIN 8 // E0 +#define Y_ATT_PIN 6 // D6 -#define Z_STEP_PIN 17 -#define Z_DIR_PIN 19 -#define Z_ENABLE_PIN 18 -#define Z_ATT_PIN 16 +#define Z_STEP_PIN 11 // C1 +#define Z_DIR_PIN 13 // C3 +#define Z_ENABLE_PIN 12 // C2 +#define Z_ATT_PIN 10 // C0 -#define E0_STEP_PIN 21 -#define E0_DIR_PIN 23 -#define E0_ENABLE_PIN 22 -#define E0_ATT_PIN 20 +#define E0_STEP_PIN 15 // C5 +#define E0_DIR_PIN 17 // C7 +#define E0_ENABLE_PIN 16 // C6 +#define E0_ATT_PIN 14 // C4 // // Temperature Sensors // -#define TEMP_0_PIN 7 // Analog Input -#define TEMP_BED_PIN 6 // Analog Input +#define TEMP_0_PIN 7 // F7 Analog Input +#define TEMP_BED_PIN 6 // F6 Analog Input // // Heaters / Fans // -#define HEATER_0_PIN 4 // Extruder -#define HEATER_BED_PIN 38 // Bed +#define HEATER_0_PIN 32 // A4 Extruder +#define HEATER_BED_PIN 18 // E6 Bed -#define FAN_PIN 3 // Fan +#define FAN_PIN 31 // A3 Fan // // Misc. Functions // -#define LED_PIN 39 +#define LED_PIN 19 // E7 diff --git a/Marlin/pins_BRAINWAVE_PRO.h b/Marlin/pins_BRAINWAVE_PRO.h old mode 100644 new mode 100755 index 02835ca27e..ef780d5797 --- a/Marlin/pins_BRAINWAVE_PRO.h +++ b/Marlin/pins_BRAINWAVE_PRO.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -32,11 +32,16 @@ * * Added pointers to currently available Arduino IDE extensions that will * allow this board to use the latest Marlin software + * + * + * Rev C 2 JUN 2017 + * + * Converted to Arduino pin numbering */ /** - * There are three Arduino IDE extensions that are compatible with this board - * and with the mainstream Marlin software. All have been used with Arduino 1.6.12 + * There are two Arduino IDE extensions that are compatible with this board + * and with the mainstream Marlin software. * * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu @@ -45,8 +50,6 @@ * libraries - they are not used with the Marlin software. * * Printrboard - https://github.com/scwimbush/Printrboard-HID-Arduino-IDE-Support - * This is basically Teensyduino but with a bootloader that can handle image sizes - * larger than 64K. * * Installation: * @@ -54,43 +57,25 @@ * click on "Download ZIP" button. * 2. Unzip the file, find the "printrboard" directory and then copy it to the * hardware directory in Arduino. The Arduino hardware directory will probably - * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. + * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. * 3. Restart Arduino. * 4. Select "Printrboard" from the 'Tools -> Boards' menu. * - * Marlin_AT90USB - https://github.com/Bob-the-Kuhn/Marlin_AT90USB - * Uses the bootloader from Printerboard above. - * - * "Marlin_AT90USB" makes PWM0A available rather than the usual PWM1C. These PWMs share - * the same physical pin. Marlin uses TIMER1 to generate interrupts and sets it up such - * that PWM1A, PWM1B & PWM1C can't be used. - * - * Installation: - * - * 1. In the Arduino IDE, under Files -> Preferences paste the following URL - * https://rawgit.com/Bob-the-Kuhn/Marlin_AT90USB/master/package_MARLIN_AT90USB_index.json - * 2. Under Tools -> Board -> Boards manager, scroll to the bottom, click on MARLIN_AT90USB - * and then click on "Install" - * 3. Select "AT90USB1286_TEENSYPP" from the 'Tools -> Boards' menu. + * Teensyduino is the most popular option. Printrboard is used if your board doesn't have + * the Teensyduino bootloader on it. */ /** - * To burn the bootloader that comes with Printrboard and Marlin_AT90USB: + * To burn the bootloader that comes with Printrboard: * * 1. Connect your programmer to the board. - * 2. In the Arduino IDE select "Printrboard" or "AT90USB1286_TEENSYPP" and then select the programmer. + * 2. In the Arduino IDE select "Printrboard" and then select the programmer. * 3. In the Arduino IDE click on "burn bootloader". Don't worry about the "verify failed at 1F000" error message. * 4. The programmer is no longer needed. Remove it. */ #ifndef __AVR_AT90USB1286__ - #error "Oops! Make sure you have 'Teensy++ 2.0', 'AT90USB1286_TEENSYPP', or 'Printrboard' selected from the 'Tools -> Boards' menu." -#endif - -#include "fastio.h" - -#if DISABLED(AT90USBxx_TEENSYPP_ASSIGNMENTS) // use Teensyduino Teensy++2.0 pin assignments instead of Marlin alphabetical. - #error "Uncomment '#define AT90USBxx_TEENSYPP_ASSIGNMENTS' in fastio.h for this config" + #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." #endif #define BOARD_NAME "Brainwave Pro" @@ -101,53 +86,53 @@ // // Limit Switches // -#define X_STOP_PIN 47 -#define Y_STOP_PIN 18 -#define Z_MAX_PIN 36 +#define X_STOP_PIN 45 // F7 +#define Y_STOP_PIN 12 // C2 +#define Z_STOP_PIN 36 // E4 // // Z Probe (when not Z_MIN_PIN) // #ifndef Z_MIN_PROBE_PIN - #define Z_MIN_PROBE_PIN 17 + #define Z_MIN_PROBE_PIN 11 // C1 #endif // // Steppers // -#define X_STEP_PIN 33 -#define X_DIR_PIN 32 -#define X_ENABLE_PIN 11 +#define X_STEP_PIN 9 // E1 +#define X_DIR_PIN 8 // E0 +#define X_ENABLE_PIN 23 // B3 -#define Y_STEP_PIN 31 -#define Y_DIR_PIN 30 -#define Y_ENABLE_PIN 8 +#define Y_STEP_PIN 7 // D7 +#define Y_DIR_PIN 6 // D6 +#define Y_ENABLE_PIN 20 // B0 -#define Z_STEP_PIN 29 -#define Z_DIR_PIN 28 -#define Z_ENABLE_PIN 37 +#define Z_STEP_PIN 5 // D5 +#define Z_DIR_PIN 4 // D4 +#define Z_ENABLE_PIN 37 // E5 -#define E0_STEP_PIN 35 -#define E0_DIR_PIN 34 -#define E0_ENABLE_PIN 13 +#define E0_STEP_PIN 47 // E3 +#define E0_DIR_PIN 46 // E2 +#define E0_ENABLE_PIN 25 // B5 // // Temperature Sensors // -#define TEMP_0_PIN 2 // Analog Input -#define TEMP_1_PIN 1 // Analog Input -#define TEMP_BED_PIN 0 // Analog Input +#define TEMP_0_PIN 2 // F2 Analog Input +#define TEMP_1_PIN 1 // F1 Analog Input +#define TEMP_BED_PIN 0 // F0 Analog Input // // Heaters / Fans // -#define HEATER_0_PIN 15 -#define HEATER_BED_PIN 14 // Bed -#define FAN_PIN 16 // Fan, PWM +#define HEATER_0_PIN 27 // B7 +#define HEATER_BED_PIN 26 // B6 Bed +#define FAN_PIN 16 // C6 Fan, PWM3A // // Misc. Functions // -#define SDSS 20 -#define SD_DETECT_PIN 12 -#define LED_PIN 19 +#define SDSS 20 // B0 +#define SD_DETECT_PIN 24 // B4 +#define LED_PIN 13 // C3 diff --git a/Marlin/pins_PRINTRBOARD.h b/Marlin/pins_PRINTRBOARD.h old mode 100644 new mode 100755 index a679340e74..7dec695d57 --- a/Marlin/pins_PRINTRBOARD.h +++ b/Marlin/pins_PRINTRBOARD.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,18 +21,48 @@ */ /** - * Printrboard pin assignments (AT90USB1286) - * Requires the Teensyduino software with Teensy++ 2.0 selected in Arduino IDE! - * http://www.pjrc.com/teensy/teensyduino.html - * See http://reprap.org/wiki/Printrboard for more info + * Rev B 2 JUN 2017 + * + * Converted to Arduino pin numbering + */ + +/** + * There are two Arduino IDE extensions that are compatible with this board + * and with the mainstream Marlin software. + * + * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu + * + * Installation instructions are at the above URL. Don't bother loading the + * libraries - they are not used with the Marlin software. + * + * Printrboard - https://github.com/scwimbush/Printrboard-HID-Arduino-IDE-Support + * + * Installation: + * + * 1. Go to the above URL, click on the "Clone or Download" button and then + * click on "Download ZIP" button. + * 2. Unzip the file, find the "printrboard" directory and then copy it to the + * hardware directory in Arduino. The Arduino hardware directory will probably + * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. + * 3. Restart Arduino. + * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * + * Teensyduino is the most popular option. Printrboard is used if your board doesn't have + * the Teensyduino bootloader on it. + */ + +/** + * To burn the bootloader that comes with Printrboard: + * + * 1. Connect your programmer to the board. + * 2. In the Arduino IDE select "Printrboard" and then select the programmer. + * 3. In the Arduino IDE click on "burn bootloader". Don't worry about the "verify failed at 1F000" error message. + * 4. The programmer is no longer needed. Remove it. */ #ifndef __AVR_AT90USB1286__ - #error "Oops! Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu." -#endif - -#if ENABLED(AT90USBxx_TEENSYPP_ASSIGNMENTS) // use Teensyduino Teensy++2.0 pin assignments instead of Marlin traditional. - #error "These Printrboard assignments depend on traditional Marlin assignments, not AT90USBxx_TEENSYPP_ASSIGNMENTS in fastio.h" + #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." #endif #define BOARD_NAME "Printrboard" @@ -46,32 +76,32 @@ // // Limit Switches // -#define X_STOP_PIN 35 +#define X_STOP_PIN 47 // E3 #if ENABLED(SDSUPPORT) - #define Y_STOP_PIN 37 // Move Ystop to Estop socket + #define Y_STOP_PIN 37 // E5 - Move Ystop to Estop socket #else - #define Y_STOP_PIN 8 // Ystop in Ystop socket + #define Y_STOP_PIN 20 // B0 SS - Ystop in Ystop socket #endif -#define Z_STOP_PIN 36 +#define Z_STOP_PIN 36 // E4 // // Steppers // -#define X_STEP_PIN 0 -#define X_DIR_PIN 1 -#define X_ENABLE_PIN 39 +#define X_STEP_PIN 28 // A0 +#define X_DIR_PIN 29 // A1 +#define X_ENABLE_PIN 19 // E7 -#define Y_STEP_PIN 2 -#define Y_DIR_PIN 3 -#define Y_ENABLE_PIN 38 +#define Y_STEP_PIN 30 // A2 +#define Y_DIR_PIN 31 // A3 +#define Y_ENABLE_PIN 18 // E6 -#define Z_STEP_PIN 4 -#define Z_DIR_PIN 5 -#define Z_ENABLE_PIN 23 +#define Z_STEP_PIN 32 // A4 +#define Z_DIR_PIN 33 // A5 +#define Z_ENABLE_PIN 17 // C7 -#define E0_STEP_PIN 6 -#define E0_DIR_PIN 7 -#define E0_ENABLE_PIN 19 +#define E0_STEP_PIN 34 // A6 +#define E0_DIR_PIN 35 // A7 +#define E0_ENABLE_PIN 13 // C3 // // Temperature Sensors @@ -82,76 +112,67 @@ // // Heaters / Fans // -#define HEATER_0_PIN 21 // Extruder -#define HEATER_1_PIN 46 -#define HEATER_2_PIN 47 -#define HEATER_BED_PIN 20 +#define HEATER_0_PIN 15 // C5 PWM3B - Extruder +#define HEATER_1_PIN 44 // F6 +#define HEATER_2_PIN 45 // F7 +#define HEATER_BED_PIN 14 // C4 PWM3C -// If soft or fast PWM is off then use Teensyduino pin numbering, Marlin -// fastio pin numbering otherwise -#if ENABLED(FAN_SOFT_PWM) || ENABLED(FAST_PWM_FAN) - #define FAN_PIN 22 -#else - #define FAN_PIN 16 -#endif + +#define FAN_PIN 16 // C6 PWM3A // // Misc. Functions // -#define SDSS 26 - -#ifndef FILWIDTH_PIN - #define FILWIDTH_PIN 2 // Analog Input -#endif +#define SDSS 20 // B0 SS +#define FILWIDTH_PIN 2 // Analog Input // // LCD / Controller // #if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) // we have no buzzer installed - #define BEEPER_PIN -1 + #define BEEPER_PIN -1 // LCD Pins #if ENABLED(LCD_I2C_PANELOLU2) - #define BTN_EN1 27 // RX1 - fastio.h pin mapping 27 - #define BTN_EN2 26 // TX1 - fastio.h pin mapping 26 - #define BTN_ENC 43 // A3 - fastio.h pin mapping 43 - #define SDSS 40 // use SD card on Panelolu2 (Teensyduino pin mapping) + #define BTN_EN1 3 // D3 RX1 JP2-7 + #define BTN_EN2 2 // D2 TX1 JP2-5 + #define BTN_ENC 41 // F3 JP2-4 + #define SDSS 38 // F0 B-THERM connector - use SD card on Panelolu2 #else - #define BTN_EN1 16 - #define BTN_EN2 17 - #define BTN_ENC 18 // the click - #endif // LCD_I2C_PANELOLU2 + #define BTN_EN1 10 // C0 JP11-12 + #define BTN_EN2 11 // C1 JP11-13 + #define BTN_ENC 12 // C2 JP11-14 + #endif - // not connected to a pin - #define SD_DETECT_PIN -1 + // not connected + #define SD_DETECT_PIN -1 - #define LCD_PINS_RS 9 - #define LCD_PINS_ENABLE 8 - #define LCD_PINS_D4 7 - #define LCD_PINS_D5 6 - #define LCD_PINS_D6 5 - #define LCD_PINS_D7 4 + #define LCD_PINS_RS 9 // E1 JP11-11 + #define LCD_PINS_ENABLE 8 // E0 JP11-10 + #define LCD_PINS_D4 7 // D7 JP11-8 + #define LCD_PINS_D5 6 // D6 JP11-7 + #define LCD_PINS_D6 5 // D5 JP11-6 + #define LCD_PINS_D7 4 // D4 JP11-5 #endif // ULTRA_LCD && NEWPANEL #if ENABLED(VIKI2) || ENABLED(miniVIKI) - // FastIO - #define BEEPER_PIN 32 + #define BEEPER_PIN 8 // E0 JP11-10 // Pins for DOGM SPI LCD Support - #define DOGLCD_A0 42 // Non-FastIO - #define DOGLCD_CS 43 // Non-FastIO + #define DOGLCD_A0 40 // F2 JP2-2 + #define DOGLCD_CS 41 // F3 JP2-4 #define LCD_SCREEN_ROT_180 - // The encoder and click button (FastIO Pins) - #define BTN_EN1 26 - #define BTN_EN2 27 - #define BTN_ENC 47 + // The encoder and click button + #define BTN_EN1 2 // D2 TX1 JP2-5 + #define BTN_EN2 3 // D3 RX1 JP2-7 + #define BTN_ENC 45 // F7 TDI JP2-12 - #define SDSS 45 - #define SD_DETECT_PIN -1 // FastIO (Manual says 72 I'm not certain cause I can't test) + #define SDSS 43 // F5 TMS JP2-8 + #define SD_DETECT_PIN -1 - #define STAT_LED_RED_PIN 12 // Non-FastIO - #define STAT_LED_BLUE_PIN 10 // Non-FastIO + #define STAT_LED_RED_PIN 12 // C2 JP11-14 + #define STAT_LED_BLUE_PIN 10 // C0 JP11-12 #endif diff --git a/Marlin/pins_PRINTRBOARD_REVF.h b/Marlin/pins_PRINTRBOARD_REVF.h old mode 100644 new mode 100755 index 16753fe327..f83bdf5ab0 --- a/Marlin/pins_PRINTRBOARD_REVF.h +++ b/Marlin/pins_PRINTRBOARD_REVF.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,18 +21,48 @@ */ /** - * Printrboard pin assignments (AT90USB1286) - * Requires the Teensyduino software with Teensy++ 2.0 selected in Arduino IDE! - * http://www.pjrc.com/teensy/teensyduino.html - * See http://reprap.org/wiki/Printrboard for more info + * Rev B 2 JUN 2017 + * + * Converted to Arduino pin numbering + */ + +/** + * There are two Arduino IDE extensions that are compatible with this board + * and with the mainstream Marlin software. + * + * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu + * + * Installation instructions are at the above URL. Don't bother loading the + * libraries - they are not used with the Marlin software. + * + * Printrboard - https://github.com/scwimbush/Printrboard-HID-Arduino-IDE-Support + * + * Installation: + * + * 1. Go to the above URL, click on the "Clone or Download" button and then + * click on "Download ZIP" button. + * 2. Unzip the file, find the "printrboard" directory and then copy it to the + * hardware directory in Arduino. The Arduino hardware directory will probably + * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. + * 3. Restart Arduino. + * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * + * Teensyduino is the most popular option. Printrboard is used if your board doesn't have + * the Teensyduino bootloader on it. + */ + +/** + * To burn the bootloader that comes with Printrboard: + * + * 1. Connect your programmer to the board. + * 2. In the Arduino IDE select "Printrboard" and then select the programmer. + * 3. In the Arduino IDE click on "burn bootloader". Don't worry about the "verify failed at 1F000" error message. + * 4. The programmer is no longer needed. Remove it. */ #ifndef __AVR_AT90USB1286__ - #error "Oops! Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu." -#endif - -#if ENABLED(AT90USBxx_TEENSYPP_ASSIGNMENTS) // use Teensyduino Teensy++2.0 pin assignments instead of Marlin traditional. - #error "These Printrboard assignments depend on traditional Marlin assignments, not AT90USBxx_TEENSYPP_ASSIGNMENTS in fastio.h" + #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." #endif #define BOARD_NAME "Printrboard Rev F" @@ -41,28 +71,28 @@ // // Limit Switches // -#define X_STOP_PIN 35 -#define Y_STOP_PIN 12 -#define Z_STOP_PIN 36 +#define X_STOP_PIN 47 // E3 +#define Y_STOP_PIN 24 // B4 PWM2A +#define Z_STOP_PIN 36 // E4 // // Steppers // -#define X_STEP_PIN 0 -#define X_DIR_PIN 1 -#define X_ENABLE_PIN 39 +#define X_STEP_PIN 28 // A0 +#define X_DIR_PIN 29 // A1 +#define X_ENABLE_PIN 19 // E7 -#define Y_STEP_PIN 2 -#define Y_DIR_PIN 3 -#define Y_ENABLE_PIN 38 +#define Y_STEP_PIN 30 // A2 +#define Y_DIR_PIN 31 // A3 +#define Y_ENABLE_PIN 18 // E6 -#define Z_STEP_PIN 4 -#define Z_DIR_PIN 5 -#define Z_ENABLE_PIN 23 +#define Z_STEP_PIN 32 // A4 +#define Z_DIR_PIN 33 // A5 +#define Z_ENABLE_PIN 17 // C7 -#define E0_STEP_PIN 6 -#define E0_DIR_PIN 7 -#define E0_ENABLE_PIN 19 +#define E0_STEP_PIN 34 // A6 +#define E0_DIR_PIN 35 // A7 +#define E0_ENABLE_PIN 13 // C3 // uncomment to enable an I2C based DAC like on the Printrboard REVF #define DAC_STEPPER_CURRENT @@ -72,7 +102,7 @@ #define DAC_STEPPER_SENSE 0.11 #define DAC_STEPPER_ADDRESS 0 #define DAC_STEPPER_MAX 3520 -#define DAC_STEPPER_VREF 1 // internal Vref, gain 1x = 2.048V +#define DAC_STEPPER_VREF 1 // internal Vref, gain 1x = 2.048V #define DAC_STEPPER_GAIN 0 #define DAC_OR_ADDRESS 0x00 @@ -85,68 +115,52 @@ // // Heaters / Fans // -#define HEATER_0_PIN 21 // Extruder -#define HEATER_1_PIN 46 -#define HEATER_2_PIN 47 -#define HEATER_BED_PIN 20 +#define HEATER_0_PIN 15 // C5 PWM3B - Extruder +#define HEATER_1_PIN 44 // F6 +#define HEATER_2_PIN 45 // F7 +#define HEATER_BED_PIN 14 // C4 PWM3C -// If soft or fast PWM is off then use Teensyduino pin numbering, Marlin -// fastio pin numbering otherwise -#if ENABLED(FAN_SOFT_PWM) || ENABLED(FAST_PWM_FAN) - #define FAN_PIN 22 -#else - #define FAN_PIN 16 -#endif +#define FAN_PIN 16 // C6 PWM3A // // Misc. Functions // -#define SDSS 20 // Teensylu pin mapping - -#ifndef FILWIDTH_PIN - #define FILWIDTH_PIN 2 // Analog Input -#endif +#define SDSS 20 // B0 SS +#define FILWIDTH_PIN 2 // Analog Input // // LCD / Controller // #if ENABLED(ULTRA_LCD) - #define BEEPER_PIN -1 + #define BEEPER_PIN -1 - #define LCD_PINS_RS 9 - #define LCD_PINS_ENABLE 8 - #define LCD_PINS_D4 7 - #define LCD_PINS_D5 6 - #define LCD_PINS_D6 5 - #define LCD_PINS_D7 4 + #define LCD_PINS_RS 9 // E1 JP11-11 + #define LCD_PINS_ENABLE 8 // E0 JP11-10 + #define LCD_PINS_D4 7 // D7 JP11-8 + #define LCD_PINS_D5 6 // D6 JP11-7 + #define LCD_PINS_D6 5 // D5 JP11-6 + #define LCD_PINS_D7 4 // D4 JP11-5 - #define BTN_EN1 16 - #define BTN_EN2 17 - #define BTN_ENC 18 // the click + #define BTN_EN1 10 // C0 JP11-12 + #define BTN_EN2 11 // C1 JP11-13 + #define BTN_ENC 12 // C2 JP11-14 - #define SD_DETECT_PIN -1 - - // encoder rotation values - #define encrot0 0 - #define encrot1 2 - #define encrot2 3 - #define encrot3 1 + #define SD_DETECT_PIN -1 #endif #if ENABLED(VIKI2) || ENABLED(miniVIKI) - #define BEEPER_PIN 32 // FastIO - #define DOGLCD_A0 42 // Non-FastIO - #define DOGLCD_CS 43 // Non-FastIO + #define BEEPER_PIN 8 // E0 JP11-10 + #define DOGLCD_A0 40 // F2 JP2-2 + #define DOGLCD_CS 41 // F3 JP2-4 #define LCD_SCREEN_ROT_180 - // (FastIO Pins) - #define BTN_EN1 26 - #define BTN_EN2 27 - #define BTN_ENC 47 + #define BTN_EN1 2 // D2 TX1 JP2-5 + #define BTN_EN2 3 // D3 RX1 JP2-7 + #define BTN_ENC 45 // F7 TDI JP2-12 - #define SDSS 45 - #define SD_DETECT_PIN -1 // FastIO (Manual says 72) + #define SDSS 43 // F5 TMS JP2-8 + #define SD_DETECT_PIN -1 - #define STAT_LED_RED_PIN 12 // Non-FastIO - #define STAT_LED_BLUE_PIN 10 // Non-FastIO + #define STAT_LED_RED_PIN 12 // C2 JP11-14 + #define STAT_LED_BLUE_PIN 10 // C0 JP11-12 #endif diff --git a/Marlin/pins_SAV_MKI.h b/Marlin/pins_SAV_MKI.h old mode 100644 new mode 100755 index 2048af9251..b1ed0bd8c4 --- a/Marlin/pins_SAV_MKI.h +++ b/Marlin/pins_SAV_MKI.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,14 +21,48 @@ */ /** - * SAV MkI pin assignments (AT90USB1286) - * Requires the Teensyduino software with Teensy++ 2.0 selected in Arduino IDE! - * http://www.pjrc.com/teensy/teensyduino.html - * RepRap Clone Wars project board. + * Rev B 2 JUN 2017 + * + * Converted to Arduino pin numbering + */ + +/** + * There are two Arduino IDE extensions that are compatible with this board + * and with the mainstream Marlin software. + * + * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu + * + * Installation instructions are at the above URL. Don't bother loading the + * libraries - they are not used with the Marlin software. + * + * Printrboard - https://github.com/scwimbush/Printrboard-HID-Arduino-IDE-Support + * + * Installation: + * + * 1. Go to the above URL, click on the "Clone or Download" button and then + * click on "Download ZIP" button. + * 2. Unzip the file, find the "printrboard" directory and then copy it to the + * hardware directory in Arduino. The Arduino hardware directory will probably + * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. + * 3. Restart Arduino. + * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * + * Teensyduino is the most popular option. Printrboard is used if your board doesn't have + * the Teensyduino bootloader on it. + */ + +/** + * To burn the bootloader that comes with Printrboard: + * + * 1. Connect your programmer to the board. + * 2. In the Arduino IDE select "Printrboard" and then select the programmer. + * 3. In the Arduino IDE click on "burn bootloader". Don't worry about the "verify failed at 1F000" error message. + * 4. The programmer is no longer needed. Remove it. */ #ifndef __AVR_AT90USB1286__ - #error "Oops! Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu." + #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." #endif #define DEFAULT_MACHINE_NAME "SAV MkI" @@ -41,54 +75,54 @@ // // Servos // -#define SERVO0_PIN 41 // In teensy's pin definition for pinMode (in servo.cpp) +#define SERVO0_PIN 39 // F1 In teensy's pin definition for pinMode (in servo.cpp) // // Limit Switches // -#define X_STOP_PIN 13 -#define Y_STOP_PIN 14 -//#define Z_STOP_PIN 15 -#define Z_STOP_PIN 36 // For inductive sensor. +#define X_STOP_PIN 25 // B5 +#define Y_STOP_PIN 26 // B6 +//#define Z_STOP_PIN 27 // B7 +#define Z_STOP_PIN 36 // E4 For inductive sensor. +//#define E_STOP_PIN 36 // E4 // // Steppers // -#define X_STEP_PIN 0 -#define X_DIR_PIN 1 -#define X_ENABLE_PIN 39 +#define X_STEP_PIN 28 // A0 +#define X_DIR_PIN 29 // A1 +#define X_ENABLE_PIN 19 // E7 -#define Y_STEP_PIN 2 -#define Y_DIR_PIN 3 -#define Y_ENABLE_PIN 38 +#define Y_STEP_PIN 30 // A2 +#define Y_DIR_PIN 31 // A3 +#define Y_ENABLE_PIN 18 // E6 -#define Z_STEP_PIN 4 -#define Z_DIR_PIN 5 -#define Z_ENABLE_PIN 23 +#define Z_STEP_PIN 32 // A4 +#define Z_DIR_PIN 33 // A5 +#define Z_ENABLE_PIN 17 // C7 -#define E0_STEP_PIN 6 -#define E0_DIR_PIN 7 -#define E0_ENABLE_PIN 19 +#define E0_STEP_PIN 34 // A6 +#define E0_DIR_PIN 35 // A7 +#define E0_ENABLE_PIN 13 // C3 // // Temperature Sensors // -#define TEMP_0_PIN 7 // Analog Input (Extruder) -#define TEMP_BED_PIN 6 // Analog Input (Bed) +#define TEMP_0_PIN 7 // F7 Analog Input (Extruder) +#define TEMP_BED_PIN 6 // F6 Analog Input (Bed) // // Heaters / Fans // -#define HEATER_0_PIN 21 // Extruder -#define HEATER_BED_PIN 20 // Bed +#define HEATER_0_PIN 15 // C5 PWM3B - Extruder +#define HEATER_BED_PIN 14 // C4 PWM3C - Bed -#define FAN_PIN 16 // Fan -- from Teensyduino environment. - // For the fan and Teensyduino uses a different pin mapping. +#define FAN_PIN 16 // C6 PWM3A // // Misc. Functions // -#define SDSS 20 // PB0 - 8 in marlin env. +#define SDSS 20 // B0 // Extension header pin mapping // ---------------------------- @@ -99,21 +133,21 @@ // PWM-D24 A4 (An), IO // 5V GND // 12V GND -#define EXT_AUX_SCL_D0 0 // 0 (teensy), 24 (marlin) -#define EXT_AUX_SDA_D1 1 // 1 (teensy), 25 (marlin) -#define EXT_AUX_RX1_D2 26 // 2 (teensy), 26 (marlin) -#define EXT_AUX_TX1_D3 27 // 3 (teensy), 27 (marlin) -#define EXT_AUX_PWM_D24 12 // 24 (teensy), 12 (marlin) -#define EXT_AUX_A0 0 // Analog -#define EXT_AUX_A0_IO 40 // Digital IO, 38 (teensy), 40 (marlin) -#define EXT_AUX_A1 1 // Analog -#define EXT_AUX_A1_IO 41 // Digital IO, 39 (teensy), 41 (marlin) -#define EXT_AUX_A2 2 // Analog -#define EXT_AUX_A2_IO 42 // Digital IO, 40 (teensy), 42 (marlin) -#define EXT_AUX_A3 3 // Analog -#define EXT_AUX_A3_IO 43 // Digital IO, 41 (teensy), 43 (marlin) -#define EXT_AUX_A4 4 // Analog -#define EXT_AUX_A4_IO 44 // Digital IO, 42 (teensy), 44 (marlin) +#define EXT_AUX_SCL_D0 0 // D0 PWM0B +#define EXT_AUX_SDA_D1 1 // D1 +#define EXT_AUX_RX1_D2 2 // D2 +#define EXT_AUX_TX1_D3 3 // D3 +#define EXT_AUX_PWM_D24 24 // B4 PWM2A +#define EXT_AUX_A0 0 // F0 Analog Input +#define EXT_AUX_A0_IO 38 // F0 Digital IO +#define EXT_AUX_A1 1 // F1 Analog Input +#define EXT_AUX_A1_IO 39 // F1 Digital IO +#define EXT_AUX_A2 2 // F2 Analog Input +#define EXT_AUX_A2_IO 40 // F2 Digital IO +#define EXT_AUX_A3 3 // F3 Analog Input +#define EXT_AUX_A3_IO 41 // F3 Digital IO +#define EXT_AUX_A4 4 // F4 Analog Input +#define EXT_AUX_A4_IO 42 // F4 Digital IO // // LCD / Controller @@ -128,28 +162,28 @@ #if ENABLED(SAV_3DLCD) // For LCD SHIFT register LCD - #define SR_DATA_PIN EXT_AUX_SDA_D1 - #define SR_CLK_PIN EXT_AUX_SCL_D0 -#endif // SAV_3DLCD + #define SR_DATA_PIN EXT_AUX_SDA_D1 + #define SR_CLK_PIN EXT_AUX_SCL_D0 +#endif #if ENABLED(SAV_3DLCD) || ENABLED(SAV_3DGLCD) - #define BTN_EN1 EXT_AUX_A1_IO - #define BTN_EN2 EXT_AUX_A0_IO - #define BTN_ENC EXT_AUX_PWM_D24 + #define BTN_EN1 EXT_AUX_A1_IO + #define BTN_EN2 EXT_AUX_A0_IO + #define BTN_ENC EXT_AUX_PWM_D24 - #define KILL_PIN EXT_AUX_A2_IO - #define HOME_PIN EXT_AUX_A4_IO + #define KILL_PIN EXT_AUX_A2_IO + #define HOME_PIN EXT_AUX_A4_IO -#else // Try to use the expansion header for spindle control +#else // Use the expansion header for spindle control // // M3/M4/M5 - Spindle/Laser Control // - #define SPINDLE_LASER_PWM_PIN 24 // 12 AT90USB… pin # - #define SPINDLE_LASER_ENABLE_PIN 39 // Pin should have a pullup! 41 AT90USB… pin # - #define SPINDLE_DIR_PIN 40 // 42 AT90USB… pin # + #define SPINDLE_LASER_PWM_PIN 24 // B4 PWM2A + #define SPINDLE_LASER_ENABLE_PIN 39 // F1 Pin should have a pullup! + #define SPINDLE_DIR_PIN 40 // F2 - #define CASE_LIGHT_PIN 0 // 24 AT90USB… pin # + #define CASE_LIGHT_PIN 0 // D0 PWM0B #endif diff --git a/Marlin/pins_TEENSY2.h b/Marlin/pins_TEENSY2.h old mode 100644 new mode 100755 index 971de27e8b..fa4280fc13 --- a/Marlin/pins_TEENSY2.h +++ b/Marlin/pins_TEENSY2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -20,13 +20,54 @@ * */ +/** + * Rev B 2 JUN 2017 + * + * Converted to Arduino pin numbering + */ + +/** + * There are two Arduino IDE extensions that are compatible with this board + * and with the mainstream Marlin software. + * + * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu + * + * Installation instructions are at the above URL. Don't bother loading the + * libraries - they are not used with the Marlin software. + * + * Printrboard - https://github.com/scwimbush/Printrboard-HID-Arduino-IDE-Support + * + * Installation: + * + * 1. Go to the above URL, click on the "Clone or Download" button and then + * click on "Download ZIP" button. + * 2. Unzip the file, find the "printrboard" directory and then copy it to the + * hardware directory in Arduino. The Arduino hardware directory will probably + * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. + * 3. Restart Arduino. + * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * + * Teensyduino is the most popular option. Printrboard is used if your board doesn't have + * the Teensyduino bootloader on it. + */ + +/** + * To burn the bootloader that comes with Printrboard: + * + * 1. Connect your programmer to the board. + * 2. In the Arduino IDE select "Printrboard" and then select the programmer. + * 3. In the Arduino IDE click on "burn bootloader". Don't worry about the "verify failed at 1F000" error message. + * 4. The programmer is no longer needed. Remove it. + */ + /** * Teensy++ 2.0 Breadboard pin assignments (AT90USB1286) * Requires the Teensyduino software with Teensy++ 2.0 selected in Arduino IDE! * http://www.pjrc.com/teensy/teensyduino.html * See http://reprap.org/wiki/Printrboard for more info * - * CLI build: DEFINES=AT90USBxx_TEENSYPP_ASSIGNMENTS HARDWARE_MOTHERBOARD=84 make + * CLI build: HARDWARE_MOTHERBOARD=84 make * * DaveX plan for Teensylu/printrboard-type pinouts for a TeensyBreadboard: * (ref teensylu & sprinter) @@ -66,12 +107,7 @@ */ #ifndef __AVR_AT90USB1286__ - #error "Oops! Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu." -#endif - -#if DISABLED(AT90USBxx_TEENSYPP_ASSIGNMENTS) // use Teensyduino Teensy++2.0 pin assignments instead of Marlin alphabetical. - #error "Uncomment #define AT90USBxx_TEENSYPP_ASSIGNMENTS in fastio.h for this config" - // (or build from command line) + #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." #endif #define BOARD_NAME "Teensy++2.0" @@ -82,68 +118,68 @@ // // Limit Switches // -#define X_STOP_PIN 2 -#define Y_STOP_PIN 3 -#define Z_STOP_PIN 4 +#define X_STOP_PIN 2 // D2 +#define Y_STOP_PIN 3 // D3 +#define Z_STOP_PIN 4 // D4 // // Steppers // -#define X_STEP_PIN 28 // 0 Marlin -#define X_DIR_PIN 29 // 1 Marlin -#define X_ENABLE_PIN 26 +#define X_STEP_PIN 28 // A0 Marlin +#define X_DIR_PIN 29 // A1 Marlin +#define X_ENABLE_PIN 26 // B6 -#define Y_STEP_PIN 30 // 2 Marlin -#define Y_DIR_PIN 31 // 3 -#define Y_ENABLE_PIN 26 // Shared w/x +#define Y_STEP_PIN 30 // A2 Marlin +#define Y_DIR_PIN 31 // A3 +#define Y_ENABLE_PIN 26 // B6 Shared w/x -#define Z_STEP_PIN 32 // 4 -#define Z_DIR_PIN 33 // 5 -#define Z_ENABLE_PIN 26 // Shared w/x +#define Z_STEP_PIN 32 // A4 +#define Z_DIR_PIN 33 // A5 +#define Z_ENABLE_PIN 26 // B6 Shared w/x -#define E0_STEP_PIN 34 // 6 -#define E0_DIR_PIN 35 // 7 -#define E0_ENABLE_PIN 26 // Shared w/x +#define E0_STEP_PIN 34 // A6 +#define E0_DIR_PIN 35 // A7 +#define E0_ENABLE_PIN 26 // B6 Shared w/x // // Temperature Sensors // -#define TEMP_0_PIN 7 // Analog Input (Extruder) -#define TEMP_BED_PIN 6 // Analog Input (Bed) +#define TEMP_0_PIN 7 // F7 Analog Input (Extruder) +#define TEMP_BED_PIN 6 // F6 Analog Input (Bed) // // Heaters / Fans // -#define HEATER_0_PIN 15 // 21 // Extruder -#define HEATER_BED_PIN 14 // 20 // Bed -#define FAN_PIN 16 // 22 // Fan +#define HEATER_0_PIN 15 // C5 PWM3B Extruder +#define HEATER_BED_PIN 14 // C4 PWM3C +#define FAN_PIN 16 // C6 PWM3A Fan // // Misc. Functions // -#define SDSS 20 // 8 -#define LED_PIN 6 -#define PS_ON_PIN 27 -#define CASE_LIGHT_PIN 1 // MUST BE HARDWARE PWM +#define SDSS 20 // B0 +#define LED_PIN 6 // D6 +#define PS_ON_PIN 27 // B7 +#define CASE_LIGHT_PIN 1 // D1 PWM2B MUST BE HARDWARE PWM // // LCD / Controller // #if ENABLED(ULTIPANEL) - #define LCD_PINS_RS 8 - #define LCD_PINS_ENABLE 9 - #define LCD_PINS_D4 10 - #define LCD_PINS_D5 11 - #define LCD_PINS_D6 12 - #define LCD_PINS_D7 13 - #define BTN_EN1 38 - #define BTN_EN2 39 - #define BTN_ENC 40 + #define LCD_PINS_RS 8 // E0 + #define LCD_PINS_ENABLE 9 // E1 + #define LCD_PINS_D4 10 // C0 + #define LCD_PINS_D5 11 // C1 + #define LCD_PINS_D6 12 // C2 + #define LCD_PINS_D7 13 // C3 + #define BTN_EN1 38 // F0 + #define BTN_EN2 39 // F1 + #define BTN_ENC 40 // F2 #endif // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 5 // Pin should have a pullup! -#define SPINDLE_LASER_PWM_PIN 0 // MUST BE HARDWARE PWM -#define SPINDLE_DIR_PIN 7 +#define SPINDLE_LASER_ENABLE_PIN 5 // D5 Pin should have a pullup! +#define SPINDLE_LASER_PWM_PIN 0 // D0 PWM0B MUST BE HARDWARE PWM +#define SPINDLE_DIR_PIN 7 // D7 diff --git a/Marlin/pins_TEENSYLU.h b/Marlin/pins_TEENSYLU.h old mode 100644 new mode 100755 index 5f12e710cc..3fb7f5c3ec --- a/Marlin/pins_TEENSYLU.h +++ b/Marlin/pins_TEENSYLU.h @@ -21,54 +21,46 @@ */ /** - * rev B 30 DEC 2016 + * Rev C 2 JUN 2017 * - * The original version of this file did NOT result in a useful program because: - * 1. The pin numbers assumed that the "#define AT90USBxx_TEENSYPP_ASSIGNMENTS" line - * in FASTIO.h was commented out. There wasn't an Arduino IDE 1.6.x extension/package - * that supported this pin map so the latest Marlin wouldn't compile. - * 2. The silkscreen for the four end stops don't agree with the schematic. Activating - * the X endstop would tell the software that the Y endstop just went active. - * 3. The thermistor inputs also had heater names assigned to them. The result was - * thermistor inputs that were set to digital outputs. + * Converted to Arduino pin numbering + */ + +/** + * There are two Arduino IDE extensions that are compatible with this board + * and with the mainstream Marlin software. All have been used with Arduino 1.6.12 * - * Rev B corrects the above problems by: - * 1. The "Marlin_AT90USB" extension/package was developed. This extension enables the - * latest Marlin software to compile using Arduino IDE 1.6.x and 1.80. - * 2. The endstop pin numbers in this file were changed to match the silkscreen. This - * makes it a little confusing when trying to correlate the schematic with the pin - * numbers used in this file. - * 3. The offending heater names were deleted. + * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu * - * To create a useable image for Teensylu do the following: - * a) Install the Marlin_AT90USB extension with either of the following methods: - * Automatic - paste this URL into preferences and then use Boards manager - * https://rawgit.com/Bob-the-Kuhn/Marlin_AT90USB/master/package_MARLIN_AT90USB_index.json - * Manual: - * 1. Copy the following URL into Go to "https://github.com/Bob-the-Kuhn/Marlin_AT90USB", - * click on the "Clone or Download" button and then click on "Download ZIP" button. - * 2. Unzip the file, find the "Marlin_AT90USB" directory and then copy it to the - * hardware directory in Arduino. The Arduino hardware directory will probably be - * located in a path similar to this: C:\Program Files (x86)\Arduino\hardware - * b) Connect the USBtinyISP to the board. - * c) In the Arduino IDE select the "AT90USB1286_STANDARD" board in the of the "Marlin_AT90USB" - * section and select the "USBtinyISP" programmer. - * d) In the Arduino IDE click on "burn bootloader". Don't worry about the "verify - * failed at 1F000" error message. - * e) The USBtinyISP programmer is no longer needed. Remove it. - * f) In FASTIO.h comment out the "#define AT90USBxx_TEENSYPP_ASSIGNMENTS" line. - * g) To upload a sketch do the following: - * 1. remove the jumper - * 2. press reset - * 3. click on the "upload" button in the Arduino IDE - * 4. wait until the upload finishes (less than a minute) - * 5. put the jumper back on - * 6. press the reset button + * Installation instructions are at the above URL. Don't bother loading the + * libraries - they are not used with the Marlin software. * + * Printrboard - https://github.com/scwimbush/Printrboard-HID-Arduino-IDE-Support + * This is basically Teensyduino but with a bootloader that can handle image sizes + * larger than 64K. * - * NOTE - the "Marlin_AT90USB" pin maps make PWM0A available rather than the usual PWM1C. - * These PWMs share the same physical pin. Marlin uses TIMER1 to generate - * interrupts and sets it up such that PWM1A, PWM1B & PWM1C can't be used. + * Installation: + * + * 1. Go to the above URL, click on the "Clone or Download" button and then + * click on "Download ZIP" button. + * 2. Unzip the file, find the "printrboard" directory and then copy it to the + * hardware directory in Arduino. The Arduino hardware directory will probably + * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. + * 3. Restart Arduino. + * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * + * Teensyduino is the most popular option. Printrboard is used if your board doesn't have + * the Teensyduino bootloader on it. + */ + +/** + * To burn the bootloader that comes with Printrboard: + * + * 1. Connect your programmer to the board. + * 2. In the Arduino IDE select "Printrboard" and then select the programmer. + * 3. In the Arduino IDE click on "burn bootloader". Don't worry about the "verify failed at 1F000" error message. + * 4. The programmer is no longer needed. Remove it. */ /** @@ -81,13 +73,8 @@ * The pin assignments in this file match the silkscreen. */ - #if !defined(__AVR_AT90USB1286__) && !defined(__AVR_AT90USB1286P__) - #error "Oops! Make sure you have 'AT90USB1286_STANDARD' selected from the 'Tools -> Boards' menu." -#endif - -#if ENABLED(AT90USBxx_TEENSYPP_ASSIGNMENTS) - #error "please disable (comment out) the AT90USBxx_TEENSYPP_ASSIGNMENTS flag in FASTIO.h " + #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." #endif #define BOARD_NAME "Teensylu" @@ -97,60 +84,60 @@ // -// Limit Switche definitions that match the SCHEMATIC +// Limit Switch definitions that match the SCHEMATIC // -//#define X_STOP_PIN 13 -//#define Y_STOP_PIN 14 -//#define Z_STOP_PIN 15 -//#define E_STOP_PIN 36 +//#define X_STOP_PIN 25 // B5 +//#define Y_STOP_PIN 26 // B6 +//#define Z_STOP_PIN 27 // B7 +//#define E_STOP_PIN 36 // E4 // // Limit Switch definitions that match the SILKSCREEN // -#define X_STOP_PIN 14 -#define Y_STOP_PIN 15 -#define Z_STOP_PIN 36 -//#define E_STOP_PIN 13 +#define X_STOP_PIN 26 // B6 +#define Y_STOP_PIN 27 // B7 +#define Z_STOP_PIN 36 // E4 +//#define E_STOP_PIN 25 // B5 // // Steppers // -#define X_STEP_PIN 0 -#define X_DIR_PIN 1 -#define X_ENABLE_PIN 39 +#define X_STEP_PIN 28 // A0 +#define X_DIR_PIN 29 // A1 +#define X_ENABLE_PIN 19 // E7 -#define Y_STEP_PIN 2 -#define Y_DIR_PIN 3 -#define Y_ENABLE_PIN 38 +#define Y_STEP_PIN 30 // A2 +#define Y_DIR_PIN 31 // A3 +#define Y_ENABLE_PIN 18 // E6 -#define Z_STEP_PIN 4 -#define Z_DIR_PIN 5 -#define Z_ENABLE_PIN 23 - -#define E0_STEP_PIN 6 -#define E0_DIR_PIN 7 -#define E0_ENABLE_PIN 19 +#define Z_STEP_PIN 32 // A4 +#define Z_DIR_PIN 33 // A5 +#define Z_ENABLE_PIN 17 // C7 +#define E0_STEP_PIN 34 // A6 +#define E0_DIR_PIN 35 // A7 +#define E0_ENABLE_PIN 13 // C3 +// // Temperature Sensors - -#define TEMP_0_PIN 7 // Analog Input (Extruder) -#define TEMP_BED_PIN 6 // Analog Input (Bed) +// +#define TEMP_0_PIN 7 // Analog Input (Extruder) +#define TEMP_BED_PIN 6 // Analog Input (Bed) // // Heaters / Fans // -#define HEATER_0_PIN 21 // Extruder -#define HEATER_BED_PIN 20 +#define HEATER_0_PIN 15 // C5 PWM3B - Extruder +#define HEATER_BED_PIN 14 // C4 PWM3C -#define FAN_PIN 22 +#define FAN_PIN 16 // C6 PWM3A // // Misc. Functions // -#define SDSS 8 -#define CASE_LIGHT_PIN 24 +#define SDSS 20 // B0 JP31-6 +#define CASE_LIGHT_PIN 0 // D0 IO-14 PWM0B // // LCD / Controller @@ -160,11 +147,11 @@ #define BEEPER_PIN -1 #if ENABLED(LCD_I2C_PANELOLU2) - #define BTN_EN1 27 - #define BTN_EN2 26 - #define BTN_ENC 43 - #define SDSS 40 // use SD card on Panelolu2 - #endif // LCD_I2C_PANELOLU2 + #define BTN_EN1 3 // D3 IO-8 + #define BTN_EN2 2 // D2 IO-10 + #define BTN_ENC 41 // F3 IO-7 + #define SDSS 38 // F0 IO-13 use SD card on Panelolu2 + #endif #define SD_DETECT_PIN -1 @@ -173,6 +160,6 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_PWM_PIN 12 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 41 // Pin should have a pullup! -#define SPINDLE_DIR_PIN 42 +#define SPINDLE_LASER_PWM_PIN 24 // B4 IO-3 PWM2A - MUST BE HARDWARE PWM +#define SPINDLE_LASER_ENABLE_PIN 39 // F1 IO-11 - Pin should have a pullup! +#define SPINDLE_DIR_PIN 40 // F2 IO-9 From 5426fc1735bad08ff2d85a8940e6e844734340b0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 8 Jun 2017 18:08:03 -0500 Subject: [PATCH 3/5] Unify AVR90USB: Pins cleanup --- Marlin/pins_AZTEEG_X3_PRO.h | 10 +- Marlin/pins_GEN6.h | 6 +- Marlin/pins_GEN7_CUSTOM.h | 6 +- Marlin/pins_MEGATRONICS_3.h | 8 +- Marlin/pins_MIGHTYBOARD_REVE.h | 151 ++++++++++++++-------------- Marlin/pins_MINITRONICS.h | 6 +- Marlin/pins_RAMBO.h | 20 ++-- Marlin/pins_RAMPS.h | 173 +++++++++++++++++---------------- Marlin/pins_SCOOVO_X9H.h | 26 ++--- Marlin/pins_ULTIMAKER.h | 12 +-- 10 files changed, 211 insertions(+), 207 deletions(-) diff --git a/Marlin/pins_AZTEEG_X3_PRO.h b/Marlin/pins_AZTEEG_X3_PRO.h index 53ecb4c18c..0e76a2a232 100644 --- a/Marlin/pins_AZTEEG_X3_PRO.h +++ b/Marlin/pins_AZTEEG_X3_PRO.h @@ -134,9 +134,9 @@ #if ENABLED(VIKI2) || ENABLED(miniVIKI) #undef SD_DETECT_PIN - #define SD_DETECT_PIN 49 // For easy adapter board + #define SD_DETECT_PIN 49 // For easy adapter board #undef BEEPER_PIN - #define BEEPER_PIN 12 // 33 isn't physically available to the LCD display + #define BEEPER_PIN 12 // 33 isn't physically available to the LCD display #else #define STAT_LED_RED_PIN 32 #define STAT_LED_BLUE_PIN 35 @@ -146,9 +146,9 @@ // Misc. Functions // #if ENABLED(CASE_LIGHT_ENABLE) && PIN_EXISTS(CASE_LIGHT) && defined(DOGLCD_A0) && DOGLCD_A0 == CASE_LIGHT_PIN - #undef DOGLCD_A0 // steal pin 44 for the case light; if you have a Viki2 and have connected it - #define DOGLCD_A0 57 // following the Panucatt wiring diagram, you may need to tweak these pin assignments - // as the wiring diagram uses pin 44 for DOGLCD_A0 + #undef DOGLCD_A0 // Steal pin 44 for the case light; if you have a Viki2 and have connected it + #define DOGLCD_A0 57 // following the Panucatt wiring diagram, you may need to tweak these pin assignments + // as the wiring diagram uses pin 44 for DOGLCD_A0 #endif // diff --git a/Marlin/pins_GEN6.h b/Marlin/pins_GEN6.h index 10a285790d..5611e4d92f 100644 --- a/Marlin/pins_GEN6.h +++ b/Marlin/pins_GEN6.h @@ -107,7 +107,7 @@ // #define SDSS 17 #define DEBUG_PIN 0 -#define CASE_LIGHT_PIN 16 // MUST BE HARDWARE PWM +#define CASE_LIGHT_PIN 16 // MUST BE HARDWARE PWM // RS485 pins #define TX_ENABLE_PIN 12 @@ -116,6 +116,6 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 5 // Pin should have a pullup/pulldown! -#define SPINDLE_LASER_PWM_PIN 16 // MUST BE HARDWARE PWM +#define SPINDLE_LASER_ENABLE_PIN 5 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_PWM_PIN 16 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 6 diff --git a/Marlin/pins_GEN7_CUSTOM.h b/Marlin/pins_GEN7_CUSTOM.h index 9b83df9aee..d64e94e2d3 100644 --- a/Marlin/pins_GEN7_CUSTOM.h +++ b/Marlin/pins_GEN7_CUSTOM.h @@ -96,14 +96,14 @@ // Heaters // #define HEATER_0_PIN 4 -#define HEATER_BED_PIN 3 // (bed) +#define HEATER_BED_PIN 3 // (bed) // // Misc. Functions // -#define SDSS 31 // SCL pin of I2C header || CS Pin for SD Card support +#define SDSS 31 // SCL pin of I2C header || CS Pin for SD Card support #define PS_ON_PIN 19 -#define CASE_LIGHT_PIN 15 // MUST BE HARDWARE PWM +#define CASE_LIGHT_PIN 15 // MUST BE HARDWARE PWM // A pin for debugging #define DEBUG_PIN -1 diff --git a/Marlin/pins_MEGATRONICS_3.h b/Marlin/pins_MEGATRONICS_3.h index 5e4ca4b586..2ebb209bcb 100644 --- a/Marlin/pins_MEGATRONICS_3.h +++ b/Marlin/pins_MEGATRONICS_3.h @@ -131,7 +131,7 @@ #define SDSS 53 #define LED_PIN 13 #define PS_ON_PIN 12 -#define CASE_LIGHT_PIN 45 // try the keypad connector +#define CASE_LIGHT_PIN 45 // Try the keypad connector // // LCD / Controller @@ -144,9 +144,9 @@ #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD) - #define LCD_PINS_RS 56 // CS chip select / SS chip slave select - #define LCD_PINS_ENABLE 51 // SID (MOSI) - #define LCD_PINS_D4 52 // SCK (CLK) clock + #define LCD_PINS_RS 56 // CS chip select / SS chip slave select + #define LCD_PINS_ENABLE 51 // SID (MOSI) + #define LCD_PINS_D4 52 // SCK (CLK) clock #define SD_DETECT_PIN 35 #else diff --git a/Marlin/pins_MIGHTYBOARD_REVE.h b/Marlin/pins_MIGHTYBOARD_REVE.h index bd13a379d9..5b5d6e7ed1 100644 --- a/Marlin/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/pins_MIGHTYBOARD_REVE.h @@ -64,20 +64,20 @@ // // Servos // -#define SERVO0_PIN 36 // C1 (1280-EX1) -#define SERVO1_PIN 37 // C0 (1280-EX2) -#define SERVO2_PIN 40 // G1 (1280-EX3) -#define SERVO3_PIN 41 // G0 (1280-EX4) +#define SERVO0_PIN 36 // C1 (1280-EX1) +#define SERVO1_PIN 37 // C0 (1280-EX2) +#define SERVO2_PIN 40 // G1 (1280-EX3) +#define SERVO3_PIN 41 // G0 (1280-EX4) // // Limit Switches // -#define X_MIN_PIN 49 // L0 -#define X_MAX_PIN 48 // L1 -#define Y_MIN_PIN 47 // L2 -#define Y_MAX_PIN 46 // L3 -#define Z_MIN_PIN 43 // L6 -#define Z_MAX_PIN 42 // L7 +#define X_MIN_PIN 49 // L0 +#define X_MAX_PIN 48 // L1 +#define Y_MIN_PIN 47 // L2 +#define Y_MAX_PIN 46 // L3 +#define Z_MIN_PIN 43 // L6 +#define Z_MAX_PIN 42 // L7 // // Z Probe (when not Z_MIN_PIN) @@ -89,25 +89,25 @@ // // Steppers // -#define X_STEP_PIN 55 // F1 -#define X_DIR_PIN 54 // F0 -#define X_ENABLE_PIN 56 // F2 +#define X_STEP_PIN 55 // F1 +#define X_DIR_PIN 54 // F0 +#define X_ENABLE_PIN 56 // F2 -#define Y_STEP_PIN 59 // F5 -#define Y_DIR_PIN 58 // F4 -#define Y_ENABLE_PIN 60 // F6 +#define Y_STEP_PIN 59 // F5 +#define Y_DIR_PIN 58 // F4 +#define Y_ENABLE_PIN 60 // F6 -#define Z_STEP_PIN 63 // K1 -#define Z_DIR_PIN 62 // K0 -#define Z_ENABLE_PIN 64 // K2 +#define Z_STEP_PIN 63 // K1 +#define Z_DIR_PIN 62 // K0 +#define Z_ENABLE_PIN 64 // K2 -#define E0_STEP_PIN 25 // A3 -#define E0_DIR_PIN 24 // A2 -#define E0_ENABLE_PIN 26 // A4 +#define E0_STEP_PIN 25 // A3 +#define E0_DIR_PIN 24 // A2 +#define E0_ENABLE_PIN 26 // A4 -#define E1_STEP_PIN 29 // A7 -#define E1_DIR_PIN 28 // A6 -#define E1_ENABLE_PIN 39 // G2 +#define E1_STEP_PIN 29 // A7 +#define E1_DIR_PIN 28 // A6 +#define E1_ENABLE_PIN 39 // G2 // // I2C Digipots - MCP4018 @@ -115,17 +115,17 @@ // Set from 0 - 127 with stop bit. // (Ex. 3F << 1 | 1) // -#define DIGIPOTS_I2C_SCL 76 // J5 -#define DIGIPOTS_I2C_SDA_X 57 // F3 -#define DIGIPOTS_I2C_SDA_Y 61 // F7 -#define DIGIPOTS_I2C_SDA_Z 65 // K3 -#define DIGIPOTS_I2C_SDA_E0 27 // A5 -#define DIGIPOTS_I2C_SDA_E1 77 // J6 +#define DIGIPOTS_I2C_SCL 76 // J5 +#define DIGIPOTS_I2C_SDA_X 57 // F3 +#define DIGIPOTS_I2C_SDA_Y 61 // F7 +#define DIGIPOTS_I2C_SDA_Z 65 // K3 +#define DIGIPOTS_I2C_SDA_E0 27 // A5 +#define DIGIPOTS_I2C_SDA_E1 77 // J6 // // Temperature Sensors // -#define TEMP_BED_PIN 69 // K7 +#define TEMP_BED_PIN 69 // K7 // SPI for Max6675 or Max31855 Thermocouple // Uses a separate SPI bus @@ -135,10 +135,10 @@ // 2 E4 CS2 // 78 E2 SCK // -#define THERMO_SCK_PIN 78 // E2 -#define THERMO_DO_PIN 3 // E5 -#define THERMO_CS1 5 // E3 -#define THERMO_CS2 2 // E4 +#define THERMO_SCK_PIN 78 // E2 +#define THERMO_DO_PIN 3 // E5 +#define THERMO_CS1 5 // E3 +#define THERMO_CS2 2 // E4 #define MAX6675_SS THERMO_CS1 #define MAX6675_SCK_PIN THERMO_SCK_PIN @@ -150,10 +150,10 @@ // 2 extruders or 1 extruder and a heated bed. // With no heated bed, an additional 24V fan is possible. // -#define MOSFET_A_PIN 6 // H3 -#define MOSFET_B_PIN 11 // B5 - Rev A of this file had this pin assigned to 9 -#define MOSFET_C_PIN 45 // L4 -#define MOSFET_D_PIN 44 // L5 +#define MOSFET_A_PIN 6 // H3 +#define MOSFET_B_PIN 11 // B5 - Rev A of this file had this pin assigned to 9 +#define MOSFET_C_PIN 45 // L4 +#define MOSFET_D_PIN 44 // L5 #if HOTENDS > 1 #if TEMP_SENSOR_BED @@ -195,43 +195,43 @@ // // Extruder Auto Fan Pins // -#define ORIG_E0_AUTO_FAN_PIN 7 // H4 -#define ORIG_E1_AUTO_FAN_PIN 12 // B6 +#define ORIG_E0_AUTO_FAN_PIN 7 // H4 +#define ORIG_E1_AUTO_FAN_PIN 12 // B6 // // Misc. Functions // -#define LED_PIN 13 // B7 -#define CUTOFF_RESET_PIN 16 // H1 -#define CUTOFF_TEST_PIN 17 // H0 -#define CASE_LIGHT_PIN 44 // L5 MUST BE HARDWARE PWM +#define LED_PIN 13 // B7 +#define CUTOFF_RESET_PIN 16 // H1 +#define CUTOFF_TEST_PIN 17 // H0 +#define CASE_LIGHT_PIN 44 // L5 MUST BE HARDWARE PWM // // LCD / Controller // #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 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 + #define BTN_EN2 75 // J4, UP + #define BTN_EN1 73 // J3, DOWN //STOP button connected as KILL_PIN - #define KILL_PIN 14 // J1, RIGHT + #define KILL_PIN 14 // J1, RIGHT //KILL - not connected - #define BEEPER_PIN 8 // H5, SD_WP + #define BEEPER_PIN 8 // H5, SD_WP - #define BTN_CENTER 15 // J0 - #define BTN_ENC BTN_CENTER + #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) + #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 @@ -239,29 +239,29 @@ // #define SAV_3DLCD - #define SR_DATA_PIN 34 // C3 - #define SR_CLK_PIN 35 // C2 - #define SR_STROBE_PIN 33 // C4 + #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 + #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 BEEPER_PIN 4 // G5 - #define STAT_LED_RED_PIN 32 // C5 - #define STAT_LED_BLUE_PIN 31 // C6 (Actually green) + #define STAT_LED_RED_PIN 32 // C5 + #define STAT_LED_BLUE_PIN 31 // C6 (Actually green) #endif // // SD Card // -#define SDSS 53 // B0 -#define SD_DETECT_PIN 9 // H6 +#define SDSS 53 // B0 +#define SD_DETECT_PIN 9 // H6 #define MAX_PIN THERMO_SCK_PIN @@ -275,9 +275,6 @@ - - - // 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" diff --git a/Marlin/pins_MINITRONICS.h b/Marlin/pins_MINITRONICS.h index 43f63ab231..fbdf7cbb66 100644 --- a/Marlin/pins_MINITRONICS.h +++ b/Marlin/pins_MINITRONICS.h @@ -104,9 +104,9 @@ #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD) - #define LCD_PINS_RS 15 // CS chip select /SS chip slave select - #define LCD_PINS_ENABLE 11 // SID (MOSI) - #define LCD_PINS_D4 10 // SCK (CLK) clock + #define LCD_PINS_RS 15 // CS chip select /SS chip slave select + #define LCD_PINS_ENABLE 11 // SID (MOSI) + #define LCD_PINS_D4 10 // SCK (CLK) clock #define BTN_EN1 18 #define BTN_EN2 17 diff --git a/Marlin/pins_RAMBO.h b/Marlin/pins_RAMBO.h index a317b1b763..268ebfefcb 100644 --- a/Marlin/pins_RAMBO.h +++ b/Marlin/pins_RAMBO.h @@ -151,12 +151,12 @@ #if ENABLED(NEWPANEL) - #define LCD_PINS_RS 70 + #define LCD_PINS_RS 70 #define LCD_PINS_ENABLE 71 - #define LCD_PINS_D4 72 - #define LCD_PINS_D5 73 - #define LCD_PINS_D6 74 - #define LCD_PINS_D7 75 + #define LCD_PINS_D4 72 + #define LCD_PINS_D5 73 + #define LCD_PINS_D6 74 + #define LCD_PINS_D7 75 #if ENABLED(VIKI2) || ENABLED(miniVIKI) #define BEEPER_PIN 44 @@ -202,12 +202,12 @@ //#define SHIFT_OUT 40 //#define SHIFT_EN 17 - #define LCD_PINS_RS 75 + #define LCD_PINS_RS 75 #define LCD_PINS_ENABLE 17 - #define LCD_PINS_D4 23 - #define LCD_PINS_D5 25 - #define LCD_PINS_D6 27 - #define LCD_PINS_D7 29 + #define LCD_PINS_D4 23 + #define LCD_PINS_D5 25 + #define LCD_PINS_D6 27 + #define LCD_PINS_D7 29 #endif // !NEWPANEL diff --git a/Marlin/pins_RAMPS.h b/Marlin/pins_RAMPS.h index 4939a2b245..411e0f47ca 100644 --- a/Marlin/pins_RAMPS.h +++ b/Marlin/pins_RAMPS.h @@ -220,25 +220,25 @@ #if ENABLED(ULTRA_LCD) #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD) - #define LCD_PINS_RS 49 // CS chip select /SS chip slave select - #define LCD_PINS_ENABLE 51 // SID (MOSI) - #define LCD_PINS_D4 52 // SCK (CLK) clock + #define LCD_PINS_RS 49 // CS chip select /SS chip slave select + #define LCD_PINS_ENABLE 51 // SID (MOSI) + #define LCD_PINS_D4 52 // SCK (CLK) clock #elif ENABLED(NEWPANEL) && ENABLED(PANEL_ONE) - #define LCD_PINS_RS 40 - #define LCD_PINS_ENABLE 42 - #define LCD_PINS_D4 65 - #define LCD_PINS_D5 66 - #define LCD_PINS_D6 44 - #define LCD_PINS_D7 64 + #define LCD_PINS_RS 40 + #define LCD_PINS_ENABLE 42 + #define LCD_PINS_D4 65 + #define LCD_PINS_D5 66 + #define LCD_PINS_D6 44 + #define LCD_PINS_D7 64 #else - #define LCD_PINS_RS 16 - #define LCD_PINS_ENABLE 17 - #define LCD_PINS_D4 23 - #define LCD_PINS_D5 25 - #define LCD_PINS_D6 27 - #define LCD_PINS_D7 29 + #define LCD_PINS_RS 16 + #define LCD_PINS_ENABLE 17 + #define LCD_PINS_D4 23 + #define LCD_PINS_D5 25 + #define LCD_PINS_D6 27 + #define LCD_PINS_D7 29 #if DISABLED(NEWPANEL) - #define BEEPER_PIN 33 + #define BEEPER_PIN 33 // Buttons are attached to a shift register // Not wired yet //#define SHIFT_CLK 38 @@ -251,118 +251,125 @@ #if ENABLED(NEWPANEL) #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) - #define BEEPER_PIN 37 - #define BTN_EN1 31 - #define BTN_EN2 33 - #define BTN_ENC 35 + #define BEEPER_PIN 37 - #define SD_DETECT_PIN 49 - #define KILL_PIN 41 + #define BTN_EN1 31 + #define BTN_EN2 33 + #define BTN_ENC 35 + + #define SD_DETECT_PIN 49 + #define KILL_PIN 41 #if ENABLED(BQ_LCD_SMART_CONTROLLER) #define LCD_BACKLIGHT_PIN 39 #endif #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD) - #define BTN_EN1 64 - #define BTN_EN2 59 - #define BTN_ENC 63 - #define SD_DETECT_PIN 42 + + #define BTN_EN1 64 + #define BTN_EN2 59 + #define BTN_ENC 63 + #define SD_DETECT_PIN 42 + #elif ENABLED(LCD_I2C_PANELOLU2) - #define BTN_EN1 47 // reverse if the encoder turns the wrong way. - #define BTN_EN2 43 - #define BTN_ENC 32 - #define LCD_SDSS 53 - #define SD_DETECT_PIN -1 - #define KILL_PIN 41 + + #define BTN_EN1 47 + #define BTN_EN2 43 + #define BTN_ENC 32 + #define LCD_SDSS 53 + #define SD_DETECT_PIN -1 + #define KILL_PIN 41 + #elif ENABLED(LCD_I2C_VIKI) - #define BTN_EN1 22 // reverse if the encoder turns the wrong way. - #define BTN_EN2 7 // http://files.panucatt.com/datasheets/viki_wiring_diagram.pdf - // tells about 40/42. - // 22/7 are unused on RAMPS_14. 22 is unused and 7 the SERVO0_PIN on RAMPS_13. - #define BTN_ENC -1 - #define LCD_SDSS 53 - #define SD_DETECT_PIN 49 + + #define BTN_EN1 22 // http://files.panucatt.com/datasheets/viki_wiring_diagram.pdf explains 40/42. + #define BTN_EN2 7 // 22/7 are unused on RAMPS_14. 22 is unused and 7 the SERVO0_PIN on RAMPS_13. + + #define BTN_ENC -1 + #define LCD_SDSS 53 + #define SD_DETECT_PIN 49 + #elif ENABLED(VIKI2) || ENABLED(miniVIKI) - #define BEEPER_PIN 33 + + #define BEEPER_PIN 33 // Pins for DOGM SPI LCD Support - #define DOGLCD_A0 44 - #define DOGLCD_CS 45 + #define DOGLCD_A0 44 + #define DOGLCD_CS 45 #define LCD_SCREEN_ROT_180 - #define BTN_EN1 22 - #define BTN_EN2 7 - #define BTN_ENC 39 + #define BTN_EN1 22 + #define BTN_EN2 7 + #define BTN_ENC 39 - #define SDSS 53 - #define SD_DETECT_PIN -1 // Pin 49 for display sd interface, 72 for easy adapter board + #define SDSS 53 + #define SD_DETECT_PIN -1 // Pin 49 for display sd interface, 72 for easy adapter board - #define KILL_PIN 31 + #define KILL_PIN 31 - #define STAT_LED_RED_PIN 32 + #define STAT_LED_RED_PIN 32 #define STAT_LED_BLUE_PIN 35 #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) - #define BTN_EN1 35 // reverse if the encoder turns the wrong way. - #define BTN_EN2 37 - #define BTN_ENC 31 - #define SD_DETECT_PIN 49 - #define LCD_SDSS 53 - #define KILL_PIN 41 - #define BEEPER_PIN 23 - #define DOGLCD_CS 29 - #define DOGLCD_A0 27 + #define BTN_EN1 35 + #define BTN_EN2 37 + #define BTN_ENC 31 + #define SD_DETECT_PIN 49 + #define LCD_SDSS 53 + #define KILL_PIN 41 + #define BEEPER_PIN 23 + #define DOGLCD_CS 29 + #define DOGLCD_A0 27 #define LCD_BACKLIGHT_PIN 33 #elif ENABLED(MINIPANEL) - #define BEEPER_PIN 42 + #define BEEPER_PIN 42 // Pins for DOGM SPI LCD Support - #define DOGLCD_A0 44 - #define DOGLCD_CS 66 + #define DOGLCD_A0 44 + #define DOGLCD_CS 66 #define LCD_BACKLIGHT_PIN 65 // backlight LED on A11/D65 - #define SDSS 53 + #define SDSS 53 - #define KILL_PIN 64 + #define KILL_PIN 64 // GLCD features - //#define LCD_CONTRAST 190 + //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 //#define LCD_SCREEN_ROT_270 // The encoder and click button - #define BTN_EN1 40 - #define BTN_EN2 63 - #define BTN_ENC 59 + #define BTN_EN1 40 + #define BTN_EN2 63 + #define BTN_ENC 59 // not connected to a pin - #define SD_DETECT_PIN 49 + #define SD_DETECT_PIN 49 #else // Beeper on AUX-4 - #define BEEPER_PIN 33 + #define BEEPER_PIN 33 // buttons are directly attached using AUX-2 #if ENABLED(REPRAPWORLD_KEYPAD) - #define BTN_EN1 64 // encoder - #define BTN_EN2 59 // encoder - #define BTN_ENC 63 // enter button - #define SHIFT_OUT 40 // shift register - #define SHIFT_CLK 44 // shift register - #define SHIFT_LD 42 // shift register + #define BTN_EN1 64 + #define BTN_EN2 59 + #define BTN_ENC 63 + #define SHIFT_OUT 40 + #define SHIFT_CLK 44 + #define SHIFT_LD 42 #elif ENABLED(PANEL_ONE) - #define BTN_EN1 59 // AUX2 PIN 3 - #define BTN_EN2 63 // AUX2 PIN 4 - #define BTN_ENC 49 // AUX3 PIN 7 + #define BTN_EN1 59 // AUX2 PIN 3 + #define BTN_EN2 63 // AUX2 PIN 4 + #define BTN_ENC 49 // AUX3 PIN 7 #else - #define BTN_EN1 37 - #define BTN_EN2 35 - #define BTN_ENC 31 // the click + #define BTN_EN1 37 + #define BTN_EN2 35 + #define BTN_ENC 31 #endif #if ENABLED(G3D_PANEL) - #define SD_DETECT_PIN 49 - #define KILL_PIN 41 + #define SD_DETECT_PIN 49 + #define KILL_PIN 41 #else //#define SD_DETECT_PIN -1 // Ramps doesn't use this #endif diff --git a/Marlin/pins_SCOOVO_X9H.h b/Marlin/pins_SCOOVO_X9H.h index a687c97285..6b7cf4f800 100644 --- a/Marlin/pins_SCOOVO_X9H.h +++ b/Marlin/pins_SCOOVO_X9H.h @@ -126,21 +126,21 @@ // // LCD / Controller // -#define LCD_PINS_RS 70 // Ext2_5 -#define LCD_PINS_ENABLE 71 // Ext2_7 -#define LCD_PINS_D4 72 // Ext2_9 ? -#define LCD_PINS_D5 73 // Ext2_11 ? -#define LCD_PINS_D6 74 // Ext2_13 -#define LCD_PINS_D7 75 // Ext2_15 ? +#define LCD_PINS_RS 70 // Ext2_5 +#define LCD_PINS_ENABLE 71 // Ext2_7 +#define LCD_PINS_D4 72 // Ext2_9 ? +#define LCD_PINS_D5 73 // Ext2_11 ? +#define LCD_PINS_D6 74 // Ext2_13 +#define LCD_PINS_D7 75 // Ext2_15 ? #define BEEPER_PIN -1 -#define BTN_HOME 80 // Ext_16 -#define BTN_CENTER 81 // Ext_14 +#define BTN_HOME 80 // Ext_16 +#define BTN_CENTER 81 // Ext_14 #define BTN_ENC BTN_CENTER -#define BTN_RIGHT 82 // Ext_12 -#define BTN_LEFT 83 // Ext_10 -#define BTN_UP 84 // Ext2_8 -#define BTN_DOWN 85 // Ext2_6 +#define BTN_RIGHT 82 // Ext_12 +#define BTN_LEFT 83 // Ext_10 +#define BTN_UP 84 // Ext2_8 +#define BTN_DOWN 85 // Ext2_6 #define HOME_PIN BTN_HOME @@ -151,7 +151,7 @@ #define DOGLCD_CS 71 #define LCD_SCREEN_ROT_180 - #define SD_DETECT_PIN -1 // Pin 72 if using easy adapter board + #define SD_DETECT_PIN -1 // Pin 72 if using easy adapter board #define STAT_LED_RED_PIN 22 #define STAT_LED_BLUE_PIN 32 diff --git a/Marlin/pins_ULTIMAKER.h b/Marlin/pins_ULTIMAKER.h index cb11768071..d8e7d26bf3 100644 --- a/Marlin/pins_ULTIMAKER.h +++ b/Marlin/pins_ULTIMAKER.h @@ -109,7 +109,7 @@ #define SDSS 53 #define LED_PIN 13 #define PS_ON_PIN 12 -#define SUICIDE_PIN 54 // PIN that has to be turned on right after start, to keep power flowing. +#define SUICIDE_PIN 54 // PIN that has to be turned on right after start, to keep power flowing. #define CASE_LIGHT_PIN 8 // @@ -121,12 +121,12 @@ #if ENABLED(NEWPANEL) - #define LCD_PINS_RS 20 + #define LCD_PINS_RS 20 #define LCD_PINS_ENABLE 17 - #define LCD_PINS_D4 16 - #define LCD_PINS_D5 21 - #define LCD_PINS_D6 5 - #define LCD_PINS_D7 6 + #define LCD_PINS_D4 16 + #define LCD_PINS_D5 21 + #define LCD_PINS_D6 5 + #define LCD_PINS_D7 6 // buttons are directly attached #define BTN_EN1 40 From 748bf323884fff054a7c998a4c27ea79a568a10b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 8 Jun 2017 18:08:30 -0500 Subject: [PATCH 4/5] Unify AVR90USB: pinsDebug changes --- Marlin/Marlin_main.cpp | 68 ++++++---- Marlin/pinsDebug.h | 239 +++++++++++++++++++++------------ Marlin/pinsDebug_Teensyduino.h | 26 ++-- Marlin/pinsDebug_list.h | 34 ++++- 4 files changed, 235 insertions(+), 132 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index df12d05513..61c2fbefa9 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -732,9 +732,7 @@ void report_current_position_detail(); SERIAL_ECHOPAIR(", ", y); SERIAL_ECHOPAIR(", ", z); SERIAL_CHAR(')'); - - if (suffix) {serialprintPGM(suffix);} //won't compile for Teensy with the previous construction - else SERIAL_EOL(); + if (suffix) serialprintPGM(suffix); else SERIAL_EOL(); } void print_xyz(const char* prefix, const char* suffix, const float xyz[]) { @@ -6366,23 +6364,44 @@ inline void gcode_M42() { wait = parser.seen('W') ? parser.value_int() : 500; for (uint8_t pin = start; pin <= end; pin++) { + //report_pin_state_extended(pin, I_flag, false); + if (!I_flag && pin_is_protected(pin)) { - SERIAL_ECHOPAIR("Sensitive Pin: ", pin); - SERIAL_ECHOLNPGM(" untouched."); + report_pin_state_extended(pin, I_flag, true, "Untouched "); + SERIAL_EOL(); } else { - SERIAL_ECHOPAIR("Pulsing Pin: ", pin); - pinMode(pin, OUTPUT); - for (int16_t j = 0; j < repeat; j++) { - digitalWrite(pin, 0); - safe_delay(wait); - digitalWrite(pin, 1); - safe_delay(wait); - digitalWrite(pin, 0); - safe_delay(wait); + report_pin_state_extended(pin, I_flag, true, "Pulsing "); + #ifdef AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO + if (pin == 46) { + SET_OUTPUT(46); + for (int16_t j = 0; j < repeat; j++) { + WRITE(46, 0); safe_delay(wait); + WRITE(46, 1); safe_delay(wait); + WRITE(46, 0); safe_delay(wait); + } + } + else if (pin == 47) { + SET_OUTPUT(47); + for (int16_t j = 0; j < repeat; j++) { + WRITE(47, 0); safe_delay(wait); + WRITE(47, 1); safe_delay(wait); + WRITE(47, 0); safe_delay(wait); + } + } + else + #endif + { + pinMode(pin, OUTPUT); + for (int16_t j = 0; j < repeat; j++) { + digitalWrite(pin, 0); safe_delay(wait); + digitalWrite(pin, 1); safe_delay(wait); + digitalWrite(pin, 0); safe_delay(wait); + } } + } - SERIAL_CHAR('\n'); + SERIAL_EOL(); } SERIAL_ECHOLNPGM("Done."); @@ -6527,13 +6546,13 @@ inline void gcode_M42() { * M43 E - Enable / disable background endstop monitoring * - Machine continues to operate * - Reports changes to endstops - * - Toggles LED when an endstop changes + * - Toggles LED_PIN when an endstop changes * - Can not reliably catch the 5mS pulse from BLTouch type probes * * M43 T - Toggle pin(s) and report which pin is being toggled * S - Start Pin number. If not given, will default to 0 * L - End Pin number. If not given, will default to last pin defined for this board - * I - Flag to ignore Marlin's pin protection. Use with caution!!!! + * I - Flag to ignore Marlin's pin protection. Use with caution!!!! * R - Repeat pulses on each pin this number of times before continueing to next pin * W - Wait time (in miliseconds) between pulses. If not given will default to 500 * @@ -6542,7 +6561,7 @@ inline void gcode_M42() { */ inline void gcode_M43() { - if (parser.seen('T')) { // must be first ot else it's "S" and "E" parameters will execute endstop or servo test + if (parser.seen('T')) { // must be first or else it's "S" and "E" parameters will execute endstop or servo test toggle_pins(); return; } @@ -6576,6 +6595,7 @@ inline void gcode_M42() { for (int8_t pin = first_pin; pin <= last_pin; pin++) { if (pin_is_protected(pin) && !ignore_protection) continue; pinMode(pin, INPUT_PULLUP); + delay(1); /* if (IS_ANALOG(pin)) pin_state[pin - first_pin] = analogRead(pin - analogInputToDigitalPin(0)); // int16_t pin_state[...] @@ -6591,7 +6611,7 @@ inline void gcode_M42() { for (;;) { for (int8_t pin = first_pin; pin <= last_pin; pin++) { - if (pin_is_protected(pin)) continue; + if (pin_is_protected(pin) && !ignore_protection) continue; const byte val = /* IS_ANALOG(pin) @@ -6600,7 +6620,7 @@ inline void gcode_M42() { //*/ digitalRead(pin); if (val != pin_state[pin - first_pin]) { - report_pin_state(pin); + report_pin_state_extended(pin, ignore_protection, false); pin_state[pin - first_pin] = val; } } @@ -6612,14 +6632,14 @@ inline void gcode_M42() { } #endif - safe_delay(500); + safe_delay(200); } return; } // Report current state of selected pin(s) for (uint8_t pin = first_pin; pin <= last_pin; pin++) - report_pin_state_extended(pin, ignore_protection); + report_pin_state_extended(pin, ignore_protection, true); } #endif // PINS_DEBUGGING @@ -12164,7 +12184,9 @@ void prepare_move_to_destination() { val &= 0x07; switch (digitalPinToTimer(pin)) { #ifdef TCCR0A - case TIMER0A: + #if !AVR_AT90USB1286_FAMILY + case TIMER0A: + #endif case TIMER0B: //_SET_CS(0, val); break; diff --git a/Marlin/pinsDebug.h b/Marlin/pinsDebug.h index dafd51e357..5bd13a491d 100644 --- a/Marlin/pinsDebug.h +++ b/Marlin/pinsDebug.h @@ -20,18 +20,13 @@ * */ - bool endstop_monitor_flag = false; -#define NAME_FORMAT "%-28s" // one place to specify the format of all the sources of names +#define NAME_FORMAT "%-35s" // one place to specify the format of all the sources of names // "-" left justify, "28" minimum width of name, pad with blanks #define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && ((P) <= analogInputToDigitalPin(15) || (P) <= analogInputToDigitalPin(7))) -#define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)) -#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__)) -#define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__)) - /** * This routine minimizes RAM usage by creating a FLASH resident array to * store the pin names, pin numbers and analog/digital flag. @@ -52,7 +47,7 @@ bool endstop_monitor_flag = false; #define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER) #include "pinsDebug_list.h" -#line 56 +#line 51 // manually add pins that have names that are macros which don't play well with these macros #if SERIAL_PORT == 0 && (AVR_ATmega2560_FAMILY || AVR_ATmega1284_FAMILY) @@ -88,27 +83,34 @@ const char* const pin_array[][3] PROGMEM = { // manually add pins ... #if SERIAL_PORT == 0 #if AVR_ATmega2560_FAMILY - { RXD_NAME, "0", "1" }, - { TXD_NAME, "1", "1" }, + { RXD_NAME, 0, 1 }, + { TXD_NAME, 1, 1 }, #elif AVR_ATmega1284_FAMILY - { RXD_NAME, "8", "1" }, - { TXD_NAME, "9", "1" }, + { RXD_NAME, 8, 1 }, + { TXD_NAME, 9, 1 }, #endif #endif #include "pinsDebug_list.h" - #line 101 + #line 96 }; #define n_array (sizeof(pin_array) / sizeof(char*)) / 3 -#ifndef TIMER1B - // working with Teensyduino extension so need to re-define some things +#if AVR_AT90USB1286_FAMILY + // Working with Teensyduino extension so need to re-define some things #include "pinsDebug_Teensyduino.h" + // Can't use the "digitalPinToPort" function from the Teensyduino type IDEs + // portModeRegister takes a different argument + #define digitalPinToPort_DEBUG(p) digitalPinToPort_Teensy(p) + #define get_pinMode(pin) (*portModeRegister(pin) & digitalPinToBitMask(pin)) +#else + #define digitalPinToPort_DEBUG(p) digitalPinToPort(p) + bool get_pinMode(int8_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask(pin); } #endif -#define PWM_PRINT(V) do{ sprintf(buffer, "PWM: %4d", V); SERIAL_ECHO(buffer); }while(0) +#define PWM_PRINT(V) do{ sprintf_P(buffer, PSTR("PWM: %4d"), V); SERIAL_ECHO(buffer); }while(0) #define PWM_CASE(N,Z) \ case TIMER##N##Z: \ if (TCCR##N##A & (_BV(COM##N##Z##1) | _BV(COM##N##Z##0))) { \ @@ -127,7 +129,9 @@ static bool pwm_status(uint8_t pin) { #if defined(TCCR0A) && defined(COM0A1) #ifdef TIMER0A - PWM_CASE(0, A); + #if !AVR_AT90USB1286_FAMILY // not available in Teensyduino type IDEs + PWM_CASE(0, A); + #endif #endif PWM_CASE(0, B); #endif @@ -244,9 +248,10 @@ const volatile uint8_t* const PWM_OCR[][3] PROGMEM = { static void err_is_counter() { SERIAL_PROTOCOLPGM(" non-standard PWM mode"); } static void err_is_interrupt() { SERIAL_PROTOCOLPGM(" compare interrupt enabled"); } static void err_prob_interrupt() { SERIAL_PROTOCOLPGM(" overflow interrupt enabled"); } +static void print_is_also_tied() { SERIAL_PROTOCOLPGM(" is also tied to this pin"); SERIAL_PROTOCOL_SP(14); } void com_print(uint8_t N, uint8_t Z) { - uint8_t *TCCRA = (uint8_t*)TCCR_A(N); + const uint8_t *TCCRA = (uint8_t*)TCCR_A(N); SERIAL_PROTOCOLPGM(" COM"); SERIAL_PROTOCOLCHAR(N + '0'); switch (Z) { @@ -264,8 +269,8 @@ void com_print(uint8_t N, uint8_t Z) { void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N - WGM bit layout char buffer[20]; // for the sprintf statements - uint8_t *TCCRB = (uint8_t*)TCCR_B(T); - uint8_t *TCCRA = (uint8_t*)TCCR_A(T); + const uint8_t *TCCRB = (uint8_t*)TCCR_B(T), + *TCCRA = (uint8_t*)TCCR_A(T); uint8_t WGM = (((*TCCRB & _BV(WGM_2)) >> 1) | (*TCCRA & (_BV(WGM_0) | _BV(WGM_1)))); if (N == 4) WGM |= ((*TCCRB & _BV(WGM_3)) >> 1); @@ -275,11 +280,11 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N - SERIAL_PROTOCOL_SP(3); if (N == 3) { - uint8_t *OCRVAL8 = (uint8_t*)OCR_VAL(T, L - 'A'); + const uint8_t *OCRVAL8 = (uint8_t*)OCR_VAL(T, L - 'A'); PWM_PRINT(*OCRVAL8); } else { - uint16_t *OCRVAL16 = (uint16_t*)OCR_VAL(T, L - 'A'); + const uint16_t *OCRVAL16 = (uint16_t*)OCR_VAL(T, L - 'A'); PWM_PRINT(*OCRVAL16); } SERIAL_PROTOCOLPAIR(" WGM: ", WGM); @@ -294,12 +299,12 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N - SERIAL_PROTOCOLCHAR(T + '0'); SERIAL_PROTOCOLPAIR("B: ", *TCCRB); - uint8_t *TMSK = (uint8_t*)TIMSK(T); + const uint8_t *TMSK = (uint8_t*)TIMSK(T); SERIAL_PROTOCOLPGM(" TIMSK"); SERIAL_PROTOCOLCHAR(T + '0'); SERIAL_PROTOCOLPAIR(": ", *TMSK); - uint8_t OCIE = L - 'A' + 1; + const uint8_t OCIE = L - 'A' + 1; if (N == 3) { if (WGM == 0 || WGM == 2 || WGM == 4 || WGM == 6) err_is_counter(); } else { if (WGM == 0 || WGM == 4 || WGM == 12 || WGM == 13) err_is_counter(); } if (TEST(*TMSK, OCIE)) err_is_interrupt(); @@ -311,7 +316,9 @@ static void pwm_details(uint8_t pin) { #if defined(TCCR0A) && defined(COM0A1) #ifdef TIMER0A - case TIMER0A: timer_prefix(0, 'A', 3); break; + #if !AVR_AT90USB1286_FAMILY // not available in Teensyduino type IDEs + case TIMER0A: timer_prefix(0, 'A', 3); break; + #endif #endif case TIMER0B: timer_prefix(0, 'B', 3); break; #endif @@ -357,136 +364,192 @@ static void pwm_details(uint8_t pin) { // on pins that have two PWMs, print info on second PWM #if AVR_ATmega2560_FAMILY || AVR_AT90USB1286_FAMILY // looking for port B7 - PWMs 0A and 1C - if (digitalPinToPort(pin) == 2 && digitalPinToBitMask(pin) == 0x80) { - #ifndef TEENSYDUINO_IDE + if (digitalPinToPort_DEBUG(pin) == 'B' - 64 && 0x80 == digitalPinToBitMask(pin)) { + #if !AVR_AT90USB1286_FAMILY SERIAL_PROTOCOLPGM("\n ."); SERIAL_PROTOCOL_SP(18); - SERIAL_PROTOCOLPGM("TIMER1C is also tied to this pin"); - SERIAL_PROTOCOL_SP(13); + SERIAL_PROTOCOLPGM("TIMER1C"); + print_is_also_tied(); timer_prefix(1, 'C', 4); #else SERIAL_PROTOCOLPGM("\n ."); SERIAL_PROTOCOL_SP(18); - SERIAL_PROTOCOLPGM("TIMER0A is also tied to this pin"); - SERIAL_PROTOCOL_SP(13); + SERIAL_PROTOCOLPGM("TIMER0A"); + print_is_also_tied(); timer_prefix(0, 'A', 3); #endif } #endif } // pwm_details -bool get_pinMode(int8_t pin) { return *portModeRegister(digitalPinToPort(pin)) & digitalPinToBitMask(pin); } - -#ifndef digitalRead_mod // use Teensyduino's version of digitalRead - it doesn't disable the PWMs - int digitalRead_mod(int8_t pin) { // same as digitalRead except the PWM stop section has been removed - uint8_t port = digitalPinToPort(pin); +#ifndef digitalRead_mod // Use Teensyduino's version of digitalRead - it doesn't disable the PWMs + int digitalRead_mod(const int8_t pin) { // same as digitalRead except the PWM stop section has been removed + const uint8_t port = digitalPinToPort_DEBUG(pin); return (port != NOT_A_PIN) && (*portInputRegister(port) & digitalPinToBitMask(pin)) ? HIGH : LOW; } #endif void print_port(int8_t pin) { // print port number - #ifdef digitalPinToPort + #ifdef digitalPinToPort_DEBUG + uint8_t x; SERIAL_PROTOCOLPGM(" Port: "); - uint8_t x = digitalPinToPort(pin) + 64; + #if AVR_AT90USB1286_FAMILY + x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64; + #else + x = digitalPinToPort_DEBUG(pin) + 64; + #endif SERIAL_CHAR(x); - uint8_t temp = digitalPinToBitMask(pin); - for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1; + + #if AVR_AT90USB1286_FAMILY + if (pin == 46) + x = '2'; + else if (pin == 47) + x = '3'; + else { + uint8_t temp = digitalPinToBitMask(pin); + for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1; + } + #else + uint8_t temp = digitalPinToBitMask(pin); + for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1; + #endif SERIAL_CHAR(x); #else SERIAL_PROTOCOL_SP(10); #endif } +static void print_input_or_output(const bool isout) { + serialprintPGM(isout ? PSTR("Output = ") : PSTR("Input = ")); +} + // pretty report with PWM info -inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = true) { +inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = false,const char *start_string = "") { uint8_t temp_char; - char *name_mem_pointer; - char buffer[30]; // for the sprintf statements - bool found = false, - multi_name_pin = false; + char *name_mem_pointer, buffer[30]; // for the sprintf statements + bool found = false, multi_name_pin = false; for (uint8_t x = 0; x < n_array; x++) { // scan entire array and report all instances of this pin if (pgm_read_byte(&pin_array[x][1]) == pin) { if (found) multi_name_pin = true; found = true; if (!multi_name_pin) { // report digitial and analog pin number only on the first time through - sprintf(buffer, "PIN: %3d ", pin); // digital pin number + sprintf_P(buffer, PSTR("%sPIN: %3d "), start_string, pin); // digital pin number SERIAL_ECHO(buffer); print_port(pin); if (IS_ANALOG(pin)) { - sprintf(buffer, " (A%2d) ", int(pin - analogInputToDigitalPin(0))); // analog pin number + sprintf_P(buffer, PSTR(" (A%2d) "), int(pin - analogInputToDigitalPin(0))); // analog pin number SERIAL_ECHO(buffer); } else SERIAL_ECHO_SP(8); // add padding if not an analog pin } else { SERIAL_CHAR('.'); - SERIAL_ECHO_SP(25); // add padding if not the first instance found + SERIAL_ECHO_SP(26 + strlen(start_string)); // add padding if not the first instance found } name_mem_pointer = (char*)pgm_read_word(&pin_array[x][0]); for (uint8_t y = 0; y < 28; y++) { // always print pin name temp_char = pgm_read_byte(name_mem_pointer + y); - if (temp_char != 0) MYSERIAL.write(temp_char); + if (temp_char != 0) + MYSERIAL.write(temp_char); else { for (uint8_t i = 0; i < 28 - y; i++) MYSERIAL.write(' '); break; } } - if (pin_is_protected(pin) && !ignore) - SERIAL_ECHOPGM("protected "); - else { - if (!(pgm_read_byte(&pin_array[x][2]))) { - sprintf(buffer, "Analog in = %5d", analogRead(pin - analogInputToDigitalPin(0))); - SERIAL_ECHO(buffer); - } + if (extended) { + if (pin_is_protected(pin) && !ignore) + SERIAL_ECHOPGM("protected "); else { - if (!get_pinMode(pin)) { - //pinMode(pin, INPUT_PULLUP); // make sure input isn't floating - stopped doing this - // because this could interfere with inductive/capacitive - // sensors (high impedance voltage divider) and with PT100 amplifier - SERIAL_PROTOCOLPAIR("Input = ", digitalRead_mod(pin)); + #ifdef AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO + if (pin == 46) { + print_input_or_output(GET_OUTPUT(46)); + SERIAL_PROTOCOL(READ(46)); + } + else if (pin == 47) + print_input_or_output(GET_OUTPUT(47)); + SERIAL_PROTOCOL(READ(47)); + } + else + #endif + { + if (!(pgm_read_byte(&pin_array[x][2]))) { + sprintf_P(buffer, PSTR("Analog in = %5d"), analogRead(pin - analogInputToDigitalPin(0))); + SERIAL_ECHO(buffer); + } + else { + + if (!get_pinMode(pin)) { + //pinMode(pin, INPUT_PULLUP); // make sure input isn't floating - stopped doing this + // because this could interfere with inductive/capacitive + // sensors (high impedance voltage divider) and with PT100 amplifier + print_input_or_output(false); + SERIAL_PROTOCOL(digitalRead_mod(pin)); + } + else if (pwm_status(pin)) { + // do nothing + } + else { + print_input_or_output(true); + SERIAL_PROTOCOL(digitalRead_mod(pin)); + } + } + if (!multi_name_pin && extended) pwm_details(pin); // report PWM capabilities only on the first pass & only if doing an extended report } - else if (pwm_status(pin)) { - // do nothing - } - else SERIAL_PROTOCOLPAIR("Output = ", digitalRead_mod(pin)); } - if (!multi_name_pin && extended) pwm_details(pin); // report PWM capabilities only on the first pass & only if doing an extended report } SERIAL_EOL(); } // end of IF } // end of for loop if (!found) { - sprintf(buffer, "PIN: %3d ", pin); + sprintf_P(buffer, PSTR("%sPIN: %3d "), start_string, pin); SERIAL_ECHO(buffer); print_port(pin); if (IS_ANALOG(pin)) { - sprintf(buffer, " (A%2d) ", int(pin - analogInputToDigitalPin(0))); // analog pin number + sprintf_P(buffer, PSTR(" (A%2d) "), int(pin - analogInputToDigitalPin(0))); // analog pin number SERIAL_ECHO(buffer); } - else - SERIAL_ECHO_SP(8); // add padding if not an analog pin - SERIAL_ECHOPGM(""); - if (get_pinMode(pin)) { - SERIAL_PROTOCOL_SP(12); - SERIAL_PROTOCOLPAIR("Output = ", digitalRead_mod(pin)); - } else { - if (IS_ANALOG(pin)) { - sprintf(buffer, " Analog in = %5d", analogRead(pin - analogInputToDigitalPin(0))); - SERIAL_ECHO(buffer); - } - else - SERIAL_ECHO_SP(9); // add padding if not an analog pin + SERIAL_ECHO_SP(8); // add padding if not an analog pin + SERIAL_ECHOPGM(""); + if (extended) { + #ifdef AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO + if (pin == 46 || pin == 47) { + SERIAL_PROTOCOL_SP(12); + if (pin == 46) { + print_input_or_output(GET_OUTPUT(46)); + SERIAL_PROTOCOL(READ(46)); + } + else { + print_input_or_output(GET_OUTPUT(47)); + SERIAL_PROTOCOL(READ(47)); + } + } + else + #endif + { + if (get_pinMode(pin)) { + SERIAL_PROTOCOL_SP(12); + print_input_or_output(true); + SERIAL_PROTOCOL(digitalRead_mod(pin)); + } + else { + if (IS_ANALOG(pin)) { + sprintf_P(buffer, PSTR(" Analog in = %5d"), analogRead(pin - analogInputToDigitalPin(0))); + SERIAL_ECHO(buffer); + SERIAL_ECHOPGM(" "); + } + else + SERIAL_ECHO_SP(12); // add padding if not an analog pin - SERIAL_PROTOCOLPAIR(" Input = ", digitalRead_mod(pin)); + print_input_or_output(false); + SERIAL_PROTOCOL(digitalRead_mod(pin)); + } + //if (!pwm_status(pin)) SERIAL_CHAR(' '); // add padding if it's not a PWM pin + if (extended) pwm_details(pin); // report PWM capabilities only if doing an extended report + } + } + SERIAL_EOL(); } - //if (!pwm_status(pin)) SERIAL_CHAR(' '); // add padding if it's not a PWM pin - if (extended) pwm_details(pin); // report PWM capabilities only if doing an extended report - SERIAL_EOL(); } } - -inline void report_pin_state(int8_t pin) { - report_pin_state_extended(pin, false, false); -} diff --git a/Marlin/pinsDebug_Teensyduino.h b/Marlin/pinsDebug_Teensyduino.h index 187c190f68..797a2cd71f 100644 --- a/Marlin/pinsDebug_Teensyduino.h +++ b/Marlin/pinsDebug_Teensyduino.h @@ -25,21 +25,16 @@ // do not function the same as the other Arduino extensions // +#ifndef __PINSDEBUG_TEENSYDUINO_H__ +#define __PINSDEBUG_TEENSYDUINO_H__ -#define TEENSYDUINO_IDE +#undef NUM_DIGITAL_PINS +#define NUM_DIGITAL_PINS 48 // Teensy says 46 but FASTIO is 48 -//digitalPinToTimer(pin) function works like Arduino but Timers are not defined -#define TIMER0B 1 -#define TIMER1A 7 -#define TIMER1B 8 -#define TIMER1C 9 -#define TIMER2A 6 -#define TIMER2B 2 -#define TIMER3A 5 -#define TIMER3B 4 -#define TIMER3C 3 +// "digitalPinToPort" function just returns the pin number so need to create our own. +// Can't use the name "digitalPinToPort" for our own because it interferes with the +// FAST_PWM_FAN function if we do -// digitalPinToPort function just returns the pin number so need to create our own #define PA 1 #define PB 2 #define PC 3 @@ -47,9 +42,8 @@ #define PE 5 #define PF 6 -#undef digitalPinToPort -const uint8_t PROGMEM digital_pin_to_port_PGM[] = { +const uint8_t PROGMEM digital_pin_to_port_PGM_Teensy[] = { PD, // 0 - PD0 - INT0 - PWM PD, // 1 - PD1 - INT1 - PWM PD, // 2 - PD2 - INT2 - RX @@ -100,7 +94,7 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = { PE, // 47 - PE3 (not defined in teensyduino) }; -#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) ) +#define digitalPinToPort_Teensy(P) ( pgm_read_byte( digital_pin_to_port_PGM_Teensy + (P) ) ) // digitalPinToBitMask(pin) is OK @@ -108,3 +102,5 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = { // disable the PWMs so we can use it as is // portModeRegister(pin) is OK + +#endif // __PINSDEBUG_TEENSYDUINO_H__ diff --git a/Marlin/pinsDebug_list.h b/Marlin/pinsDebug_list.h index dfdd411046..90eaa1c620 100644 --- a/Marlin/pinsDebug_list.h +++ b/Marlin/pinsDebug_list.h @@ -353,22 +353,22 @@ #if defined(LCD_CONTRAST) && LCD_CONTRAST >= 0 REPORT_NAME_DIGITAL(LCD_CONTRAST, __LINE__ ) #endif -#if PIN_EXISTS(LCD) +#if defined(LCD_PINS_D4) && LCD_PINS_D4 >= 0 REPORT_NAME_DIGITAL(LCD_PINS_D4, __LINE__ ) #endif -#if PIN_EXISTS(LCD) +#if defined(LCD_PINS_D5) && LCD_PINS_D5 >= 0 REPORT_NAME_DIGITAL(LCD_PINS_D5, __LINE__ ) #endif -#if PIN_EXISTS(LCD) +#if defined(LCD_PINS_D6) && LCD_PINS_D6 >= 0 REPORT_NAME_DIGITAL(LCD_PINS_D6, __LINE__ ) #endif -#if PIN_EXISTS(LCD) +#if defined(LCD_PINS_D7) && LCD_PINS_D7 >= 0 REPORT_NAME_DIGITAL(LCD_PINS_D7, __LINE__ ) #endif -#if PIN_EXISTS(LCD) +#if defined(LCD_PINS_ENABLE) && LCD_PINS_ENABLE >= 0 REPORT_NAME_DIGITAL(LCD_PINS_ENABLE, __LINE__ ) #endif -#if PIN_EXISTS(LCD) +#if defined(LCD_PINS_RS) && LCD_PINS_RS >= 0 REPORT_NAME_DIGITAL(LCD_PINS_RS, __LINE__ ) #endif #if defined(LCD_SDSS) && LCD_SDSS >= 0 @@ -446,6 +446,18 @@ #if PIN_EXISTS(RAMPS_D9) REPORT_NAME_DIGITAL(RAMPS_D9_PIN, __LINE__ ) #endif +#if PIN_EXISTS(RGB_LED_R) + REPORT_NAME_DIGITAL(RGB_LED_R_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(RGB_LED_G) + REPORT_NAME_DIGITAL(RGB_LED_G_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(RGB_LED_B) + REPORT_NAME_DIGITAL(RGB_LED_B_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(RGB_LED_W) + REPORT_NAME_DIGITAL(RGB_LED_W_PIN, __LINE__ ) +#endif #if PIN_EXISTS(RX_ENABLE) REPORT_NAME_DIGITAL(RX_ENABLE_PIN, __LINE__ ) #endif @@ -500,12 +512,21 @@ #if PIN_EXISTS(SLEEP_WAKE) REPORT_NAME_DIGITAL(SLEEP_WAKE_PIN, __LINE__ ) #endif +#if PIN_EXISTS(SOL0) + REPORT_NAME_DIGITAL(SOL0_PIN, __LINE__ ) +#endif #if PIN_EXISTS(SOL1) REPORT_NAME_DIGITAL(SOL1_PIN, __LINE__ ) #endif #if PIN_EXISTS(SOL2) REPORT_NAME_DIGITAL(SOL2_PIN, __LINE__ ) #endif +#if PIN_EXISTS(SOL3) + REPORT_NAME_DIGITAL(SOL3_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(SOL4) + REPORT_NAME_DIGITAL(SOL4_PIN, __LINE__ ) +#endif #if defined(SPARE_IO) && SPARE_IO >= 0 REPORT_NAME_DIGITAL(SPARE_IO, __LINE__ ) #endif @@ -749,3 +770,4 @@ #if PIN_EXISTS(Z2_STEP) REPORT_NAME_DIGITAL(Z2_STEP_PIN, __LINE__ ) #endif + From 51bc50214afa2ab8faf706c511fcccefa2a1557b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 8 Jun 2017 18:23:07 -0500 Subject: [PATCH 5/5] Save 8 bytes of SRAM --- Marlin/stepper_dac.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/stepper_dac.cpp b/Marlin/stepper_dac.cpp index 0e7b8c8137..322a9403f6 100644 --- a/Marlin/stepper_dac.cpp +++ b/Marlin/stepper_dac.cpp @@ -49,7 +49,7 @@ bool dac_present = false; const uint8_t dac_order[NUM_AXIS] = DAC_STEPPER_ORDER; - uint16_t dac_channel_pct[XYZE] = DAC_MOTOR_CURRENT_DEFAULT; + uint8_t dac_channel_pct[XYZE] = DAC_MOTOR_CURRENT_DEFAULT; int dac_init() { #if PIN_EXISTS(DAC_DISABLE) @@ -95,7 +95,7 @@ static float dac_amps(int8_t n) { return mcp4728_getDrvPct(dac_order[n]) * (DAC_STEPPER_MAX) * 0.125 * (1.0 / (DAC_STEPPER_SENSE)); } int16_t dac_current_get_percent(AxisEnum axis) { return mcp4728_getDrvPct(dac_order[axis]); } - void dac_current_set_percents(int16_t pct[XYZE]) { + void dac_current_set_percents(const int8_t pct[XYZE]) { LOOP_XYZE(i) dac_channel_pct[i] = pct[dac_order[i]]; mcp4728_setDrvPct(dac_channel_pct); }