Kaynağa Gözat

Merge pull request #4419 from AnHardt/sd2pinmap

Switch Sd2CardLib to fastio
Scott Lahteine 7 yıl önce
ebeveyn
işleme
9083e5420a

+ 1
- 0
Marlin/MarlinConfig.h Dosyayı Görüntüle

@@ -23,6 +23,7 @@
23 23
 #ifndef MARLIN_CONFIG_H
24 24
 #define MARLIN_CONFIG_H
25 25
 
26
+#include "fastio.h"
26 27
 #include "macros.h"
27 28
 #include "boards.h"
28 29
 #include "Version.h"

+ 9
- 8
Marlin/Sd2Card.cpp Dosyayı Görüntüle

@@ -30,6 +30,7 @@
30 30
 
31 31
 #if ENABLED(SDSUPPORT)
32 32
 #include "Sd2Card.h"
33
+
33 34
 //------------------------------------------------------------------------------
34 35
 #if DISABLED(SOFTWARE_SPI)
35 36
   // functions for hardware SPI
@@ -99,10 +100,10 @@
99 100
     // no interrupts during byte receive - about 8 us
100 101
     cli();
101 102
     // output pin high - like sending 0XFF
102
-    fastDigitalWrite(SPI_MOSI_PIN, HIGH);
103
+    WRITE(SPI_MOSI_PIN, HIGH);
103 104
 
104 105
     for (uint8_t i = 0; i < 8; i++) {
105
-      fastDigitalWrite(SPI_SCK_PIN, HIGH);
106
+      WRITE(SPI_SCK_PIN, HIGH);
106 107
 
107 108
       // adjust so SCK is nice
108 109
       nop;
@@ -110,9 +111,9 @@
110 111
 
111 112
       data <<= 1;
112 113
 
113
-      if (fastDigitalRead(SPI_MISO_PIN)) data |= 1;
114
+      if (READ(SPI_MISO_PIN)) data |= 1;
114 115
 
115
-      fastDigitalWrite(SPI_SCK_PIN, LOW);
116
+      WRITE(SPI_SCK_PIN, LOW);
116 117
     }
117 118
     // enable interrupts
118 119
     sei();
@@ -130,13 +131,13 @@
130 131
     // no interrupts during byte send - about 8 us
131 132
     cli();
132 133
     for (uint8_t i = 0; i < 8; i++) {
133
-      fastDigitalWrite(SPI_SCK_PIN, LOW);
134
+      WRITE(SPI_SCK_PIN, LOW);
134 135
 
135
-      fastDigitalWrite(SPI_MOSI_PIN, data & 0X80);
136
+      WRITE(SPI_MOSI_PIN, data & 0X80);
136 137
 
137 138
       data <<= 1;
138 139
 
139
-      fastDigitalWrite(SPI_SCK_PIN, HIGH);
140
+      WRITE(SPI_SCK_PIN, HIGH);
140 141
     }
141 142
     // hold SCK high for a few ns
142 143
     nop;
@@ -144,7 +145,7 @@
144 145
     nop;
145 146
     nop;
146 147
 
147
-    fastDigitalWrite(SPI_SCK_PIN, LOW);
148
+    WRITE(SPI_SCK_PIN, LOW);
148 149
     // enable interrupts
149 150
     sei();
150 151
   }

+ 0
- 1
Marlin/Sd2Card.h Dosyayı Görüntüle

@@ -37,7 +37,6 @@
37 37
  * \brief Sd2Card class for V2 SD/SDHC cards
38 38
  */
39 39
 #include "SdFatConfig.h"
40
-#include "Sd2PinMap.h"
41 40
 #include "SdInfo.h"
42 41
 //------------------------------------------------------------------------------
43 42
 // SPI speed is F_CPU/2^(1 + index), 0 <= index <= 6

+ 0
- 453
Marlin/Sd2PinMap.h Dosyayı Görüntüle

@@ -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

+ 2
- 2
Marlin/buzzer.h Dosyayı Görüntüle

@@ -31,7 +31,7 @@
31 31
 
32 32
 /**
33 33
  * @brief Tone structure
34
- * @details Simple abstration of a tone based on a duration and a frequency.
34
+ * @details Simple abstraction of a tone based on a duration and a frequency.
35 35
  *
36 36
  */
