From ce4b5bbeaaaf479e618cb63899b6d027c460e83e Mon Sep 17 00:00:00 2001
From: Johann Rocholl <johann@rocholl.net>
Date: Sat, 8 Dec 2012 10:45:58 -0800
Subject: [PATCH 1/9] Add AT90USB646 support from Sprinter to fastio.h.

---
 Marlin/fastio.h | 647 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 647 insertions(+)

diff --git a/Marlin/fastio.h b/Marlin/fastio.h
index 6749a28bf9..acb1ac9067 100644
--- a/Marlin/fastio.h
+++ b/Marlin/fastio.h
@@ -1928,6 +1928,653 @@ pins
 
 #endif
 
+#if defined (__AVR_AT90USB646__)
+// SPI
+#define	SCK					DIO9
+#define	MISO				DIO11
+#define	MOSI				DIO10
+#define	SS					DIO8
+
+// change for your board
+#define	DEBUG_LED		DIO31 /* led D5 red */
+
+/*
+pins
+*/
+#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
+
+
+
+#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
+
 #if defined (__AVR_AT90USB1287__) || defined (__AVR_AT90USB1286__)
 // SPI
 #define	SCK					DIO9

From 42e21bb06ed614a5b148329a38fab44724862cd1 Mon Sep 17 00:00:00 2001
From: Johann Rocholl <johann@rocholl.net>
Date: Sat, 8 Dec 2012 10:49:01 -0800
Subject: [PATCH 2/9] Add support for Printrboard (from
 https://github.com/lincomatic/Marlin) and Brainwave (from
 https://github.com/metrix/Sprinter).

---
 Marlin/Configuration.h |   2 +
 Marlin/pins.h          | 200 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 202 insertions(+)

diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 4aff7fe099..9db8dee5f4 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -37,6 +37,8 @@
 // 7  = Ultimaker
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
 // 8  = Teensylu
+// 81 = Printrboard (AT90USB1286)
+// 82 = Brainwave (AT90USB646)
 // 9  = Gen3+
 // 70 = Megatronics
 // 90 = Alpha OMCA board
diff --git a/Marlin/pins.h b/Marlin/pins.h
index febe2cd1f3..f61f534d04 100644
--- a/Marlin/pins.h
+++ b/Marlin/pins.h
@@ -1015,6 +1015,206 @@
 #endif
 #endif
 
+/****************************************************************************************
+* Printrboard Rev. B pin assingments (ATMEGA90USB1286)
+* 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
+****************************************************************************************/
+#if MOTHERBOARD == 81
+#define MOTHERBOARD 8  // Disable MarlinSerial etc.
+#define KNOWN_BOARD 1
+
+#ifndef __AVR_AT90USB1286__
+#error Oops!  Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu.
+#endif
+
+#define X_STEP_PIN         28
+#define X_DIR_PIN          29
+#define X_ENABLE_PIN       19
+#define X_MIN_PIN          47
+#define X_MAX_PIN          -1
+
+#define Y_STEP_PIN         30
+#define Y_DIR_PIN          31
+#define Y_ENABLE_PIN       18
+#define Y_MIN_PIN           20
+#define Y_MAX_PIN          -1
+
+#define Z_STEP_PIN         32
+#define Z_DIR_PIN          33
+#define Z_ENABLE_PIN       17
+#define Z_MIN_PIN          36
+#define Z_MAX_PIN          -1
+
+#define E0_STEP_PIN         34
+#define E0_DIR_PIN          35
+#define E0_ENABLE_PIN       13
+
+#define HEATER_0_PIN       15  // Extruder
+#define HEATER_1_PIN       -1
+#define HEATER_2_PIN       -1
+#define HEATER_BED_PIN     14  // Bed
+#define FAN_PIN            16  // Fan
+
+#define TEMP_0_PIN          1  // Extruder - ANALOG PIN NUMBERING
+#define TEMP_1_PIN         -1
+#define TEMP_2_PIN         -1
+#define TEMP_BED_PIN        0  // Bed - ANALOG PIN NUMBERING
+
+#define SDPOWER            -1
+#define SDSS                26
+#define LED_PIN            -1
+#define PS_ON_PIN          -1
+#define KILL_PIN           -1
+
+#ifndef SDSUPPORT
+// these pins are defined in the SD library if building with SD support
+  #define SCK_PIN          21
+  #define MISO_PIN         22
+  #define MOSI_PIN         23
+#endif
+
+#ifdef ULTRA_LCD
+
+  #ifdef NEWPANEL
+  //arduino pin which triggers an piezzo beeper
+    #define BEEPER 33			// Beeper on AUX-4
+
+#ifndef MCP28017_LCD
+    #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
+#endif // MCP28017_LCD
+
+    //buttons are directly attached using AUX-2
+    #define BTN_EN1 11 // PC1
+    #define BTN_EN2 12 // PC2
+#ifndef VERSAPANEL
+    #define BTN_ENC 31  //the click
+#endif
+
+    #define BLEN_C 2
+    #define BLEN_B 1
+    #define BLEN_A 0
+
+    #define SDCARDDETECT -1		// Ramps does not use this port
+
+      //encoder rotation values
+    #define encrot0 0
+    #define encrot1 2
+    #define encrot2 3
+    #define encrot3 1
+
+  #else //old style panel with shift register
+    //arduino pin witch triggers an piezzo beeper
+    #define BEEPER 33		No Beeper added
+
+    //buttons are attached to a shift register
+	// Not wired this yet
+    //#define SHIFT_CLK 38
+    //#define SHIFT_LD 42
+    //#define SHIFT_OUT 40
+    //#define SHIFT_EN 17
+
+    #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
+
+    //encoder rotation values
+    #define encrot0 0
+    #define encrot1 2
+    #define encrot2 3
+    #define encrot3 1
+
+    //bits in the shift register that carry the buttons for:
+    // left up center down right red
+    #define BL_LE 7
+    #define BL_UP 6
+    #define BL_MI 5
+    #define BL_DW 4
+    #define BL_RI 3
+    #define BL_ST 2
+
+    #define BLEN_B 1
+    #define BLEN_A 0
+  #endif
+#endif //ULTRA_LCD
+
+#endif
+
+/****************************************************************************************
+ * Brainwave 1.0 pin assignments (AT90USB646)
+ * Requires hardware bundle for Arduino:
+   https://github.com/unrepentantgeek/brainwave-arduino
+ ****************************************************************************************/
+#if MOTHERBOARD == 82
+#define MOTHERBOARD 8  // Disable MarlinSerial etc.
+#define KNOWN_BOARD 1
+
+#ifndef __AVR_AT90USB646__
+#error Oops!  Make sure you have 'Brainwave' selected from the 'Tools -> Boards' menu.
+#endif
+
+#define X_STEP_PIN         27
+#define X_DIR_PIN          29
+#define X_ENABLE_PIN       28
+#define X_MIN_PIN           7
+#define X_MAX_PIN          -1
+#define X_ATT_PIN          26
+
+#define Y_STEP_PIN         31
+#define Y_DIR_PIN          33
+#define Y_ENABLE_PIN       32
+#define Y_MIN_PIN           6
+#define Y_MAX_PIN          -1
+#define Y_ATT_PIN          30
+
+#define Z_STEP_PIN         17
+#define Z_DIR_PIN          19
+#define Z_ENABLE_PIN       18
+#define Z_MIN_PIN           5
+#define Z_MAX_PIN          -1
+#define Z_ATT_PIN          16
+
+#define E0_STEP_PIN         21
+#define E0_DIR_PIN          23
+#define E0_ENABLE_PIN       22
+#define E0_ATT_PIN          20
+
+#define HEATER_0_PIN        4  // Extruder
+#define HEATER_1_PIN       -1
+#define HEATER_2_PIN       -1
+#define HEATER_BED_PIN     38  // Bed
+#define FAN_PIN             3  // Fan
+
+#define TEMP_0_PIN          7  // Extruder / Analog pin numbering
+#define TEMP_1_PIN         -1
+#define TEMP_2_PIN         -1
+#define TEMP_BED_PIN        6  // Bed / Analog pin numbering
+
+#define SDPOWER            -1
+#define SDSS               -1
+#define LED_PIN            39
+#define PS_ON_PIN          -1
+#define KILL_PIN           -1
+#define ALARM_PIN          -1
+
+#ifndef SDSUPPORT
+// these pins are defined in the SD library if building with SD support
+  #define SCK_PIN          21
+  #define MISO_PIN         22
+  #define MOSI_PIN         23
+#endif
+
+#endif
+
 /****************************************************************************************
 * Gen3+ pin assignment
 *

From b1c38d4c82cff9ee75e8eec90f102d83cbad0023 Mon Sep 17 00:00:00 2001
From: Johann Rocholl <johann@rocholl.net>
Date: Sat, 8 Dec 2012 11:34:18 -0800
Subject: [PATCH 3/9] Avoid compiler warnings (redefined MOTHERBOARD) in
 Arduino 1.0 and greater.

---
 Marlin/pins.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Marlin/pins.h b/Marlin/pins.h
index f61f534d04..ce15248158 100644
--- a/Marlin/pins.h
+++ b/Marlin/pins.h
@@ -1022,6 +1022,7 @@
 * See http://reprap.org/wiki/Printrboard for more info
 ****************************************************************************************/
 #if MOTHERBOARD == 81
+#undef MOTHERBOARD
 #define MOTHERBOARD 8  // Disable MarlinSerial etc.
 #define KNOWN_BOARD 1
 
@@ -1155,6 +1156,7 @@
    https://github.com/unrepentantgeek/brainwave-arduino
  ****************************************************************************************/
 #if MOTHERBOARD == 82
+#undef MOTHERBOARD
 #define MOTHERBOARD 8  // Disable MarlinSerial etc.
 #define KNOWN_BOARD 1
 

From 6aa87a7b67f164ca2aa81d651e427f1ef5d2554f Mon Sep 17 00:00:00 2001
From: Johann Rocholl <johann@rocholl.net>
Date: Sat, 8 Dec 2012 15:16:38 -0800
Subject: [PATCH 4/9] Use the same fastio.h definition for AT90USB1286/7 and
 AT90USB646/7.

---
 Marlin/fastio.h | 649 +-----------------------------------------------
 1 file changed, 1 insertion(+), 648 deletions(-)

diff --git a/Marlin/fastio.h b/Marlin/fastio.h
index acb1ac9067..ed77b50e23 100644
--- a/Marlin/fastio.h
+++ b/Marlin/fastio.h
@@ -1928,654 +1928,7 @@ pins
 
 #endif
 
-#if defined (__AVR_AT90USB646__)
-// SPI
-#define	SCK					DIO9
-#define	MISO				DIO11
-#define	MOSI				DIO10
-#define	SS					DIO8
-
-// change for your board
-#define	DEBUG_LED		DIO31 /* led D5 red */
-
-/*
-pins
-*/
-#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
-
-
-
-#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
-
-#if defined (__AVR_AT90USB1287__) || defined (__AVR_AT90USB1286__)
+#if defined (__AVR_AT90USB1287__) || defined (__AVR_AT90USB1286__) || defined (__AVR_AT90USB646__) || defined(__AVR_AT90USB647__)
 // SPI
 #define	SCK					DIO9
 #define	MISO				DIO11

From a30007caa46c119c7d2053304f1c425d0a91b5de Mon Sep 17 00:00:00 2001
From: Johann Rocholl <johann@rocholl.net>
Date: Sat, 8 Dec 2012 19:46:42 -0800
Subject: [PATCH 5/9] If fastio.h is not messed up then Teensylu and
 Printrboard are actually using the same pins.

---
 Marlin/pins.h | 206 ++++++++++----------------------------------------
 1 file changed, 38 insertions(+), 168 deletions(-)

diff --git a/Marlin/pins.h b/Marlin/pins.h
index ce15248158..0ed6e55c0f 100644
--- a/Marlin/pins.h
+++ b/Marlin/pins.h
@@ -957,198 +957,68 @@
 #endif
 
 /****************************************************************************************
-* Teensylu 0.7 pin assingments (ATMEGA90USB)
-* Requires the Teensyduino software with Teensy2.0++ selected in arduino IDE!
-****************************************************************************************/
-#if MOTHERBOARD == 8
-#define MOTHERBOARD 8
-#define KNOWN_BOARD 1
-
-
-#define X_STEP_PIN          0  
-#define X_DIR_PIN           1  
-#define X_ENABLE_PIN       39 
-#define X_MIN_PIN          13 
-#define X_MAX_PIN          -1    
-
-#define Y_STEP_PIN          2  
-#define Y_DIR_PIN           3 
-#define Y_ENABLE_PIN       38 
-#define Y_MIN_PIN          14 
-#define Y_MAX_PIN          -1    
-
-#define Z_STEP_PIN          4
-#define Z_DIR_PIN           5 
-#define Z_ENABLE_PIN       23 
-#define Z_MIN_PIN          15 
-#define Z_MAX_PIN          -1    
-
-#define E0_STEP_PIN         6  
-#define E0_DIR_PIN          7 
-#define E0_ENABLE_PIN       19 
-
-
-
-#define HEATER_0_PIN       21  // Extruder
-#define HEATER_1_PIN       -1
-#define HEATER_2_PIN       -1
-#define HEATER_BED_PIN     20  // Bed
-#define FAN_PIN            22  // Fan   
-
-#define TEMP_0_PIN          7  // Extruder
-#define TEMP_1_PIN         -1
-#define TEMP_2_PIN         -1
-#define TEMP_BED_PIN        6  // Bed
-
-#define SDPOWER            -1
-#define SDSS                8
-#define LED_PIN            -1
-#define PS_ON_PIN          -1
-#define KILL_PIN           -1 
-#define ALARM_PIN          -1
-
-#ifndef SDSUPPORT
-// these pins are defined in the SD library if building with SD support  
-  #define SCK_PIN           9 
-  #define MISO_PIN         11 
-  #define MOSI_PIN         10 
-#endif
-#endif
-
-/****************************************************************************************
-* Printrboard Rev. B pin assingments (ATMEGA90USB1286)
-* Requires the Teensyduino software with Teensy++ 2.0 selected in arduino IDE!
+* Teensylu 0.7 / 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
 ****************************************************************************************/
-#if MOTHERBOARD == 81
+#if MOTHERBOARD == 8 || MOTHERBOARD == 81
 #undef MOTHERBOARD
-#define MOTHERBOARD 8  // Disable MarlinSerial etc.
+#define MOTHERBOARD 8
 #define KNOWN_BOARD 1
 
 #ifndef __AVR_AT90USB1286__
 #error Oops!  Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu.
 #endif
 
-#define X_STEP_PIN         28
-#define X_DIR_PIN          29
-#define X_ENABLE_PIN       19
-#define X_MIN_PIN          47
+#define X_STEP_PIN          0
+#define X_DIR_PIN           1
+#define X_ENABLE_PIN       39
+#define X_MIN_PIN          13
 #define X_MAX_PIN          -1
 
-#define Y_STEP_PIN         30
-#define Y_DIR_PIN          31
-#define Y_ENABLE_PIN       18
-#define Y_MIN_PIN           20
+#define Y_STEP_PIN          2
+#define Y_DIR_PIN           3
+#define Y_ENABLE_PIN       38
+#define Y_MIN_PIN          14
 #define Y_MAX_PIN          -1
 
-#define Z_STEP_PIN         32
-#define Z_DIR_PIN          33
-#define Z_ENABLE_PIN       17
-#define Z_MIN_PIN          36
+#define Z_STEP_PIN          4
+#define Z_DIR_PIN           5
+#define Z_ENABLE_PIN       23
+#define Z_MIN_PIN          15
 #define Z_MAX_PIN          -1
 
-#define E0_STEP_PIN         34
-#define E0_DIR_PIN          35
-#define E0_ENABLE_PIN       13
+#define E0_STEP_PIN         6
+#define E0_DIR_PIN          7
+#define E0_ENABLE_PIN      19
 
-#define HEATER_0_PIN       15  // Extruder
+#define HEATER_0_PIN       21  // Extruder
 #define HEATER_1_PIN       -1
 #define HEATER_2_PIN       -1
-#define HEATER_BED_PIN     14  // Bed
-#define FAN_PIN            16  // Fan
+#define HEATER_BED_PIN     20  // Bed
+#define FAN_PIN            22
 
-#define TEMP_0_PIN          1  // Extruder - ANALOG PIN NUMBERING
+#define TEMP_0_PIN          7  // Extruder / Analog PIN numbering
 #define TEMP_1_PIN         -1
 #define TEMP_2_PIN         -1
-#define TEMP_BED_PIN        0  // Bed - ANALOG PIN NUMBERING
+#define TEMP_BED_PIN        6  // Bed / Analog PIN numbering
 
 #define SDPOWER            -1
-#define SDSS                26
+#define SDSS                8
 #define LED_PIN            -1
 #define PS_ON_PIN          -1
 #define KILL_PIN           -1
+#define ALARM_PIN          -1
 
 #ifndef SDSUPPORT
 // these pins are defined in the SD library if building with SD support
-  #define SCK_PIN          21
-  #define MISO_PIN         22
-  #define MOSI_PIN         23
+  #define SCK_PIN           9
+  #define MISO_PIN         11
+  #define MOSI_PIN         10
 #endif
 
-#ifdef ULTRA_LCD
-
-  #ifdef NEWPANEL
-  //arduino pin which triggers an piezzo beeper
-    #define BEEPER 33			// Beeper on AUX-4
-
-#ifndef MCP28017_LCD
-    #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
-#endif // MCP28017_LCD
-
-    //buttons are directly attached using AUX-2
-    #define BTN_EN1 11 // PC1
-    #define BTN_EN2 12 // PC2
-#ifndef VERSAPANEL
-    #define BTN_ENC 31  //the click
-#endif
-
-    #define BLEN_C 2
-    #define BLEN_B 1
-    #define BLEN_A 0
-
-    #define SDCARDDETECT -1		// Ramps does not use this port
-
-      //encoder rotation values
-    #define encrot0 0
-    #define encrot1 2
-    #define encrot2 3
-    #define encrot3 1
-
-  #else //old style panel with shift register
-    //arduino pin witch triggers an piezzo beeper
-    #define BEEPER 33		No Beeper added
-
-    //buttons are attached to a shift register
-	// Not wired this yet
-    //#define SHIFT_CLK 38
-    //#define SHIFT_LD 42
-    //#define SHIFT_OUT 40
-    //#define SHIFT_EN 17
-
-    #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
-
-    //encoder rotation values
-    #define encrot0 0
-    #define encrot1 2
-    #define encrot2 3
-    #define encrot3 1
-
-    //bits in the shift register that carry the buttons for:
-    // left up center down right red
-    #define BL_LE 7
-    #define BL_UP 6
-    #define BL_MI 5
-    #define BL_DW 4
-    #define BL_RI 3
-    #define BL_ST 2
-
-    #define BLEN_B 1
-    #define BLEN_A 0
-  #endif
-#endif //ULTRA_LCD
-
-#endif
+#endif  // MOTHERBOARD == 8 (Teensylu) or 81 (Printrboard)
 
 /****************************************************************************************
  * Brainwave 1.0 pin assignments (AT90USB646)
@@ -1185,10 +1055,10 @@
 #define Z_MAX_PIN          -1
 #define Z_ATT_PIN          16
 
-#define E0_STEP_PIN         21
-#define E0_DIR_PIN          23
-#define E0_ENABLE_PIN       22
-#define E0_ATT_PIN          20
+#define E0_STEP_PIN        21
+#define E0_DIR_PIN         23
+#define E0_ENABLE_PIN      22
+#define E0_ATT_PIN         20
 
 #define HEATER_0_PIN        4  // Extruder
 #define HEATER_1_PIN       -1
@@ -1210,12 +1080,12 @@
 
 #ifndef SDSUPPORT
 // these pins are defined in the SD library if building with SD support
-  #define SCK_PIN          21
-  #define MISO_PIN         22
-  #define MOSI_PIN         23
+  #define SCK_PIN           9
+  #define MISO_PIN         11
+  #define MOSI_PIN         10
 #endif
 
-#endif
+#endif  // MOTHERBOARD == 82 (Brainwave)
 
 /****************************************************************************************
 * Gen3+ pin assignment

From 4d351b4846adceac75489f13f3c26d2a0485d530 Mon Sep 17 00:00:00 2001
From: Johann Rocholl <johann@rocholl.net>
Date: Sat, 8 Dec 2012 20:15:53 -0800
Subject: [PATCH 6/9] Improved formatting and comments for consistency.

---
 Marlin/pins.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Marlin/pins.h b/Marlin/pins.h
index 0ed6e55c0f..ec708d87a3 100644
--- a/Marlin/pins.h
+++ b/Marlin/pins.h
@@ -964,7 +964,7 @@
 ****************************************************************************************/
 #if MOTHERBOARD == 8 || MOTHERBOARD == 81
 #undef MOTHERBOARD
-#define MOTHERBOARD 8
+#define MOTHERBOARD 8  // Disable MarlinSerial etc.
 #define KNOWN_BOARD 1
 
 #ifndef __AVR_AT90USB1286__
@@ -997,12 +997,12 @@
 #define HEATER_1_PIN       -1
 #define HEATER_2_PIN       -1
 #define HEATER_BED_PIN     20  // Bed
-#define FAN_PIN            22
+#define FAN_PIN            22  // Fan
 
-#define TEMP_0_PIN          7  // Extruder / Analog PIN numbering
+#define TEMP_0_PIN          7  // Extruder / Analog pin numbering
 #define TEMP_1_PIN         -1
 #define TEMP_2_PIN         -1
-#define TEMP_BED_PIN        6  // Bed / Analog PIN numbering
+#define TEMP_BED_PIN        6  // Bed / Analog pin numbering
 
 #define SDPOWER            -1
 #define SDSS                8

From 6cba11f08765de0cf57709d740845c70afc6bcc8 Mon Sep 17 00:00:00 2001
From: Johann Rocholl <johann@rocholl.net>
Date: Sun, 9 Dec 2012 01:32:09 -0800
Subject: [PATCH 7/9] Stop redefining MOTHERBOARD and #define AT90USB instead.
 Also put #ifndef AT90USB around the HardwareSerial_h trick, so now
 Printrboard / Brainwave support compiles on Arduino 1.0.2 as well.

---
 Marlin/Marlin.h         | 4 +++-
 Marlin/MarlinSerial.cpp | 5 ++---
 Marlin/MarlinSerial.h   | 4 ++--
 Marlin/pins.h           | 6 ++----
 Marlin/stepper.cpp      | 6 +++---
 5 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h
index 2af7dc97a9..cae67ad5ea 100644
--- a/Marlin/Marlin.h
+++ b/Marlin/Marlin.h
@@ -4,7 +4,9 @@
 #ifndef MARLIN_H
 #define MARLIN_H
 
+#ifndef AT90USB
 #define  HardwareSerial_h // trick to disable the standard HWserial
+#endif
 
 #define  FORCE_INLINE __attribute__((always_inline)) inline
 
@@ -45,7 +47,7 @@
 
 #include "WString.h"
 
-#if MOTHERBOARD == 8  // Teensylu
+#ifdef AT90USB
   #define MYSERIAL Serial
 #else
   #define MYSERIAL MSerial
diff --git a/Marlin/MarlinSerial.cpp b/Marlin/MarlinSerial.cpp
index 0d2aceb3f2..1358f38590 100644
--- a/Marlin/MarlinSerial.cpp
+++ b/Marlin/MarlinSerial.cpp
@@ -23,7 +23,7 @@
 #include "Marlin.h"
 #include "MarlinSerial.h"
 
-#if MOTHERBOARD != 8 // !teensylu
+#ifndef AT90USB
 // this next line disables the entire HardwareSerial.cpp, 
 // this is so I can support Attiny series and any other chip without a uart
 #if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
@@ -319,5 +319,4 @@ void MarlinSerial::printFloat(double number, uint8_t digits)
 MarlinSerial MSerial;
 
 #endif // whole file
-#endif //teensylu
-
+#endif // !AT90USB
diff --git a/Marlin/MarlinSerial.h b/Marlin/MarlinSerial.h
index a48ffbe509..9514730fa0 100644
--- a/Marlin/MarlinSerial.h
+++ b/Marlin/MarlinSerial.h
@@ -65,7 +65,7 @@
 #define BYTE 0
 
 
-#if MOTHERBOARD != 8 // ! teensylu
+#ifndef AT90USB
 // Define constants and variables for buffering incoming serial data.  We're
 // using a ring buffer (I think), in which rx_buffer_head is the index of the
 // location to which to write the next incoming character and rx_buffer_tail
@@ -179,6 +179,6 @@ class MarlinSerial //: public Stream
 };
 
 extern MarlinSerial MSerial;
