Sd2PinMap.h

Sat, 07 Nov 2015 13:24:46 +0100

author
mbayer
date
Sat, 07 Nov 2015 13:24:46 +0100
changeset 1
b584642d4f58
parent 0
2c8ba1964db7
permissions
-rw-r--r--

several modifications to support laser enable - still needs cleanup

0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1 /* Arduino SdFat Library
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2 * Copyright (C) 2010 by William Greiman
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
3 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
4 * This file is part of the Arduino SdFat Library
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
5 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
6 * This Library is free software: you can redistribute it and/or modify
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
8 * the Free Software Foundation, either version 3 of the License, or
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
9 * (at your option) any later version.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
10 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
11 * This Library is distributed in the hope that it will be useful,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
14 * GNU General Public License for more details.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
15 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
17 * along with the Arduino SdFat Library. If not, see
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
18 * <http://www.gnu.org/licenses/>.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
19 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
20 // Warning this file was generated by a program.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
21 #include "Marlin.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
22 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
23
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
24 #ifndef Sd2PinMap_h
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
25 #define Sd2PinMap_h
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
26 #include <avr/io.h>
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
27 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
28 /** struct for mapping digital pins */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
29 struct pin_map_t {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
30 volatile uint8_t* ddr;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
31 volatile uint8_t* pin;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
32 volatile uint8_t* port;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
33 uint8_t bit;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
34 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
35 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
36 #if defined(__AVR_ATmega1280__)\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
37 || defined(__AVR_ATmega2560__)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
38 // Mega
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
39
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
40 // Two Wire (aka I2C) ports
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
41 uint8_t const SDA_PIN = 20; // D1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
42 uint8_t const SCL_PIN = 21; // D0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
43
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
44 #undef MOSI_PIN
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
45 #undef MISO_PIN
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
46 // SPI port
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
47 uint8_t const SS_PIN = 53; // B0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
48 uint8_t const MOSI_PIN = 51; // B2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
49 uint8_t const MISO_PIN = 50; // B3
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
50 uint8_t const SCK_PIN = 52; // B1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
51
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
52 static const pin_map_t digitalPinMap[] = {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
53 {&DDRE, &PINE, &PORTE, 0}, // E0 0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
54 {&DDRE, &PINE, &PORTE, 1}, // E1 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
55 {&DDRE, &PINE, &PORTE, 4}, // E4 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
56 {&DDRE, &PINE, &PORTE, 5}, // E5 3
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
57 {&DDRG, &PING, &PORTG, 5}, // G5 4
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
58 {&DDRE, &PINE, &PORTE, 3}, // E3 5
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
59 {&DDRH, &PINH, &PORTH, 3}, // H3 6
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
60 {&DDRH, &PINH, &PORTH, 4}, // H4 7
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
61 {&DDRH, &PINH, &PORTH, 5}, // H5 8
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
62 {&DDRH, &PINH, &PORTH, 6}, // H6 9
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
63 {&DDRB, &PINB, &PORTB, 4}, // B4 10
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
64 {&DDRB, &PINB, &PORTB, 5}, // B5 11
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
65 {&DDRB, &PINB, &PORTB, 6}, // B6 12
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
66 {&DDRB, &PINB, &PORTB, 7}, // B7 13
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
67 {&DDRJ, &PINJ, &PORTJ, 1}, // J1 14
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
68 {&DDRJ, &PINJ, &PORTJ, 0}, // J0 15
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
69 {&DDRH, &PINH, &PORTH, 1}, // H1 16
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
70 {&DDRH, &PINH, &PORTH, 0}, // H0 17
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
71 {&DDRD, &PIND, &PORTD, 3}, // D3 18
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
72 {&DDRD, &PIND, &PORTD, 2}, // D2 19
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
73 {&DDRD, &PIND, &PORTD, 1}, // D1 20
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
74 {&DDRD, &PIND, &PORTD, 0}, // D0 21
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
75 {&DDRA, &PINA, &PORTA, 0}, // A0 22
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
76 {&DDRA, &PINA, &PORTA, 1}, // A1 23
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
77 {&DDRA, &PINA, &PORTA, 2}, // A2 24
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
78 {&DDRA, &PINA, &PORTA, 3}, // A3 25
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
79 {&DDRA, &PINA, &PORTA, 4}, // A4 26
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
80 {&DDRA, &PINA, &PORTA, 5}, // A5 27
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
81 {&DDRA, &PINA, &PORTA, 6}, // A6 28
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
82 {&DDRA, &PINA, &PORTA, 7}, // A7 29
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
83 {&DDRC, &PINC, &PORTC, 7}, // C7 30
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
84 {&DDRC, &PINC, &PORTC, 6}, // C6 31
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
85 {&DDRC, &PINC, &PORTC, 5}, // C5 32
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
86 {&DDRC, &PINC, &PORTC, 4}, // C4 33
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
87 {&DDRC, &PINC, &PORTC, 3}, // C3 34
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
88 {&DDRC, &PINC, &PORTC, 2}, // C2 35
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
89 {&DDRC, &PINC, &PORTC, 1}, // C1 36
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
90 {&DDRC, &PINC, &PORTC, 0}, // C0 37
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
91 {&DDRD, &PIND, &PORTD, 7}, // D7 38
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
92 {&DDRG, &PING, &PORTG, 2}, // G2 39
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
93 {&DDRG, &PING, &PORTG, 1}, // G1 40
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
94 {&DDRG, &PING, &PORTG, 0}, // G0 41
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
95 {&DDRL, &PINL, &PORTL, 7}, // L7 42
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
96 {&DDRL, &PINL, &PORTL, 6}, // L6 43
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
97 {&DDRL, &PINL, &PORTL, 5}, // L5 44
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
98 {&DDRL, &PINL, &PORTL, 4}, // L4 45
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
99 {&DDRL, &PINL, &PORTL, 3}, // L3 46
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
100 {&DDRL, &PINL, &PORTL, 2}, // L2 47
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
101 {&DDRL, &PINL, &PORTL, 1}, // L1 48
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
102 {&DDRL, &PINL, &PORTL, 0}, // L0 49
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
103 {&DDRB, &PINB, &PORTB, 3}, // B3 50
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
104 {&DDRB, &PINB, &PORTB, 2}, // B2 51
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
105 {&DDRB, &PINB, &PORTB, 1}, // B1 52
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
106 {&DDRB, &PINB, &PORTB, 0}, // B0 53
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
107 {&DDRF, &PINF, &PORTF, 0}, // F0 54
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
108 {&DDRF, &PINF, &PORTF, 1}, // F1 55
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
109 {&DDRF, &PINF, &PORTF, 2}, // F2 56
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
110 {&DDRF, &PINF, &PORTF, 3}, // F3 57
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
111 {&DDRF, &PINF, &PORTF, 4}, // F4 58
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
112 {&DDRF, &PINF, &PORTF, 5}, // F5 59
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
113 {&DDRF, &PINF, &PORTF, 6}, // F6 60
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
114 {&DDRF, &PINF, &PORTF, 7}, // F7 61
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
115 {&DDRK, &PINK, &PORTK, 0}, // K0 62
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
116 {&DDRK, &PINK, &PORTK, 1}, // K1 63
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
117 {&DDRK, &PINK, &PORTK, 2}, // K2 64
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
118 {&DDRK, &PINK, &PORTK, 3}, // K3 65
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
119 {&DDRK, &PINK, &PORTK, 4}, // K4 66
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
120 {&DDRK, &PINK, &PORTK, 5}, // K5 67
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
121 {&DDRK, &PINK, &PORTK, 6}, // K6 68
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
122 {&DDRK, &PINK, &PORTK, 7} // K7 69
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
123 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
124 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
125 #elif defined(__AVR_ATmega644P__)\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
126 || defined(__AVR_ATmega644__)\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
127 || defined(__AVR_ATmega1284P__)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
128 // Sanguino
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
129
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
130 // Two Wire (aka I2C) ports
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
131 uint8_t const SDA_PIN = 17; // C1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
132 uint8_t const SCL_PIN = 18; // C2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
133
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
134 // SPI port
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
135 uint8_t const SS_PIN = 4; // B4
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
136 uint8_t const MOSI_PIN = 5; // B5
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
137 uint8_t const MISO_PIN = 6; // B6
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
138 uint8_t const SCK_PIN = 7; // B7
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
139
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
140 static const pin_map_t digitalPinMap[] = {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
141 {&DDRB, &PINB, &PORTB, 0}, // B0 0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
142 {&DDRB, &PINB, &PORTB, 1}, // B1 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
143 {&DDRB, &PINB, &PORTB, 2}, // B2 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
144 {&DDRB, &PINB, &PORTB, 3}, // B3 3
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
145 {&DDRB, &PINB, &PORTB, 4}, // B4 4
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
146 {&DDRB, &PINB, &PORTB, 5}, // B5 5
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
147 {&DDRB, &PINB, &PORTB, 6}, // B6 6
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
148 {&DDRB, &PINB, &PORTB, 7}, // B7 7
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
149 {&DDRD, &PIND, &PORTD, 0}, // D0 8
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
150 {&DDRD, &PIND, &PORTD, 1}, // D1 9
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
151 {&DDRD, &PIND, &PORTD, 2}, // D2 10
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
152 {&DDRD, &PIND, &PORTD, 3}, // D3 11
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
153 {&DDRD, &PIND, &PORTD, 4}, // D4 12
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
154 {&DDRD, &PIND, &PORTD, 5}, // D5 13
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
155 {&DDRD, &PIND, &PORTD, 6}, // D6 14
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
156 {&DDRD, &PIND, &PORTD, 7}, // D7 15
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
157 {&DDRC, &PINC, &PORTC, 0}, // C0 16
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
158 {&DDRC, &PINC, &PORTC, 1}, // C1 17
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
159 {&DDRC, &PINC, &PORTC, 2}, // C2 18
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
160 {&DDRC, &PINC, &PORTC, 3}, // C3 19
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
161 {&DDRC, &PINC, &PORTC, 4}, // C4 20
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
162 {&DDRC, &PINC, &PORTC, 5}, // C5 21
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
163 {&DDRC, &PINC, &PORTC, 6}, // C6 22
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
164 {&DDRC, &PINC, &PORTC, 7}, // C7 23
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
165 {&DDRA, &PINA, &PORTA, 7}, // A7 24
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
166 {&DDRA, &PINA, &PORTA, 6}, // A6 25
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
167 {&DDRA, &PINA, &PORTA, 5}, // A5 26
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
168 {&DDRA, &PINA, &PORTA, 4}, // A4 27
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
169 {&DDRA, &PINA, &PORTA, 3}, // A3 28
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
170 {&DDRA, &PINA, &PORTA, 2}, // A2 29
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
171 {&DDRA, &PINA, &PORTA, 1}, // A1 30
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
172 {&DDRA, &PINA, &PORTA, 0} // A0 31
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
173 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
174 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
175 #elif defined(__AVR_ATmega32U4__)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
176 // Teensy 2.0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
177
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
178 // Two Wire (aka I2C) ports
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
179 uint8_t const SDA_PIN = 6; // D1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
180 uint8_t const SCL_PIN = 5; // D0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
181
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
182 // SPI port
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
183 uint8_t const SS_PIN = 0; // B0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
184 uint8_t const MOSI_PIN = 2; // B2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
185 uint8_t const MISO_PIN = 3; // B3
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
186 uint8_t const SCK_PIN = 1; // B1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
187
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
188 static const pin_map_t digitalPinMap[] = {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
189 {&DDRB, &PINB, &PORTB, 0}, // B0 0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
190 {&DDRB, &PINB, &PORTB, 1}, // B1 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
191 {&DDRB, &PINB, &PORTB, 2}, // B2 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
192 {&DDRB, &PINB, &PORTB, 3}, // B3 3
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
193 {&DDRB, &PINB, &PORTB, 7}, // B7 4
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
194 {&DDRD, &PIND, &PORTD, 0}, // D0 5
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
195 {&DDRD, &PIND, &PORTD, 1}, // D1 6
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
196 {&DDRD, &PIND, &PORTD, 2}, // D2 7
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
197 {&DDRD, &PIND, &PORTD, 3}, // D3 8
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
198 {&DDRC, &PINC, &PORTC, 6}, // C6 9
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
199 {&DDRC, &PINC, &PORTC, 7}, // C7 10
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
200 {&DDRD, &PIND, &PORTD, 6}, // D6 11
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
201 {&DDRD, &PIND, &PORTD, 7}, // D7 12
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
202 {&DDRB, &PINB, &PORTB, 4}, // B4 13
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
203 {&DDRB, &PINB, &PORTB, 5}, // B5 14
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
204 {&DDRB, &PINB, &PORTB, 6}, // B6 15
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
205 {&DDRF, &PINF, &PORTF, 7}, // F7 16
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
206 {&DDRF, &PINF, &PORTF, 6}, // F6 17
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
207 {&DDRF, &PINF, &PORTF, 5}, // F5 18
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
208 {&DDRF, &PINF, &PORTF, 4}, // F4 19
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
209 {&DDRF, &PINF, &PORTF, 1}, // F1 20
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
210 {&DDRF, &PINF, &PORTF, 0}, // F0 21
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
211 {&DDRD, &PIND, &PORTD, 4}, // D4 22
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
212 {&DDRD, &PIND, &PORTD, 5}, // D5 23
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
213 {&DDRE, &PINE, &PORTE, 6} // E6 24
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
214 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
215 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
216 #elif defined(__AVR_AT90USB646__)\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
217 || defined(__AVR_AT90USB1286__)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
218 // Teensy++ 1.0 & 2.0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
219
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
220 // Two Wire (aka I2C) ports
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
221 uint8_t const SDA_PIN = 1; // D1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
222 uint8_t const SCL_PIN = 0; // D0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
223
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
224 // SPI port
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
225 uint8_t const SS_PIN = 20; // B0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
226 uint8_t const MOSI_PIN = 22; // B2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
227 uint8_t const MISO_PIN = 23; // B3
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
228 uint8_t const SCK_PIN = 21; // B1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
229
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
230 static const pin_map_t digitalPinMap[] = {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
231 {&DDRD, &PIND, &PORTD, 0}, // D0 0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
232 {&DDRD, &PIND, &PORTD, 1}, // D1 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
233 {&DDRD, &PIND, &PORTD, 2}, // D2 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
234 {&DDRD, &PIND, &PORTD, 3}, // D3 3
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
235 {&DDRD, &PIND, &PORTD, 4}, // D4 4
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
236 {&DDRD, &PIND, &PORTD, 5}, // D5 5
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
237 {&DDRD, &PIND, &PORTD, 6}, // D6 6
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
238 {&DDRD, &PIND, &PORTD, 7}, // D7 7
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
239 {&DDRE, &PINE, &PORTE, 0}, // E0 8
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
240 {&DDRE, &PINE, &PORTE, 1}, // E1 9
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
241 {&DDRC, &PINC, &PORTC, 0}, // C0 10
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
242 {&DDRC, &PINC, &PORTC, 1}, // C1 11
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
243 {&DDRC, &PINC, &PORTC, 2}, // C2 12
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
244 {&DDRC, &PINC, &PORTC, 3}, // C3 13
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
245 {&DDRC, &PINC, &PORTC, 4}, // C4 14
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
246 {&DDRC, &PINC, &PORTC, 5}, // C5 15
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
247 {&DDRC, &PINC, &PORTC, 6}, // C6 16
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
248 {&DDRC, &PINC, &PORTC, 7}, // C7 17
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
249 {&DDRE, &PINE, &PORTE, 6}, // E6 18
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
250 {&DDRE, &PINE, &PORTE, 7}, // E7 19
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
251 {&DDRB, &PINB, &PORTB, 0}, // B0 20
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
252 {&DDRB, &PINB, &PORTB, 1}, // B1 21
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
253 {&DDRB, &PINB, &PORTB, 2}, // B2 22
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
254 {&DDRB, &PINB, &PORTB, 3}, // B3 23
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
255 {&DDRB, &PINB, &PORTB, 4}, // B4 24
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
256 {&DDRB, &PINB, &PORTB, 5}, // B5 25
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
257 {&DDRB, &PINB, &PORTB, 6}, // B6 26
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
258 {&DDRB, &PINB, &PORTB, 7}, // B7 27
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
259 {&DDRA, &PINA, &PORTA, 0}, // A0 28
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
260 {&DDRA, &PINA, &PORTA, 1}, // A1 29
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
261 {&DDRA, &PINA, &PORTA, 2}, // A2 30
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
262 {&DDRA, &PINA, &PORTA, 3}, // A3 31
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
263 {&DDRA, &PINA, &PORTA, 4}, // A4 32
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
264 {&DDRA, &PINA, &PORTA, 5}, // A5 33
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
265 {&DDRA, &PINA, &PORTA, 6}, // A6 34
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
266 {&DDRA, &PINA, &PORTA, 7}, // A7 35
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
267 {&DDRE, &PINE, &PORTE, 4}, // E4 36
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
268 {&DDRE, &PINE, &PORTE, 5}, // E5 37
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
269 {&DDRF, &PINF, &PORTF, 0}, // F0 38
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
270 {&DDRF, &PINF, &PORTF, 1}, // F1 39
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
271 {&DDRF, &PINF, &PORTF, 2}, // F2 40
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
272 {&DDRF, &PINF, &PORTF, 3}, // F3 41
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
273 {&DDRF, &PINF, &PORTF, 4}, // F4 42
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
274 {&DDRF, &PINF, &PORTF, 5}, // F5 43
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
275 {&DDRF, &PINF, &PORTF, 6}, // F6 44
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
276 {&DDRF, &PINF, &PORTF, 7} // F7 45
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
277 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
278 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
279 #elif defined(__AVR_ATmega168__)\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
280 ||defined(__AVR_ATmega168P__)\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
281 ||defined(__AVR_ATmega328P__)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
282 // 168 and 328 Arduinos
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
283
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
284 // Two Wire (aka I2C) ports
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
285 uint8_t const SDA_PIN = 18; // C4
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
286 uint8_t const SCL_PIN = 19; // C5
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
287
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
288 // SPI port
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
289 uint8_t const SS_PIN = 10; // B2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
290 uint8_t const MOSI_PIN = 11; // B3
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
291 uint8_t const MISO_PIN = 12; // B4
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
292 uint8_t const SCK_PIN = 13; // B5
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
293
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
294 static const pin_map_t digitalPinMap[] = {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
295 {&DDRD, &PIND, &PORTD, 0}, // D0 0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
296 {&DDRD, &PIND, &PORTD, 1}, // D1 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
297 {&DDRD, &PIND, &PORTD, 2}, // D2 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
298 {&DDRD, &PIND, &PORTD, 3}, // D3 3
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
299 {&DDRD, &PIND, &PORTD, 4}, // D4 4
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
300 {&DDRD, &PIND, &PORTD, 5}, // D5 5
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
301 {&DDRD, &PIND, &PORTD, 6}, // D6 6
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
302 {&DDRD, &PIND, &PORTD, 7}, // D7 7
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
303 {&DDRB, &PINB, &PORTB, 0}, // B0 8
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
304 {&DDRB, &PINB, &PORTB, 1}, // B1 9
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
305 {&DDRB, &PINB, &PORTB, 2}, // B2 10
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
306 {&DDRB, &PINB, &PORTB, 3}, // B3 11
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
307 {&DDRB, &PINB, &PORTB, 4}, // B4 12
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
308 {&DDRB, &PINB, &PORTB, 5}, // B5 13
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
309 {&DDRC, &PINC, &PORTC, 0}, // C0 14
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
310 {&DDRC, &PINC, &PORTC, 1}, // C1 15
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
311 {&DDRC, &PINC, &PORTC, 2}, // C2 16
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
312 {&DDRC, &PINC, &PORTC, 3}, // C3 17
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
313 {&DDRC, &PINC, &PORTC, 4}, // C4 18
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
314 {&DDRC, &PINC, &PORTC, 5} // C5 19
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
315 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
316 #else // defined(__AVR_ATmega1280__)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
317 #error unknown chip
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
318 #endif // defined(__AVR_ATmega1280__)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
319 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
320 static const uint8_t digitalPinCount = sizeof(digitalPinMap)/sizeof(pin_map_t);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
321
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
322 uint8_t badPinNumber(void)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
323 __attribute__((error("Pin number is too large or not a constant")));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
324
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
325 static inline __attribute__((always_inline))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
326 bool getPinMode(uint8_t pin) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
327 if (__builtin_constant_p(pin) && pin < digitalPinCount) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
328 return (*digitalPinMap[pin].ddr >> digitalPinMap[pin].bit) & 1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
329 } else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
330 return badPinNumber();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
331 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
332 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
333 static inline __attribute__((always_inline))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
334 void setPinMode(uint8_t pin, uint8_t mode) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
335 if (__builtin_constant_p(pin) && pin < digitalPinCount) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
336 if (mode) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
337 *digitalPinMap[pin].ddr |= 1 << digitalPinMap[pin].bit;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
338 } else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
339 *digitalPinMap[pin].ddr &= ~(1 << digitalPinMap[pin].bit);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
340 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
341 } else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
342 badPinNumber();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
343 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
344 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
345 static inline __attribute__((always_inline))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
346 bool fastDigitalRead(uint8_t pin) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
347 if (__builtin_constant_p(pin) && pin < digitalPinCount) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
348 return (*digitalPinMap[pin].pin >> digitalPinMap[pin].bit) & 1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
349 } else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
350 return badPinNumber();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
351 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
352 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
353 static inline __attribute__((always_inline))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
354 void fastDigitalWrite(uint8_t pin, uint8_t value) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
355 if (__builtin_constant_p(pin) && pin < digitalPinCount) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
356 if (value) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
357 *digitalPinMap[pin].port |= 1 << digitalPinMap[pin].bit;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
358 } else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
359 *digitalPinMap[pin].port &= ~(1 << digitalPinMap[pin].bit);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
360 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
361 } else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
362 badPinNumber();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
363 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
364 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
365 #endif // Sd2PinMap_h
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
366
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
367
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
368 #endif

mercurial