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