37 37
 struct tone_t {
@@ -57,7 +57,7 @@ class Buzzer {
57 57
      * @details This will invert the current state of an digital IO pin.
58 58
      */
59 59
     void invert() {
60
-      WRITE(BEEPER_PIN, !READ(BEEPER_PIN));
60
+      TOGGLE(BEEPER_PIN);
61 61
     }
62 62
 
63 63
     /**

+ 12
- 5
Marlin/fastio.h Dosyayı Görüntüle

@@ -2047,11 +2047,6 @@
2047 2047
 #endif
2048 2048
 
2049 2049
 #if defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__)
2050
-  // SPI
2051
-  #define SCK         DIO9
2052
-  #define MISO        DIO11
2053
-  #define MOSI        DIO10
2054
-  #define SS          DIO8
2055 2050
 
2056 2051
   // change for your board
2057 2052
   #define DEBUG_LED   DIO31 /* led D5 red */
@@ -2063,6 +2058,12 @@
2063 2058
   //#define AT90USBxx_TEENSYPP_ASSIGNMENTS // Use Teensy++ 2.0 assignments
2064 2059
   #ifndef AT90USBxx_TEENSYPP_ASSIGNMENTS // Use traditional Marlin pin assignments
2065 2060
 
2061
+    // SPI
2062
+    #define SCK         DIO9   // 21
2063
+    #define MISO        DIO11  // 23
2064
+    #define MOSI        DIO10  // 22
2065
+    #define SS          DIO8   // 20
2066
+
2066 2067
     #define DIO0_PIN        PINA0
2067 2068
     #define DIO0_RPORT      PINA
2068 2069
     #define DIO0_WPORT      PORTA
@@ -2707,6 +2708,12 @@
2707 2708
              The pins 46 and 47 are not supported by Teensyduino, but are supported below.
2708 2709
     */
2709 2710
 
2711
+    // SPI
2712
+    #define SCK             DIO21 // 9
2713
+    #define MISO            DIO23 // 11
2714
+    #define MOSI            DIO22 // 10
2715
+    #define SS              DIO20 // 8
2716
+
2710 2717
     #define DIO0_PIN PIND0
2711 2718
     #define DIO0_RPORT PIND
2712 2719
     #define DIO0_WPORT PORTD

+ 15
- 0
Marlin/pins.h Dosyayı Görüntüle

@@ -432,4 +432,19 @@
432 432
     X_MS1_PIN, X_MS2_PIN, Y_MS1_PIN, Y_MS2_PIN, Z_MS1_PIN, Z_MS2_PIN \
433 433
   }
434 434
 
435
+#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
436
+
437
+#ifndef SCK_PIN
438
+  #define SCK_PIN  SCK
439
+#endif
440
+#ifndef MISO_PIN
441
+  #define MISO_PIN MISO
442
+#endif
443
+#ifndef MOSI_PIN
444
+  #define MOSI_PIN MOSI
445
+#endif
446
+#ifndef SS_PIN
447
+  #define SS_PIN   SS
448
+#endif
449
+
435 450
 #endif //__PINS_H

+ 2
- 9
Marlin/pins_5DPRINT.h Dosyayı Görüntüle

@@ -63,19 +63,12 @@
63 63
 #define TEMP_0_PIN          1  // Extruder / Analog pin numbering
64 64
 #define TEMP_BED_PIN        0  // Bed / Analog pin numbering
65 65
 
66
-// The SDSS pin uses a different pin mapping from file Sd2PinMap.h
66
+// The SDSS pin uses a different pin mapping from file fastio.h
67 67
 #define SDSS               20
68 68
 
69
-#if DISABLED(SDSUPPORT)
70
-  // these pins are defined in the SD library if building with SD support
71
-  #define SCK_PIN           9
72
-  #define MISO_PIN         11
73
-  #define MOSI_PIN         10
74
-#endif
75
-
76 69
 // Microstepping pins
77 70
 // Note that the pin mapping is not from fastio.h
78
-// See Sd2PinMap.h for the pin configurations
71
+// See Sd2PinMap.h for the pin configurations ???
79 72
 #define X_MS1_PIN 25
80 73
 #define X_MS2_PIN 26
81 74
 #define Y_MS1_PIN 9

+ 0
- 8
Marlin/pins_BRAINWAVE.h Dosyayı Görüntüle

@@ -64,11 +64,3 @@
64 64
 #define TEMP_BED_PIN        6  // Bed / Analog pin numbering
65 65
 
66 66
 #define LED_PIN            39
67
-
68
-#if DISABLED(SDSUPPORT)
69
-  // these pins are defined in the SD library if building with SD support
70
-  #define SCK_PIN           9
71
-  #define MISO_PIN         11
72
-  #define MOSI_PIN         10
73
-#endif
74
-

+ 0
- 8
Marlin/pins_BRAINWAVE_PRO.h Dosyayı Görüntüle

@@ -72,11 +72,3 @@
72 72
 #define SDSS               20
73 73
 #define LED_PIN            19
74 74
 #define SD_DETECT_PIN      12
75
-
76
-#if DISABLED(SDSUPPORT)
77
-  // these pins are defined in the SD library if building with SD support
78
-  #define SCK_PIN          21
79
-  #define MISO_PIN         23
80
-  #define MOSI_PIN         22
81
-#endif
82
-

+ 0
- 7
Marlin/pins_PRINTRBOARD.h Dosyayı Görüntüle

@@ -86,13 +86,6 @@
86 86
 
87 87
 #define SDSS               26
88 88
 
89
-#if DISABLED(SDSUPPORT)
90
-  // these pins are defined in the SD library if building with SD support
91
-  #define SCK_PIN           9
92
-  #define MISO_PIN         11
93
-  #define MOSI_PIN         10
94
-#endif
95
-
96 89
 #if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)
97 90
   //we have no buzzer installed
98 91
   #define BEEPER_PIN -1

+ 0
- 7
Marlin/pins_PRINTRBOARD_REVF.h Dosyayı Görüntüle

@@ -92,13 +92,6 @@
92 92
 #define DAC_STEPPER_GAIN     0
93 93
 #define DAC_OR_ADDRESS    0x00
94 94
 
95
-#if DISABLED(SDSUPPORT)
96
-  // these pins are defined in the SD library if building with SD support
97
-  #define SCK_PIN           9
98
-  #define MISO_PIN         11
99
-  #define MOSI_PIN         10
100
-#endif
101
-
102 95
 #if ENABLED(ULTRA_LCD)
103 96
   #define BEEPER_PIN -1
104 97
 

+ 0
- 6
Marlin/pins_RAMPS_14.h Dosyayı Görüntüle

@@ -302,9 +302,3 @@
302 302
   #define MAX6675_SS       66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
303 303
 #endif
304 304
 
305
-#if DISABLED(SDSUPPORT)
306
-  // these pins are defined in the SD library if building with SD support
307
-  #define SCK_PIN          52
308
-  #define MISO_PIN         50
309
-  #define MOSI_PIN         51
310
-#endif

+ 0
- 7
Marlin/pins_RAMPS_OLD.h Dosyayı Görüntüle

@@ -78,10 +78,3 @@
78 78
 #else
79 79
   #define MAX6675_SS       66// Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
80 80
 #endif
81
-
82
-#if DISABLED(SDSUPPORT)
83
-  // these pins are defined in the SD library if building with SD support
84
-  #define SCK_PIN          52
85
-  #define MISO_PIN         50
86
-  #define MOSI_PIN         51
87
-#endif

+ 0
- 6
Marlin/pins_SAV_MKI.h Dosyayı Görüntüle

@@ -65,12 +65,6 @@
65 65
 #define TEMP_0_PIN          7  // Extruder / Analog pin numbering
66 66
 #define TEMP_BED_PIN        6  // Bed / Analog pin numbering
67 67
 
68
-#if DISABLED(SDSUPPORT)
69
-  // these pins are defined in the SD library if building with SD support
70
-  #define SCK_PIN          9
71
-  #define MISO_PIN         11
72
-  #define MOSI_PIN         10
73
-#endif
74 68
 #define SDSS               20         // PB0 - 8 in marlin env.
75 69
 
76 70
 // Extension header pin mapping

+ 0
- 7
Marlin/pins_TEENSY2.h Dosyayı Görüntüle

@@ -109,13 +109,6 @@
109 109
 #define LED_PIN             6
110 110
 #define PS_ON_PIN          27
111 111
 
112
-#if DISABLED(SDSUPPORT)
113
-  // these pins are defined in the SD library if building with SD support
114
-  #define SCK_PIN         21 // 9
115
-  #define MISO_PIN        23 // 11
116
-  #define MOSI_PIN        22 // 10
117
-#endif
118
-
119 112
 #if ENABLED(ULTIPANEL)
120 113
   #define LCD_PINS_RS         8
121 114
   #define LCD_PINS_ENABLE     9

+ 0
- 7
Marlin/pins_TEENSYLU.h Dosyayı Görüntüle

@@ -76,13 +76,6 @@
76 76
 
77 77
 #define SDSS                8
78 78
 
79
-#if DISABLED(SDSUPPORT)
80
-  // these pins are defined in the SD library if building with SD support
81
-  #define SCK_PIN           9
82
-  #define MISO_PIN         11
83
-  #define MOSI_PIN         10
84
-#endif
85
-
86 79
 #if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)
87 80
 
88 81
   #define BEEPER_PIN       -1

+ 1
- 3
Marlin/temperature.cpp Dosyayı Görüntüle

@@ -29,7 +29,6 @@
29 29
 #include "temperature.h"
30 30
 #include "thermistortables.h"
31 31
 #include "language.h"
32
-#include "Sd2PinMap.h"
33 32
 
34 33
 #if ENABLED(USE_WATCHDOG)
35 34
   #include "watchdog.h"
@@ -1021,8 +1020,7 @@ void Temperature::init() {
1021 1020
       OUT_WRITE(MOSI_PIN, HIGH);
1022 1021
       OUT_WRITE(MISO_PIN, HIGH);
1023 1022
     #else
1024
-      pinMode(SS_PIN, OUTPUT);
1025
-      digitalWrite(SS_PIN, HIGH);
1023
+      OUT_WRITE(SS_PIN, HIGH);
1026 1024
     #endif
1027 1025
 
1028 1026
     OUT_WRITE(MAX6675_SS, HIGH);

Loading…
İptal
Kaydet