-#endif // ! teensylu
+#endif // !AT90USB
 
 #endif
diff --git a/Marlin/pins.h b/Marlin/pins.h
index ec708d87a3..53da259097 100644
--- a/Marlin/pins.h
+++ b/Marlin/pins.h
@@ -963,9 +963,8 @@
 * See http://reprap.org/wiki/Printrboard for more info
 ****************************************************************************************/
 #if MOTHERBOARD == 8 || MOTHERBOARD == 81
-#undef MOTHERBOARD
-#define MOTHERBOARD 8  // Disable MarlinSerial etc.
 #define KNOWN_BOARD 1
+#define AT90USB 1286  // Disable MarlinSerial etc.
 
 #ifndef __AVR_AT90USB1286__
 #error Oops!  Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu.
@@ -1026,9 +1025,8 @@
    https://github.com/unrepentantgeek/brainwave-arduino
  ****************************************************************************************/
 #if MOTHERBOARD == 82
-#undef MOTHERBOARD
-#define MOTHERBOARD 8  // Disable MarlinSerial etc.
 #define KNOWN_BOARD 1
+#define AT90USB 646  // Disable MarlinSerial etc.
 
 #ifndef __AVR_AT90USB646__
 #error Oops!  Make sure you have 'Brainwave' selected from the 'Tools -> Boards' menu.
diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp
index d9c0a45c5d..81f26f6be0 100644
--- a/Marlin/stepper.cpp
+++ b/Marlin/stepper.cpp
@@ -478,10 +478,10 @@ ISR(TIMER1_COMPA_vect)
 
     
     for(int8_t i=0; i < step_loops; i++) { // Take multiple steps per interrupt (For high speed moves) 
-      #if MOTHERBOARD != 8 // !teensylu
+      #ifndef AT90USB
       MSerial.checkRx(); // Check for serial chars.
-      #endif 
-      
+      #endif
+
       #ifdef ADVANCE
       counter_e += current_block->steps_e;
       if (counter_e > 0) {

From 621c24a10f4998c723a5f141ea123ea8fd1486ee Mon Sep 17 00:00:00 2001
From: Johann Rocholl <johann@rocholl.net>
Date: Sun, 9 Dec 2012 01:40:33 -0800
Subject: [PATCH 8/9] AT90USB is only defined after pins.h is included.

---
 Marlin/Marlin.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h
index cae67ad5ea..a6aa43e00a 100644
--- a/Marlin/Marlin.h
+++ b/Marlin/Marlin.h
@@ -4,10 +4,6 @@
 #ifndef MARLIN_H
 #define MARLIN_H
 
-#ifndef AT90USB
-#define  HardwareSerial_h // trick to disable the standard HWserial
-#endif
-
 #define  FORCE_INLINE __attribute__((always_inline)) inline
 
 #include <math.h>
@@ -26,6 +22,10 @@
 #include "Configuration.h"
 #include "pins.h"
 
+#ifndef AT90USB
+#define  HardwareSerial_h // trick to disable the standard HWserial
+#endif
+
 #if ARDUINO >= 100 
   #if defined(__AVR_ATmega644P__)
     #include "WProgram.h"
@@ -181,7 +181,7 @@ void setPwmFrequency(uint8_t pin, int val);
 
 extern float homing_feedrate[];
 extern bool axis_relative_modes[];
-extern int feedmultiply;
+extern int feedmultiply;
 extern bool feedmultiplychanged;
 extern int extrudemultiply; // Sets extrude multiply factor (in percent)
 extern float current_position[NUM_AXIS] ;

From 33247733e07364aa9cb0868bdb9b1c4fcc427c7e Mon Sep 17 00:00:00 2001
From: Johann Rocholl <johann@rocholl.net>
Date: Sun, 9 Dec 2012 02:19:13 -0800
Subject: [PATCH 9/9] Teensylu and Printrboard use different analog pins for
 thermistors.

---
 Marlin/pins.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Marlin/pins.h b/Marlin/pins.h
index 53da259097..59f86a5ac7 100644
--- a/Marlin/pins.h
+++ b/Marlin/pins.h
@@ -998,10 +998,16 @@
 #define HEATER_BED_PIN     20  // Bed
 #define FAN_PIN            22  // Fan
 
-#define TEMP_0_PIN          7  // Extruder / Analog pin numbering
+#if MOTHERBOARD == 8
+  #define TEMP_0_PIN          7  // Extruder / Analog pin numbering
+  #define TEMP_BED_PIN        6  // Bed / Analog pin numbering
+#else
+  #define TEMP_0_PIN          1  // Extruder / Analog pin numbering
+  #define TEMP_BED_PIN        0  // Bed / Analog pin numbering
+#endif
+
 #define TEMP_1_PIN         -1
 #define TEMP_2_PIN         -1
-#define TEMP_BED_PIN        6  // Bed / Analog pin numbering
 
 #define SDPOWER            -1
 #define SDSS                8